TESRs registering in preinit don't break pistons anymore. Fixes #2298.

This commit is contained in:
RainWarrior 2015-12-30 11:37:32 +03:00
parent 09e9a181ee
commit db3e039b31
2 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,15 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
@@ -23,10 +23,11 @@
@SideOnly(Side.CLIENT)
public class TileEntityPistonRenderer extends TileEntitySpecialRenderer<TileEntityPiston>
{
- private final BlockRendererDispatcher field_178462_c = Minecraft.func_71410_x().func_175602_ab();
+ private BlockRendererDispatcher field_178462_c;
public void func_180535_a(TileEntityPiston p_180535_1_, double p_180535_2_, double p_180535_4_, double p_180535_6_, float p_180535_8_, int p_180535_9_)
{
+ if(field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab();
BlockPos blockpos = p_180535_1_.func_174877_v();
IBlockState iblockstate = p_180535_1_.func_174927_b();
Block block = iblockstate.func_177230_c();

View file

@ -150,13 +150,13 @@ public class ModelAnimationDebug
super.preInit(event);
B3DLoader.instance.addDomain(MODID);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory"));
ClientRegistry.bindTileEntitySpecialRenderer(Chest.class, ChestRenderer.instance);
}
@Override
public void init(FMLInitializationEvent event)
{
super.init(event);
ClientRegistry.bindTileEntitySpecialRenderer(Chest.class, ChestRenderer.instance);
}
}
@ -239,10 +239,11 @@ public class ModelAnimationDebug
public static ChestRenderer instance = new ChestRenderer();
private ChestRenderer() {}
private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
private BlockRendererDispatcher blockRenderer;
public void renderTileEntityAt(Chest te, double x, double y, double z, float partialTick, int breakStage)
{
if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
IBlockState state = te.getWorld().getBlockState(te.getPos());
state = state.withProperty(STATIC, false);
IBakedModel model = this.blockRenderer.getBlockModelShapes().getModelForState(state);