MalisisCore

48M Downloads

Questional fix for Custom Blocks not lighting correctly in GUI

Dockter opened this issue ยท 4 comments

commented

Ordi, In our

https://github.com/AlmuraDev/Almura/blob/master/src/main/java/com/almuradev/almura/pack/renderer/BlockRenderer.java

which is used to render blocks as items in the GUI (hotbar specifically) in this example.

Problem is that they aren't lit correctly. The hotbar icon is dark in color.

I fixed this issue by modifying this method in MalisisRenderer.java
@OverRide
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer)
{
set(block, metadata);
// New
RenderHelper.enableGUIStandardItemLighting();
renderBlocks = renderer;
prepare(RenderType.ISBRH_INVENTORY);
render();
clean();
// New
RenderHelper.enableStandardItemLighting();
}

commented

Apparently fixed since then.

commented

@Zidane attempted to correct this issue by issueing a RenderHelper.enableStandardItemLighting() prior to the shape.draw method but the tessellator has already began to draw at this point because our BlockRenderer.java's draw() method is being called after your prepare method which is where it begins the tesselation.

commented

Another note:

The first "RenderHelper.enableGUIStandardItemLighting() fixes our custom block lighting issue.

The 2nd method "RenderHelper.enableStandardItemLighting() was required in order for the next item within the hotbar to be lit correctly. Without this line, any vanilla block that appeared AFTER our custom block in sequence on the hotbar would then render dark.

commented

As an additional note, Optifine handles this bug within their render engine update as it doesn't happen with Optifine....