mojira.dev
MC-83905

Compass animates incorrectly

Instead of the needle moving naturally to the proper position, the compass loops backwards all the way around to the correct position.

This happens on two different occasions:

  • when you are turning around and you face south,

  • when you move between the +X,+Z and +X,-Z quadrants.

A fix is attached, which keeps the angle's local variable in range, rather than just keeping certain return values in range.

Linked issues

Attachments

Comments 28

Confirmed. Happens when passing the direction of the forward z axis.
Duplicated by MC-84596.

Please put 15w31c in affected versions.

Still in 15w36c. Probably should update the description to read "when player faces south" and not "when needle is pointing downward"

18 more comments

Confirmed in 1.9 Pre-release 4 and 1.9.

Affects 1.9.1 Pre-release 1.

Attached is a javascript demo of a possible fix for the compass, which also fixes MC-95460.

Code examples refer to (and the demo is based on) MCP 9.28.

It rewrites the ItemPropertyGetter in ItemCompass to bring it in line with the one in ItemClock (removing extra conversions to/from 2*PI), while keeping all the angle variables within range using MathHelper.positiveModulo.

Specifically, here, the needle flips as the player rotates / moves because the this.rotation is not being kept in range; the fix here is to apply MathHelper.positiveModulo to this.rotation after updating this.rotation, within the wobble function, rather than simply applying positiveModulo on the returned value of the wobble function.

Derb

Erik Broes

Confirmed

Minecraft 15w31b, Minecraft 15w31c, Minecraft 15w36c, Minecraft 15w38a, Minecraft 15w39b, ..., Minecraft 1.9.4, Minecraft 1.10, Minecraft 1.10.2, Minecraft 16w32b, Minecraft 16w33a

Minecraft 16w36a

Retrieved