From ab26ba5b73ab3e666426f9e9c1b3d94d737e2896 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sun, 5 Jan 2014 20:20:58 +0000 Subject: [PATCH] More avoidance of crashing due to separator changes. --- common/mekanism/generators/client/BlockRenderingHandler.java | 4 ++-- common/mekanism/generators/common/block/BlockGenerator.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/mekanism/generators/client/BlockRenderingHandler.java b/common/mekanism/generators/client/BlockRenderingHandler.java index 2f6da4286..7a7a8f4bf 100644 --- a/common/mekanism/generators/client/BlockRenderingHandler.java +++ b/common/mekanism/generators/client/BlockRenderingHandler.java @@ -81,7 +81,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "WindTurbine.png")); windTurbine.render(0.018F, 0); } - else { + else if(metadata != 2) { MekanismRenderer.renderItem(renderer, metadata, block); } } @@ -96,7 +96,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler { int metadata = world.getBlockMetadata(x, y, z); - if(!GeneratorType.getFromMetadata(metadata).hasModel) + if(GeneratorType.getFromMetadata(metadata) == null || !GeneratorType.getFromMetadata(metadata).hasModel) { renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBoundsFromBlock(block); diff --git a/common/mekanism/generators/common/block/BlockGenerator.java b/common/mekanism/generators/common/block/BlockGenerator.java index cca4f6d1f..19661ecf5 100644 --- a/common/mekanism/generators/common/block/BlockGenerator.java +++ b/common/mekanism/generators/common/block/BlockGenerator.java @@ -434,6 +434,11 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z); ItemStack itemStack = new ItemStack(MekanismGenerators.Generator, 1, world.getBlockMetadata(x, y, z)); + if(tileEntity == null) + { + return null; + } + IEnergizedItem electricItem = (IEnergizedItem)itemStack.getItem(); electricItem.setEnergy(itemStack, tileEntity.electricityStored);