From 624700a0b4cbe530ad5b1211ca42c69dce6b9eef Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Mon, 5 Aug 2013 16:49:56 -0400 Subject: [PATCH] More dynamic item rendering --- .../render/RenderBattery.java | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/resonantinduction/render/RenderBattery.java b/src/resonantinduction/render/RenderBattery.java index 99f24a980..4ce06034b 100644 --- a/src/resonantinduction/render/RenderBattery.java +++ b/src/resonantinduction/render/RenderBattery.java @@ -86,6 +86,13 @@ public class RenderBattery extends TileEntitySpecialRenderer for (int slot = 0; slot < 4; slot++) { + Vector3 sideVec = new Vector3(t).getFromSide(correctSide(direction)); + + if(!t.worldObj.isAirBlock((int)sideVec.x, (int)sideVec.y, (int)sideVec.z)) + { + continue; + } + GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5f, (float) y + 0.7f, (float) z + 0.5f); @@ -134,23 +141,33 @@ public class RenderBattery extends TileEntitySpecialRenderer GL11.glScalef(0.5f, 0.5f, 0.5f); - Vector3 sideVec = new Vector3(t).getFromSide(direction); - - if(t.worldObj.isAirBlock((int)sideVec.x, (int)sideVec.y, (int)sideVec.z)) - { - this.renderItemSimple(this.fakeBattery); - - if (--renderAmount <= 0) - { - GL11.glPopMatrix(); - return; - } - } - + this.renderItemSimple(this.fakeBattery); GL11.glPopMatrix(); + + if (--renderAmount <= 0) + { + return; + } } } } + + private ForgeDirection correctSide(ForgeDirection side) + { + switch(side) + { + case NORTH: + return ForgeDirection.WEST; + case SOUTH: + return ForgeDirection.NORTH; + case EAST: + return ForgeDirection.SOUTH; + case WEST: + return ForgeDirection.EAST; + default: + return null; + } + } public void renderItemSimple(EntityItem entityItem) {