Minor work on battery renderer
This commit is contained in:
parent
1805ddbbb1
commit
c0937c8cdb
1 changed files with 38 additions and 49 deletions
|
@ -37,64 +37,53 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
|||
@Override
|
||||
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
|
||||
{
|
||||
if (t.worldObj != null)
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
for (int i = 2; i < 6; i++)
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
|
||||
glScalef(0.46f, 0.46f, 0.46f);
|
||||
GL11.glRotatef(90 * i, 0, 1, 0);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_LEVELS);
|
||||
MODEL.renderPart("Battery");
|
||||
|
||||
if (t.worldObj != null)
|
||||
{
|
||||
/**
|
||||
* How to render entire battery:
|
||||
for each quadrant:
|
||||
render Battery
|
||||
if corner of multiblock and is the quadrant that has no neighbors
|
||||
if(no battery below)
|
||||
render BaseCorner
|
||||
if(no battery above)
|
||||
render CapCorner
|
||||
if quadrant with one external neighbor
|
||||
if(no battery below)
|
||||
render BaseEdge
|
||||
if(no battery above)
|
||||
render CapEdge
|
||||
if quadrant with three external neighbors //can't have quadrant with 2 external neighbors in rectangular prism
|
||||
if(no battery below)
|
||||
render BaseEdge
|
||||
if(no battery above)
|
||||
render CapEdge
|
||||
for each side:
|
||||
render BatteryCase
|
||||
if(battery above)
|
||||
render VertConnector
|
||||
*/
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
|
||||
glScalef(0.46f, 0.46f, 0.46f);
|
||||
GL11.glRotatef(90 * i, 0, 1, 0);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
|
||||
Vector3 checkPos = new Vector3(t).modifyPositionFromSide(dir);
|
||||
// Render top and bottom
|
||||
//if (!(new Vector3(t).translate(dir).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||
|
||||
// If this face has no other batteries attatched in this direction:
|
||||
if (!(new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
MODEL.renderPart("CapCorner");
|
||||
if (!(new Vector3(t).translate(ForgeDirection.DOWN).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
MODEL.renderPart("BaseCorner");
|
||||
}
|
||||
|
||||
// If quadrant with one external neighbor
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||
MODEL.renderPart("BaseCorner");
|
||||
MODEL.renderPart("CapCorner");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_LEVELS);
|
||||
MODEL.renderPart("Battery");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||
MODEL.renderPart("CapInterior");
|
||||
MODEL.renderPart("CapEdge");
|
||||
MODEL.renderPart("BaseEdge");
|
||||
MODEL.renderPart("BaseInterior");
|
||||
|
||||
if (!(new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
MODEL.renderPart("CapEdge");
|
||||
if (!(new Vector3(t).translate(ForgeDirection.DOWN).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
MODEL.renderPart("BaseEdge");
|
||||
|
||||
// if quadrant with three external neighbors //can't have quadrant with 2 external
|
||||
// neighbors in rectangular prism
|
||||
if (!(new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
MODEL.renderPart("CapInterior");
|
||||
if (!(new Vector3(t).translate(ForgeDirection.DOWN).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||
MODEL.renderPart("BaseInterior");
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CASE);
|
||||
MODEL.renderPart("VertConnector");
|
||||
|
||||
if (new Vector3(t).modifyPositionFromSide(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery)
|
||||
MODEL.renderPart("BatteryCase");
|
||||
MODEL.renderPart("BatteryCase");
|
||||
|
||||
glPopMatrix();
|
||||
if (new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery)
|
||||
MODEL.renderPart("VertConnector");
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue