Fix experience orbs spawning at 32x coordinates clientside #1226
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since Minecraft 1.5, the NetClientHandler / NetClientPlayHandler has been handling experience orb packets incorrectly. While the packet is constructed on the server side with the coordinates multiplied by 32 like the other entity packets, it is NOT divided by 32 when processed on the clientside, unlike other entity packets.
As a result, all experience orbs (and custom subclasses!) will spawn at 32x their serverside coordinates on the client side and will thus be invisible for a second or two until the server sends another wave of absolute teleport packets to update their positions.
This patch divides the coordinates of the clientside constructed XP orb by 32, allowing them to appear immediately after spawning again. This restores the intended behavior, which was last shown in Minecraft 1.4.7.
This vanilla issue is tracked at https://bugs.mojang.com/browse/MC-12013 but has been largely forgotten by Mojang and will probably never be noticed nor fixed.
To test: Simply throw a bottle o' enchanting and observe how the orbs appear immediately and fly outward, whereas without the patch they appear with a delay.