-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 1.8.8, 1.20.4
-
Community Consensus
-
(Unassigned)
This was tested with a recompiled version of Minecraft 1.8 using MCP. However I cannot test it that easily in newer versions.
The bug
The client does not set the yaw rotation to the valid -180 to 180 angle when the player continues to rotate.
Normally you would not notice that because the debug screen disguises it by doing this. However when you remove this part of the code you will see that the yaw increases to infinity when you rotate. This could in theory cause problems as with high numbers Minecraft has strange movement and rendering bugs.
The reason
The reason for this is that in the public void setAngles(float yaw, float pitch) method of the net.minecraft.entity.Entity class (MCP 1.8 names) just sets the rotation values without testing if they are between -180 and 180.
/** * Adds 15% to the entity's yaw and subtracts 15% from the pitch. Clamps pitch from -90 to 90. Both arguments in * degrees. */ public void setAngles(float yaw, float pitch) { float var3 = this.rotationPitch; float var4 = this.rotationYaw; // Replaced this // this.rotationYaw = (float)((double)this.rotationYaw + (double)yaw * 0.15D); // this.rotationPitch = (float)((double)this.rotationPitch - (double)pitch * 0.15D); this.rotationYaw = MathHelper.wrapAngleTo180_float((float)((double)this.rotationYaw + (double)yaw * 0.15D)); this.rotationPitch = MathHelper.wrapAngleTo180_float((float)((double)this.rotationPitch - (double)pitch * 0.15D)); this.rotationPitch = MathHelper.clamp_float(this.rotationPitch, -90.0F, 90.0F); this.prevRotationPitch += this.rotationPitch - var3; this.prevRotationYaw += this.rotationYaw - var4; }
This fix has however problems when rotating from -180 to 180 it looks like it jumps for two pixels and the player arm is rotating 360°.
- is duplicated by
-
MC-252200 spinning very fast while having a health modifying effect makes it so that you can't move
- Resolved