Jump to content

Recommended Posts

Posted

One of the items in my mod allows the user to zoom in at a location which I did using the FOV hook. However, I have noticed that there is no hook for the mouse sensitivity. It is simply hard coded to directly use the value of the sensitivity slider and I can't override that without changing the value of the slider (which is not optimal), overriding the whole entityRendere class, overriding the gameSettings class, or using ASM. Note; I am using minecraft 1.7.10, this would be of no use to me in forge for 1.8. The troublesome code where it would be nice to have a hook added:

 

net.minecraft.client.renderer.EntityRenderer.java

        this.mc.mcProfiler.startSection("mouse");

        if (this.mc.inGameHasFocus && flag)
        {
            this.mc.mouseHelper.mouseXYChange();
            float f1 = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; //Right here. Note the direct access to the variable
            float f2 = f1 * f1 * f1 * 8.0F;
            float f3 = (float)this.mc.mouseHelper.deltaX * f2;
            float f4 = (float)this.mc.mouseHelper.deltaY * f2;
            byte b0 = 1;

            if (this.mc.gameSettings.invertMouse)
            {
                b0 = -1;
            }

            if (this.mc.gameSettings.smoothCamera)
            {
                this.smoothCamYaw += f3;
                this.smoothCamPitch += f4;
                float f5 = p_78480_1_ - this.smoothCamPartialTicks;
                this.smoothCamPartialTicks = p_78480_1_;
                f3 = this.smoothCamFilterX * f5;
                f4 = this.smoothCamFilterY * f5;
                this.mc.thePlayer.setAngles(f3, f4 * (float)b0);
            }
            else
            {
                this.mc.thePlayer.setAngles(f3, f4 * (float)b0);
            }
        }

        this.mc.mcProfiler.endSection();

 

BTW: If anyone knows a good way to do this without a new code or ASM, I would be happy to here it. I should mention I did try overriding the instance of the mouseHelper class with my own that undid the math of the sensitivity code and used my own modifications but the use of integers rendered it a useless change due to it being impossible to move the perspective below certain mouse speeds.

Posted

What do you want to do with it? You can just access the mouse sensitivity with

Minecraft.getMinecraft().gameSettings.mouseSensitivity 

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

That value is the settings value and would be save as the user's settings. It would be by far from optimal, Imagine doing the same with FOV rather than using the Hook. A hook is preferable.

Posted

No new features are going into 1.7.10, and you've already stated that this value can be edited in the game settings directly. You would just have to store the value and revert it before the next time the config was saved.

I'm not seeing anything in here that needs a hook, and definitely not seeing anything that warrants asm.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

sure, I'll do it that way but I should have asked for this back in 1.6 when I started my mod (I didn't because forge for 1.6 was not being updated due to 1.7 being out). Would it be possible to have this in forge for 1.8? FOV got one and its in the same boat.

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.