Fix lighting for the workbench TESR.
package se.mickelus.tetra.blocks.workbench;
+import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
@@ -8,6 +9,8 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -30,7 +33,14 @@ public class WorkbenchTESR extends TileEntityRenderer<WorkbenchTile> {
GlStateManager.translated(x, y, z);
// Render our item
+ int i = Minecraft.getInstance().world.getCombinedLight(new BlockPos(x, y, z), 0);
+ int j = i % 65536;
+ int k = i / 65536;
+ GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float)j, (float)k);
+ GlStateManager.color4f(1.0f, 1.0f, 1.0f, 1.0f);
+ GlStateManager.enableLighting();
renderItem(itemStack);
+ GlStateManager.disableLighting();
GlStateManager.popMatrix();
}
@@ -41,7 +51,7 @@ public class WorkbenchTESR extends TileEntityRenderer<WorkbenchTile> {
applyCorrections(itemStack);
- Minecraft.getInstance().getItemRenderer().renderItem(itemStack, TransformType.GROUND);
+ itemRenderer.renderItem(itemStack, TransformType.GROUND);
}
