Attempt to fix render battery crash

This commit is contained in:
Calclavia 2013-09-08 19:58:19 +08:00
parent e2a1b5c08a
commit 7d57f983e0
10 changed files with 76 additions and 68 deletions

View file

@ -73,6 +73,13 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (block instanceof BlockBattery)
{
// FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);
return true;
}
return false;
}

View file

@ -44,8 +44,8 @@ public class RenderBattery extends TileEntitySpecialRenderer
private Random random = new Random();
protected RenderManager renderManager;
// IModelCustom batteryModel = AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY +
// "modularBattery.tcn");
// public static final IModelCustom batteryModel =
// AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY + "battery.tcn");
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -54,6 +54,7 @@ public class RenderBattery extends TileEntitySpecialRenderer
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
if (((TileEntityBattery) t).structure.isMultiblock)
{
this.bindTexture(TEXTURE_MULTI);
@ -64,7 +65,9 @@ public class RenderBattery extends TileEntitySpecialRenderer
}
MODEL.render(0.0625f);
// batteryModel.renderAll();
/*
* GL11.glScalef(0.0625f, 0.0625f, 0.0625f); batteryModel.renderAll();
*/
GL11.glPopMatrix();
if (Minecraft.getMinecraft().gameSettings.fancyGraphics)
@ -179,6 +182,8 @@ public class RenderBattery extends TileEntitySpecialRenderer
}
public void renderItemSimple(EntityItem entityItem)
{
if (entityItem != null)
{
Tessellator tessellator = Tessellator.instance;
ItemStack itemStack = entityItem.getEntityItem();
@ -215,7 +220,8 @@ public class RenderBattery extends TileEntitySpecialRenderer
for (int kj = 0; kj < b0; ++kj)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a
// Makes items offset when in 3D, like when in 2D, looks much better. Considered
// a
// vanilla bug...
if (kj > 0)
{
@ -244,13 +250,8 @@ public class RenderBattery extends TileEntitySpecialRenderer
GL11.glPopMatrix();
}
}
@Override
protected void bindTexture(ResourceLocation par1ResourceLocation)
{
this.renderManager.renderEngine.bindTexture(par1ResourceLocation);
}
public byte getMiniItemCount(ItemStack stack)