Almost done with part one of tank render
I have still yet to code the tank merging for the render which will be a pain since either A) have to move around dozens of liquid block to render a full rank, or B) render one large block which will take calcing out the size and pos of the cube... B will also not work with odd shapped cubes unless multi are used hmm...
This commit is contained in:
parent
097e46a43e
commit
561ecfea74
4 changed files with 95 additions and 114 deletions
Binary file not shown.
|
@ -13,7 +13,6 @@ import net.minecraft.entity.Entity;
|
||||||
public class ModelTankSide extends ModelBase
|
public class ModelTankSide extends ModelBase
|
||||||
{
|
{
|
||||||
// fields
|
// fields
|
||||||
ModelRenderer tankBack;
|
|
||||||
ModelRenderer backRightSiding;
|
ModelRenderer backRightSiding;
|
||||||
ModelRenderer backLeftSiding;
|
ModelRenderer backLeftSiding;
|
||||||
ModelRenderer backTopSiding;
|
ModelRenderer backTopSiding;
|
||||||
|
@ -26,109 +25,89 @@ public class ModelTankSide extends ModelBase
|
||||||
ModelRenderer botLeftOut;
|
ModelRenderer botLeftOut;
|
||||||
ModelRenderer topRightOut;
|
ModelRenderer topRightOut;
|
||||||
ModelRenderer topLeftOut;
|
ModelRenderer topLeftOut;
|
||||||
ModelRenderer tankBackRight;
|
|
||||||
ModelRenderer tankBackLeft;
|
|
||||||
|
|
||||||
public ModelTankSide()
|
public ModelTankSide()
|
||||||
{
|
{
|
||||||
textureWidth = 128;
|
textureWidth = 128;
|
||||||
textureHeight = 128;
|
textureHeight = 128;
|
||||||
|
|
||||||
tankBack = new ModelRenderer(this, 21, 43);
|
backRightSiding = new ModelRenderer(this, 0, 19);
|
||||||
tankBack.addBox(-6F, 8F, 5F, 12, 16, 1);
|
backRightSiding.addBox(-7F, 10F, 7F, 2, 12, 1);
|
||||||
tankBack.setRotationPoint(0F, 0F, 0F);
|
backRightSiding.setRotationPoint(0F, 0F, 0F);
|
||||||
tankBack.setTextureSize(128, 128);
|
backRightSiding.setTextureSize(128, 128);
|
||||||
tankBack.mirror = true;
|
backRightSiding.mirror = true;
|
||||||
setRotation(tankBack, 0F, 0F, 0F);
|
setRotation(backRightSiding, 0F, 0F, 0F);
|
||||||
backRightSiding = new ModelRenderer(this, 0, 19);
|
backLeftSiding = new ModelRenderer(this, 0, 19);
|
||||||
backRightSiding.addBox(-6F, 10F, 6F, 2, 12, 1);
|
backLeftSiding.addBox(5F, 10F, 7F, 2, 12, 1);
|
||||||
backRightSiding.setRotationPoint(0F, 0F, 0F);
|
backLeftSiding.setRotationPoint(0F, 0F, 0F);
|
||||||
backRightSiding.setTextureSize(128, 128);
|
backLeftSiding.setTextureSize(128, 128);
|
||||||
backRightSiding.mirror = true;
|
backLeftSiding.mirror = true;
|
||||||
setRotation(backRightSiding, 0F, 0F, 0F);
|
setRotation(backLeftSiding, 0F, 0F, 0F);
|
||||||
backLeftSiding = new ModelRenderer(this, 0, 19);
|
backTopSiding = new ModelRenderer(this, 7, 8);
|
||||||
backLeftSiding.addBox(4F, 10F, 6F, 2, 12, 1);
|
backTopSiding.addBox(-4F, 8F, 7F, 8, 2, 1);
|
||||||
backLeftSiding.setRotationPoint(0F, 0F, 0F);
|
backTopSiding.setRotationPoint(0F, 0F, 0F);
|
||||||
backLeftSiding.setTextureSize(128, 128);
|
backTopSiding.setTextureSize(128, 128);
|
||||||
backLeftSiding.mirror = true;
|
backTopSiding.mirror = true;
|
||||||
setRotation(backLeftSiding, 0F, 0F, 0F);
|
setRotation(backTopSiding, 0F, 0F, 0F);
|
||||||
backTopSiding = new ModelRenderer(this, 7, 8);
|
backBotSiding = new ModelRenderer(this, 7, 8);
|
||||||
backTopSiding.addBox(-4F, 8F, 6F, 8, 2, 1);
|
backBotSiding.addBox(-4F, 22F, 7F, 8, 2, 1);
|
||||||
backTopSiding.setRotationPoint(0F, 0F, 0F);
|
backBotSiding.setRotationPoint(0F, 0F, 0F);
|
||||||
backTopSiding.setTextureSize(128, 128);
|
backBotSiding.setTextureSize(128, 128);
|
||||||
backTopSiding.mirror = true;
|
backBotSiding.mirror = true;
|
||||||
setRotation(backTopSiding, 0F, 0F, 0F);
|
setRotation(backBotSiding, 0F, 0F, 0F);
|
||||||
backBotSiding = new ModelRenderer(this, 7, 8);
|
topLeft = new ModelRenderer(this, 0, 0);
|
||||||
backBotSiding.addBox(-4F, 22F, 6F, 8, 2, 1);
|
topLeft.addBox(4F, 8F, 7F, 2, 2, 1);
|
||||||
backBotSiding.setRotationPoint(0F, 0F, 0F);
|
topLeft.setRotationPoint(0F, 0F, 0F);
|
||||||
backBotSiding.setTextureSize(128, 128);
|
topLeft.setTextureSize(128, 128);
|
||||||
backBotSiding.mirror = true;
|
topLeft.mirror = true;
|
||||||
setRotation(backBotSiding, 0F, 0F, 0F);
|
setRotation(topLeft, 0F, 0F, 0F);
|
||||||
topLeft = new ModelRenderer(this, 0, 0);
|
topRight = new ModelRenderer(this, 0, 0);
|
||||||
topLeft.addBox(4F, 8F, 6F, 2, 2, 1);
|
topRight.addBox(-6F, 8F, 7F, 2, 2, 1);
|
||||||
topLeft.setRotationPoint(0F, 0F, 0F);
|
topRight.setRotationPoint(0F, 0F, 0F);
|
||||||
topLeft.setTextureSize(128, 128);
|
topRight.setTextureSize(128, 128);
|
||||||
topLeft.mirror = true;
|
topRight.mirror = true;
|
||||||
setRotation(topLeft, 0F, 0F, 0F);
|
setRotation(topRight, 0F, 0F, 0F);
|
||||||
topRight = new ModelRenderer(this, 0, 0);
|
botRight = new ModelRenderer(this, 0, 0);
|
||||||
topRight.addBox(-6F, 8F, 6F, 2, 2, 1);
|
botRight.addBox(-6F, 22F, 7F, 2, 2, 1);
|
||||||
topRight.setRotationPoint(0F, 0F, 0F);
|
botRight.setRotationPoint(0F, 0F, 0F);
|
||||||
topRight.setTextureSize(128, 128);
|
botRight.setTextureSize(128, 128);
|
||||||
topRight.mirror = true;
|
botRight.mirror = true;
|
||||||
setRotation(topRight, 0F, 0F, 0F);
|
setRotation(botRight, 0F, 0F, 0F);
|
||||||
botRight = new ModelRenderer(this, 0, 0);
|
botLeft = new ModelRenderer(this, 0, 0);
|
||||||
botRight.addBox(-6F, 22F, 6F, 2, 2, 1);
|
botLeft.addBox(4F, 22F, 7F, 2, 2, 1);
|
||||||
botRight.setRotationPoint(0F, 0F, 0F);
|
botLeft.setRotationPoint(0F, 0F, 0F);
|
||||||
botRight.setTextureSize(128, 128);
|
botLeft.setTextureSize(128, 128);
|
||||||
botRight.mirror = true;
|
botLeft.mirror = true;
|
||||||
setRotation(botRight, 0F, 0F, 0F);
|
setRotation(botLeft, 0F, 0F, 0F);
|
||||||
botLeft = new ModelRenderer(this, 0, 0);
|
botRightOut = new ModelRenderer(this, 0, 0);
|
||||||
botLeft.addBox(4F, 22F, 6F, 2, 2, 1);
|
botRightOut.addBox(-7F, 22F, 7F, 2, 2, 1);
|
||||||
botLeft.setRotationPoint(0F, 0F, 0F);
|
botRightOut.setRotationPoint(0F, 0F, 0F);
|
||||||
botLeft.setTextureSize(128, 128);
|
botRightOut.setTextureSize(128, 128);
|
||||||
botLeft.mirror = true;
|
botRightOut.mirror = true;
|
||||||
setRotation(botLeft, 0F, 0F, 0F);
|
setRotation(botRightOut, 0F, 0F, 0F);
|
||||||
botRightOut = new ModelRenderer(this, 0, 0);
|
botLeftOut = new ModelRenderer(this, 0, 0);
|
||||||
botRightOut.addBox(-8F, 22F, 6F, 2, 2, 1);
|
botLeftOut.addBox(5F, 22F, 7F, 2, 2, 1);
|
||||||
botRightOut.setRotationPoint(0F, 0F, 0F);
|
botLeftOut.setRotationPoint(0F, 0F, 0F);
|
||||||
botRightOut.setTextureSize(128, 128);
|
botLeftOut.setTextureSize(128, 128);
|
||||||
botRightOut.mirror = true;
|
botLeftOut.mirror = true;
|
||||||
setRotation(botRightOut, 0F, 0F, 0F);
|
setRotation(botLeftOut, 0F, 0F, 0F);
|
||||||
botLeftOut = new ModelRenderer(this, 0, 0);
|
topRightOut = new ModelRenderer(this, 0, 0);
|
||||||
botLeftOut.addBox(6F, 22F, 6F, 2, 2, 1);
|
topRightOut.addBox(-7F, 8F, 7F, 2, 2, 1);
|
||||||
botLeftOut.setRotationPoint(0F, 0F, 0F);
|
topRightOut.setRotationPoint(0F, 0F, 0F);
|
||||||
botLeftOut.setTextureSize(128, 128);
|
topRightOut.setTextureSize(128, 128);
|
||||||
botLeftOut.mirror = true;
|
topRightOut.mirror = true;
|
||||||
setRotation(botLeftOut, 0F, 0F, 0F);
|
setRotation(topRightOut, 0F, 0F, 0F);
|
||||||
topRightOut = new ModelRenderer(this, 0, 0);
|
topLeftOut = new ModelRenderer(this, 0, 0);
|
||||||
topRightOut.addBox(-8F, 8F, 6F, 2, 2, 1);
|
topLeftOut.addBox(5F, 8F, 7F, 2, 2, 1);
|
||||||
topRightOut.setRotationPoint(0F, 0F, 0F);
|
topLeftOut.setRotationPoint(0F, 0F, 0F);
|
||||||
topRightOut.setTextureSize(128, 128);
|
topLeftOut.setTextureSize(128, 128);
|
||||||
topRightOut.mirror = true;
|
topLeftOut.mirror = true;
|
||||||
setRotation(topRightOut, 0F, 0F, 0F);
|
setRotation(topLeftOut, 0F, 0F, 0F);
|
||||||
topLeftOut = new ModelRenderer(this, 0, 0);
|
|
||||||
topLeftOut.addBox(6F, 8F, 6F, 2, 2, 1);
|
|
||||||
topLeftOut.setRotationPoint(0F, 0F, 0F);
|
|
||||||
topLeftOut.setTextureSize(128, 128);
|
|
||||||
topLeftOut.mirror = true;
|
|
||||||
setRotation(topLeftOut, 0F, 0F, 0F);
|
|
||||||
tankBackRight = new ModelRenderer(this, 49, 43);
|
|
||||||
tankBackRight.addBox(-8F, 8F, 5F, 2, 16, 1);
|
|
||||||
tankBackRight.setRotationPoint(0F, 0F, 0F);
|
|
||||||
tankBackRight.setTextureSize(128, 128);
|
|
||||||
tankBackRight.mirror = true;
|
|
||||||
setRotation(tankBackRight, 0F, 0F, 0F);
|
|
||||||
tankBackLeft = new ModelRenderer(this, 12, 43);
|
|
||||||
tankBackLeft.addBox(6F, 8F, 5F, 2, 16, 1);
|
|
||||||
tankBackLeft.setRotationPoint(0F, 0F, 0F);
|
|
||||||
tankBackLeft.setTextureSize(128, 128);
|
|
||||||
tankBackLeft.mirror = true;
|
|
||||||
setRotation(tankBackLeft, 0F, 0F, 0F);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(float f5, boolean left, boolean right, boolean bot, boolean top)
|
public void render(float f5, boolean left, boolean right, boolean bot, boolean top)
|
||||||
{
|
{
|
||||||
tankBack.render(f5);
|
//tankBack.render(f5);
|
||||||
if (!top)
|
if (!top)
|
||||||
{
|
{
|
||||||
backTopSiding.render(f5);
|
backTopSiding.render(f5);
|
||||||
|
@ -155,7 +134,7 @@ public class ModelTankSide extends ModelBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tankBackRight.render(f5);
|
//tankBackRight.render(f5);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!left)
|
if (!left)
|
||||||
|
@ -164,7 +143,7 @@ public class ModelTankSide extends ModelBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tankBackLeft.render(f5);
|
//tankBackLeft.render(f5);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,26 +32,14 @@ public class RenderTank extends TileEntitySpecialRenderer
|
||||||
LiquidStack liquid = tank.getLiquid();
|
LiquidStack liquid = tank.getLiquid();
|
||||||
|
|
||||||
ColorCode color = tileEntityTank.getColor();
|
ColorCode color = tileEntityTank.getColor();
|
||||||
|
boolean lre = false;
|
||||||
GL11.glPushMatrix();
|
|
||||||
bindTextureByName(FluidMech.MODEL_TEXTURE_DIRECTORY + "TankSide.png");
|
|
||||||
|
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 5F);
|
|
||||||
GL11.glScalef(1.0F, -1F, -1F);
|
|
||||||
model.render(0.0625F, false, false, false, false);
|
|
||||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
|
||||||
model.render(0.0625F, false, false, false, false);
|
|
||||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
|
||||||
model.render(0.0625F, false, false, false, false);
|
|
||||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
|
||||||
model.render(0.0625F, false, false, false, false);
|
|
||||||
|
|
||||||
if (liquid != null && liquid.amount > 0)
|
if (liquid != null && liquid.amount > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
int[] displayList = LiquidRenderer.getLiquidDisplayLists(liquid, tileEntity.worldObj, false);
|
int[] displayList = LiquidRenderer.getLiquidDisplayLists(liquid, tileEntity.worldObj, false);
|
||||||
if (displayList != null)
|
if (displayList != null)
|
||||||
{
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
@ -59,15 +47,29 @@ public class RenderTank extends TileEntitySpecialRenderer
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
bindTextureByName(LiquidRenderer.getLiquidSheet(liquid));
|
bindTextureByName(LiquidRenderer.getLiquidSheet(liquid));
|
||||||
|
|
||||||
// GL11.glTranslatef((float) -0.475F, (float) -1.5F, (float) -0.475F);
|
GL11.glTranslatef((float) x + 0.025F, (float) y, (float) z + 0.025F);
|
||||||
GL11.glScalef(0.6F, 0.999F, 0.6F);
|
GL11.glScalef(0.87F, 0.999F, 0.87F);
|
||||||
|
|
||||||
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.getCapacity()) * (LiquidRenderer.DISPLAY_STAGES - 1))]);
|
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.getCapacity()) * (LiquidRenderer.DISPLAY_STAGES - 1))]);
|
||||||
|
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
lre = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bindTextureByName(FluidMech.MODEL_TEXTURE_DIRECTORY + "TankSide.png");
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||||
|
GL11.glScalef(1.0F, -1F, -1F);
|
||||||
|
|
||||||
|
model.render(0.0625F, false, false, false, false);
|
||||||
|
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||||
|
model.render(0.0625F, false, false, false, false);
|
||||||
|
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||||
|
model.render(0.0625F, false, false, false, false);
|
||||||
|
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||||
|
model.render(0.0625F, false, false, false, false);
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class TileEntityTank extends TileEntityFluidDevice implements ITankContai
|
||||||
int[] previousConnections = this.renderConnection.clone();
|
int[] previousConnections = this.renderConnection.clone();
|
||||||
this.connectedBlocks = new TileEntity[6];
|
this.connectedBlocks = new TileEntity[6];
|
||||||
|
|
||||||
for (int i = 2; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||||
this.validateConnectionSide(this.worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ), dir);
|
this.validateConnectionSide(this.worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ), dir);
|
||||||
|
|
Loading…
Reference in a new issue