Questional fix for Custom Blocks not lighting correctly in GUI
Dockter opened this issue ยท 4 comments
Ordi, In our
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();
}
@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.
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.