vini2003/Spinnery

Fix Item drawing not to use 200 Z-levels

Closed this issue · 5 comments

Fix Item drawing not to use 200 Z-levels

I assume this causes the slot highlight to render under the item in the slot?

Yep.

Actually, most vanilla GUIs (anything that extends ContainerScreen/HandledScreen) draw items at 200 Z, they just do this to render the slot highlight over the item:

// code snippet from 1.15, methods may have been renamed or deprecated in 1.16
RenderSystem.disableDepthTest();
RenderSystem.colorMask(true, true, true, false);
DrawableHelper.this.fillGradient(x, y, x + 16, y + 16, 0x80FFFFFF, 0x80FFFFFF);
RenderSystem.colorMask(true, true, true, true);
RenderSystem.enableDepthTest();

(if you're wondering why calling fillGradient with identical colors is a thing, the 1-color fill is static and doesn't take the blit offset into account without manual Z translation.)

There are a few ways I can go about fixing this; namely offsetting the entire grid by 200-Z increments in order to bypass the temporary matrices used by item rendering and allow WSlot stacking. I won't be doing that for now though as I still have some hope Mojang will fix this some time soon.

For now, I will keep this open.

Fixed in 3.0.56. (1.16.1)