unifyAdjacentChests((BlockChest) var10, this.world, par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord);
var9 = getBlockMetadata(par1TileEntityChest);
}
if (par1TileEntityChest.adjacentChestZNeg == null && par1TileEntityChest.adjacentChestXNeg == null) {
ModelChest var14;
if (par1TileEntityChest.adjacentChestXPos == null && par1TileEntityChest.adjacentChestZPosition == null) {
var14 = this.chestModel;
this.bindTextureByName("/item/chest.png");
} else {
var14 = this.largeChestModel;
this.bindTextureByName("/item/largechest.png");
}
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(par1TileEntityChest.xCoord, par1TileEntityChest.yCoord + 1.0f, par1TileEntityChest.zCoord + 1.0f);
GL11.glScalef(1.0f, -1.0f, -1.0f);
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
short var11 = 0;
switch (var9) {
case 2:
var11 = 180;
break;
case 3:
var11 = 0;
break;
case 4:
var11 = 90;
break;
case 5:
var11 = -90;
break;
}
if (var9 == 2 && par1TileEntityChest.adjacentChestXPos != null) {
GL11.glTranslatef(1.0f, 0.0f, 0.0f);
}
if (var9 == 5 && par1TileEntityChest.adjacentChestZPosition != null) {
GL11.glTranslatef(0.0f, 0.0f, -1.0f);
}
GL11.glRotatef(var11, 0.0f, 1.0f, 0.0f);
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
float var12 = par1TileEntityChest.prevLidAngle;
float var13;
if (par1TileEntityChest.adjacentChestZNeg != null) {
var13 = par1TileEntityChest.adjacentChestZNeg.prevLidAngle;
if (var13 > var12) {
var12 = var13;
}
}
if (par1TileEntityChest.adjacentChestXNeg != null) {
var13 = par1TileEntityChest.adjacentChestXNeg.prevLidAngle;
if (var13 > var12) {
var12 = var13;
}
}
var12 = 1.0f - var12;
var12 = 1.0f - var12 * var12 * var12;
var14.chestLid.rotateAngleX = -(var12 * (float) Math.PI / 2.0f);
var14.renderAll();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}