Jump to content

AyyyyLmao

Members
  • Posts

    27
  • Joined

  • Last visited

Posts posted by AyyyyLmao

  1. Im creating a '1.7 blockhit' mod for forge, I created a mcp version a while ago and the people I gave it to want me to make a forge version so its compatible with other mods like bspkrs's mods and such.

    The way to do this is in the 'renderItemInFirstPerson' method in 'ItemRenderer', there is a switch statement for the action that the item is doing, case 4 of the statement is the blocking animation.

    Normally case 4 just contains this

    case 4:
        this.func_178096_b(var2, 0.0F);
        this.func_178103_d();
        break;

    To change the animation that is played in 1.8 and make it show the animation that was shown in 1.7 all you have to do is change the values and then use the GlStateManager to translate it in to a better position like so

    case 4:
        this.func_178096_b(0.2F, var4);
        this.func_178103_d();
        GlStateManager.translate(-0.5F, 0.2F, 0.0F);
        break;

    Is there an easy way to override this method using reflection or something? because I've tried using a subclass of the ItemRenderer method but that didn't work because some of the methods that are run inside of the 'renderItemInFirstPerson' method are private

  2. I'm trying to make a 1.7 block hit mod for forge, I already have a mcp version of it. All I have to do is this:

    [spoiler=Normal renderItemInFirstPerson method]

    public void renderItemInFirstPerson(float p_78440_1_)
        {
            float var2 = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * p_78440_1_);
            EntityPlayerSP var3 = this.mc.thePlayer;
            float var4 = var3.getSwingProgress(p_78440_1_);
            float var5 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * p_78440_1_;
            float var6 = var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * p_78440_1_;
            this.func_178101_a(var5, var6);
            this.func_178109_a(var3);
            this.func_178110_a((EntityPlayerSP)var3, p_78440_1_);
            GlStateManager.enableRescaleNormal();
            GlStateManager.pushMatrix();
    
            if (this.itemToRender != null)
            {
                if (this.itemToRender.getItem() == Items.filled_map)
                {
                    this.func_178097_a(var3, var5, var2, var4);
                }
                else if (var3.getItemInUseCount() > 0)
                {
                    EnumAction var7 = this.itemToRender.getItemUseAction();
    
                    switch (ItemRenderer.SwitchEnumAction.field_178094_a[var7.ordinal()])
                    {
                        case 1:
                            this.func_178096_b(var2, 0.0F);
                            break;
    
                        case 2:
                        case 3:
                            this.func_178104_a(var3, p_78440_1_);
                            this.func_178096_b(var2, 0.0F);
                            break;
    
                        case 4:
                            this.func_178096_b(var2, 0.0F);
                            this.func_178103_d();
                            break;
    
                        case 5:
                            this.func_178096_b(var2, 0.0F);
                            this.func_178098_a(p_78440_1_, var3);
                    }
                }
                else
                {
                    this.func_178105_d(var4);
                    this.func_178096_b(var2, var4);
                }
    
                this.renderItem(var3, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON);
            }
            else if (!var3.isInvisible())
            {
                this.func_178095_a(var3, var2, var4);
            }
    
            GlStateManager.popMatrix();
            GlStateManager.disableRescaleNormal();
            RenderHelper.disableStandardItemLighting();
        }

     

    and change it to this

    [spoiler=Modded renderItemInFirstPerson method]

    public void renderItemInFirstPerson(float p_78440_1_)
        {
            float var2 = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * p_78440_1_);
            EntityPlayerSP var3 = this.mc.thePlayer;
            float var4 = var3.getSwingProgress(p_78440_1_);
            float var5 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * p_78440_1_;
            float var6 = var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * p_78440_1_;
            this.func_178101_a(var5, var6);
            this.func_178109_a(var3);
            this.func_178110_a((EntityPlayerSP)var3, p_78440_1_);
            GlStateManager.enableRescaleNormal();
            GlStateManager.pushMatrix();
    
            if (this.itemToRender != null)
            {
                if (this.itemToRender.getItem() == Items.filled_map)
                {
                    this.func_178097_a(var3, var5, var2, var4);
                }
                else if (var3.getItemInUseCount() > 0)
                {
                    EnumAction var7 = this.itemToRender.getItemUseAction();
    
                    switch (ItemRenderer.SwitchEnumAction.field_178094_a[var7.ordinal()])
                    {
                        case 1:
                            this.func_178096_b(var2, 0.0F);
                            break;
    
                        case 2:
                        case 3:
                            this.func_178104_a(var3, p_78440_1_);
                            this.func_178096_b(var2, 0.0F);
                            break;
    
                        case 4:
                            this.func_178096_b(0.2F, var4);
                            this.func_178103_d();
                            GlStateManager.translate(-0.5F, 0.2F, 0.0F);
                            break;
    
                        case 5:
                            this.func_178096_b(var2, 0.0F);
                            this.func_178098_a(p_78440_1_, var3);
                    }
                }
                else
                {
                    this.func_178105_d(var4);
                    this.func_178096_b(var2, var4);
                }
    
                this.renderItem(var3, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON);
            }
            else if (!var3.isInvisible())
            {
                this.func_178095_a(var3, var2, var4);
            }
    
            GlStateManager.popMatrix();
            GlStateManager.disableRescaleNormal();
            RenderHelper.disableStandardItemLighting();
        }

     

    And then it does the old 1.7 block hit animation

  3. Hey, so I've been reading through this http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

    And I want to create my own coremod to change some of the 1.8 player animations back to 1.7's style, example: blockhit, sneaking, damage etc.

    But I don't know how to do this for 1.8 let alone 1.6.2 if I was using it, so I was wondering if anyone can give me some help or explain it in an easier way to understand.

    Thanks.

  4. I want to display a few paragraphs of text which will have all the changes in an upcoming version. But if the user has their window size different to what I'm testing with then it will go over the edges and the user will not view it correctly.

    How would I implement a scroll bar and format it to fit in every window of any size?

     

    Heres what I have now:

    package mc.ayyyylmao.testgui;
    
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiControls;
    import net.minecraft.client.gui.GuiMultiplayer;
    import net.minecraft.client.gui.GuiScreen;
    
    public class TestGui extends GuiScreen {
    private GuiScreen parentScreen;
    
    private GuiButton dlnow;
    private GuiButton rmlater;
    
    private int headerPos;
    private int footerPos;
    
    private byte byte0 = -16;
    
    public TestGui(GuiScreen parent) {
    	this.parentScreen = parent;
    }
    
    public void initGui() {
    	this.buttonList.clear();
    
    	headerPos = 35;
    	footerPos = this.height - 29;
    
    	this.dlnow = new GuiButton(1, this.width / 2 - 70, footerPos-17, 150, 20, "Download Now");
    	this.rmlater = new GuiButton(2, this.width / 2 - 70, footerPos+3, 150, 20, "Remind Me Later");
    
    	this.buttonList.add(dlnow);
    	this.buttonList.add(rmlater);
    }
    
        protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
            if (mouseButton == 0) {
                for (int l = 0; l < this.buttonList.size(); ++l) {
                    GuiButton guibutton = (GuiButton)this.buttonList.get(l);
    
                    if (guibutton.mousePressed(this.mc, mouseX, mouseY)) {
                        actionPerformed(guibutton);
                    }
                }
            }
        }
    
    protected void actionPerformed(GuiButton button) {
    	switch(button.id) {		
    		case 1:
                                    // Do stuff
    			break;
                            case 2:
                                    // Do stuff
                                    break;
    	}
    }
    
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {	
    	this.drawBackground(0);
    	this.drawGradientRect(0, 50, this.width, this.height - 50, -1072689136, -804253680);
    
    	this.drawCenteredString(this.fontRendererObj, "New Version Released", this.width/2, headerPos, 0xFFFFFF);
    
    	super.drawScreen(mouseX, mouseY, partialTicks);
    }
    }

     

    Thanks.

  5. I don't think there is hook for before sending anything.

     

    Depending how autocorrecting your autocorrect will be you might do some tricks.

     

    Minecraft client knows current Gui opened. (mc.currentScreen).

    There is ClientTickEvent that is fired by FML client-side every phase: START and END of tick (choose one always).

    You can check if gui instanceof GuiChat and get currently written text box and apply autocorrect, problem is you would need to do it in some tricky way to not interfere with player's input. (Obviously not every tick).

     

    If you can't think of a way to do it (I can, but don't know what are you planning) then you are left with implementing custom GuiChat (there is also GuiChatNew, look it up) and using GuiOpenEvent - replace GuiChat with yours. (better way I think, if you are planning that big feature, yet - more coding).

     

    EDIT

    Obviously, you can also use other events - Input events, e.g "click 'Insert' to check spelling".

     

    I was thinking of having a guibutton popup above the word as you're typing it and that way if you spelled the word incorrectly and want to correct it you can click the button that you want.

    I'm interested in hearing what you had in mind though. If you would like to tell me that is, I don't mind :>

  6. What you have against Iterators? :o

     

    someLivingEntity.getActivePotionEffect(<thePotion>) gives you the potion effect which tells you everything about the potion, such as amount left, modifier, etc.

     

    Nothing xD I just wanted to know if there was an easier way :P

    But thanks :D

  7. Hey,

    Im trying to create a Damage Reduction Calculator so I can see how much damage my armor, potion effects and enchants are stopping, and I have everything so far I just dont know how to get just the resistance level I have.

    I want to be able to just get the resistance effect's amplifier without having to create and iterator. Is there a way to do this?

    Thanks.

  8. You must be doing something wrong.

    EntityPlayerMP exists only on server side.

    Commands registered using FMLServerStartingEvent call execute() on server side, therefore you can cast ICS to EntityPlayerMP.

    Why do you need EntityClientPlayerMP? If you are looking for Client commands, they should be registered with ClientCommandHandler.instance.registerCommand(cmd);

    Everytime i use the command i get this

    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.ClassCastException: net.minecraft.client.entity.EntityClientPlayerMP cannot be cast to net.minecraft.entity.player.EntityPlayerMP
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.ayyyylmao.ping.cmds.PingCommand.func_71515_b(PingCommand.java:49)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraftforge.client.ClientCommandHandler.func_71556_a(ClientCommandHandler.java:72)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.gui.GuiChat.func_146403_a(GuiChat.java:141)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.gui.GuiChat.func_73869_a(GuiChat.java:131)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.gui.GuiScreen.func_146282_l(GuiScreen.java:319)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:276)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1628)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:961)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:887)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.main.Main.main(SourceFile:148)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at java.lang.reflect.Method.invoke(Method.java:483)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    [22:08:22] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

  9. There are 2 types of icommand sender. player and console. so check if the sender is an instance of player and if it is an player cast it to entityplayermp

    I need to get to get the EntityClientPlayerMP, but i cant cast it to EntityPlayerMP .-.

    java.lang.ClassCastException: net.minecraft.client.entity.EntityClientPlayerMP cannot be cast to net.minecraft.entity.player.EntityPlayerMP

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.