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
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
|
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)
|
||||||
{
|
{
|
||||||
/**
|
// Render top and bottom
|
||||||
* How to render entire battery:
|
//if (!(new Vector3(t).translate(dir).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||||
for each quadrant:
|
{
|
||||||
render Battery
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||||
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();
|
if (!(new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||||
glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
|
MODEL.renderPart("CapCorner");
|
||||||
glScalef(0.46f, 0.46f, 0.46f);
|
if (!(new Vector3(t).translate(ForgeDirection.DOWN).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||||
GL11.glRotatef(90 * i, 0, 1, 0);
|
MODEL.renderPart("BaseCorner");
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
}
|
||||||
|
|
||||||
Vector3 checkPos = new Vector3(t).modifyPositionFromSide(dir);
|
|
||||||
|
|
||||||
// If this face has no other batteries attatched in this direction:
|
|
||||||
|
|
||||||
|
// If quadrant with one external neighbor
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||||
MODEL.renderPart("BaseCorner");
|
|
||||||
MODEL.renderPart("CapCorner");
|
if (!(new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_LEVELS);
|
MODEL.renderPart("CapEdge");
|
||||||
MODEL.renderPart("Battery");
|
if (!(new Vector3(t).translate(ForgeDirection.DOWN).getTileEntity(t.worldObj) instanceof TileBattery))
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
MODEL.renderPart("BaseEdge");
|
||||||
MODEL.renderPart("CapInterior");
|
|
||||||
MODEL.renderPart("CapEdge");
|
// if quadrant with three external neighbors //can't have quadrant with 2 external
|
||||||
MODEL.renderPart("BaseEdge");
|
// neighbors in rectangular prism
|
||||||
MODEL.renderPart("BaseInterior");
|
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);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CASE);
|
||||||
MODEL.renderPart("VertConnector");
|
MODEL.renderPart("BatteryCase");
|
||||||
|
|
||||||
if (new Vector3(t).modifyPositionFromSide(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery)
|
if (new Vector3(t).translate(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery)
|
||||||
MODEL.renderPart("BatteryCase");
|
MODEL.renderPart("VertConnector");
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue