Fixed #10 - Render wire NPE

This commit is contained in:
Calclavia 2013-08-14 08:45:26 +08:00
parent 84ba19fc19
commit a52b4d39a3

View file

@ -31,39 +31,42 @@ public class RenderWire extends TileEntitySpecialRenderer
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(COPPER_TEXTURE); FMLClientHandler.instance().getClient().renderEngine.func_110577_a(COPPER_TEXTURE);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F); GL11.glScalef(1, -1, -1);
tileEntity.adjacentConnections = null; tileEntity.adjacentConnections = null;
TileEntity[] adjacentConnections = tileEntity.getAdjacentConnections(); TileEntity[] adjacentConnections = tileEntity.getAdjacentConnections();
if (adjacentConnections[0] != null) if (adjacentConnections != null)
{ {
WIRE_MODEL.renderBottom(); if (adjacentConnections[0] != null)
} {
WIRE_MODEL.renderBottom();
}
if (adjacentConnections[1] != null) if (adjacentConnections[1] != null)
{ {
WIRE_MODEL.renderTop(); WIRE_MODEL.renderTop();
} }
if (adjacentConnections[2] != null) if (adjacentConnections[2] != null)
{ {
WIRE_MODEL.renderBack(); WIRE_MODEL.renderBack();
} }
if (adjacentConnections[3] != null) if (adjacentConnections[3] != null)
{ {
WIRE_MODEL.renderFront(); WIRE_MODEL.renderFront();
} }
if (adjacentConnections[4] != null) if (adjacentConnections[4] != null)
{ {
WIRE_MODEL.renderLeft(); WIRE_MODEL.renderLeft();
} }
if (adjacentConnections[5] != null) if (adjacentConnections[5] != null)
{ {
WIRE_MODEL.renderRight(); WIRE_MODEL.renderRight();
}
} }
WIRE_MODEL.renderMiddle(); WIRE_MODEL.renderMiddle();