Adventure Tools

Adventure Tools

687k Downloads

Ender Lantern Rendering Box above ores and Shifting makes it go down

NomSTeh opened this issue ยท 1 comments

commented

The box renders above the ores and also when shifting the box goes slightly downwards.

https://puu.sh/E8ty9/bf0b9fc514.gif

commented

I have a fix for the box rendering above the ore, but not for the shifting box.

A little documentation on the issue:
Sometime between 1.12.2 and 1.14.4, Mojang changed either the position relative to the player that the world is rendered from, or changed PlayerEntity.lastTickPosY and PlayerEntity.posY to not include the player's eye height, and created PlayerEntity.getEyeHeight() instead. This caused the relative values used in the highlightBlock() function used in ItemLantern.java to be skewed, which is solved by adding PlayerEntity.getEyeHeight() to the y-value used.

However, the highlightBlock() function must also account for the player's motion, and thus uses (player.posY - player.lastTickPosY) * ticks to calculate the necessary adjustment. Unfortunately, both player.posY and player.lastTickPosY do not account for a shifting eye height, so the boxes are skewed by about half a block while the player is in a sneaking motion.

The solution is to get the player's eye height from the previous tick, which I can't seem to find in the Minecraft source code. I don't know how I would do this at the moment. A core mod could implement it directly, but it's probably not worth it and goes against the design philosophy of the mod anyways, which is to be a self-contained mod, excluding dependencies as an option.

I'll look into this further.