Jump to content

Update hardcoded values for getEyeHeight method of EntityPlayer class


cookiegalaxy

Recommended Posts

[I've written lots of code before, but this would be my first time writing a minecraft mod from scratch]

I'm looking to adjust the height of the first person camera with client-side modifications to work with a custom player model.

Based on reading some of the decompiled code from MCP and the source code for https://github.com/Exopandora/ShoulderSurfing , I believe I need to update the getEyeHeight method.

From what I've read, the two standard way of achieving this would be Access Transformers and Bytecode manipulation. I'm wondering if there's a simpler way I could modify this value or rewrite the method?

```Java

public float getEyeHeight()
    {
        float f = 1.62F;

        if (this.isPlayerSleeping())
        {
            f = 0.2F;
        }
        else if (!this.isSneaking() && this.height != 1.65F)
        {
            if (this.isElytraFlying() || this.height == 0.6F)
            {
                f = 0.4F;
            }
        }
        else
        {
            f -= 0.08F;
        }

        return f;
    }

```

Method taken from MCP with minecraft version 1.12.2 and the class EntityPlayer.

 

Right now I'd like to try something simple like changing `float f = 1.62F` to 1.20F or something like that.

Any direction or help would be appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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