Working on new tank render

This commit is contained in:
Robert Seifert 2013-06-03 07:09:55 -04:00
parent ad231f03a5
commit 097e46a43e
34 changed files with 238 additions and 143 deletions

View file

@ -2,5 +2,5 @@ dir.development=./
dir.mcp=${dir.development}forge/mcp
version.minecraft=1.5.2
version.mod.major=0
version.mod.minor=4
version.mod.revis=3
version.mod.minor=5
version.mod.revis=1

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,003 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,003 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

View file

@ -30,7 +30,7 @@ public class ClientProxy extends CommonProxy
@Override
public void preInit()
{
}
@Override
@ -41,15 +41,15 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStarterPump.class, new RenderPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGenerator.class, new RenderGenerator());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReleaseValve.class, new RenderReleaseValve());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySink.class, new RenderSink());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConstructionPump.class, new RenderConstructionPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
MinecraftForgeClient.registerItemRenderer(FluidMech.blockPipe.blockID, new ItemRenderHelper());
MinecraftForgeClient.registerItemRenderer(FluidMech.blockGenPipe.blockID, new ItemRenderHelper());
MinecraftForgeClient.registerItemRenderer(FluidMech.blockReleaseValve.blockID, new ItemRenderHelper());
RenderingRegistry.registerBlockHandler(new BlockRenderHelper());
}

View file

@ -0,0 +1,179 @@
// Date: 6/3/2013 6:47:54 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelTankSide extends ModelBase
{
// fields
ModelRenderer tankBack;
ModelRenderer backRightSiding;
ModelRenderer backLeftSiding;
ModelRenderer backTopSiding;
ModelRenderer backBotSiding;
ModelRenderer topLeft;
ModelRenderer topRight;
ModelRenderer botRight;
ModelRenderer botLeft;
ModelRenderer botRightOut;
ModelRenderer botLeftOut;
ModelRenderer topRightOut;
ModelRenderer topLeftOut;
ModelRenderer tankBackRight;
ModelRenderer tankBackLeft;
public ModelTankSide()
{
textureWidth = 128;
textureHeight = 128;
tankBack = new ModelRenderer(this, 21, 43);
tankBack.addBox(-6F, 8F, 5F, 12, 16, 1);
tankBack.setRotationPoint(0F, 0F, 0F);
tankBack.setTextureSize(128, 128);
tankBack.mirror = true;
setRotation(tankBack, 0F, 0F, 0F);
backRightSiding = new ModelRenderer(this, 0, 19);
backRightSiding.addBox(-6F, 10F, 6F, 2, 12, 1);
backRightSiding.setRotationPoint(0F, 0F, 0F);
backRightSiding.setTextureSize(128, 128);
backRightSiding.mirror = true;
setRotation(backRightSiding, 0F, 0F, 0F);
backLeftSiding = new ModelRenderer(this, 0, 19);
backLeftSiding.addBox(4F, 10F, 6F, 2, 12, 1);
backLeftSiding.setRotationPoint(0F, 0F, 0F);
backLeftSiding.setTextureSize(128, 128);
backLeftSiding.mirror = true;
setRotation(backLeftSiding, 0F, 0F, 0F);
backTopSiding = new ModelRenderer(this, 7, 8);
backTopSiding.addBox(-4F, 8F, 6F, 8, 2, 1);
backTopSiding.setRotationPoint(0F, 0F, 0F);
backTopSiding.setTextureSize(128, 128);
backTopSiding.mirror = true;
setRotation(backTopSiding, 0F, 0F, 0F);
backBotSiding = new ModelRenderer(this, 7, 8);
backBotSiding.addBox(-4F, 22F, 6F, 8, 2, 1);
backBotSiding.setRotationPoint(0F, 0F, 0F);
backBotSiding.setTextureSize(128, 128);
backBotSiding.mirror = true;
setRotation(backBotSiding, 0F, 0F, 0F);
topLeft = new ModelRenderer(this, 0, 0);
topLeft.addBox(4F, 8F, 6F, 2, 2, 1);
topLeft.setRotationPoint(0F, 0F, 0F);
topLeft.setTextureSize(128, 128);
topLeft.mirror = true;
setRotation(topLeft, 0F, 0F, 0F);
topRight = new ModelRenderer(this, 0, 0);
topRight.addBox(-6F, 8F, 6F, 2, 2, 1);
topRight.setRotationPoint(0F, 0F, 0F);
topRight.setTextureSize(128, 128);
topRight.mirror = true;
setRotation(topRight, 0F, 0F, 0F);
botRight = new ModelRenderer(this, 0, 0);
botRight.addBox(-6F, 22F, 6F, 2, 2, 1);
botRight.setRotationPoint(0F, 0F, 0F);
botRight.setTextureSize(128, 128);
botRight.mirror = true;
setRotation(botRight, 0F, 0F, 0F);
botLeft = new ModelRenderer(this, 0, 0);
botLeft.addBox(4F, 22F, 6F, 2, 2, 1);
botLeft.setRotationPoint(0F, 0F, 0F);
botLeft.setTextureSize(128, 128);
botLeft.mirror = true;
setRotation(botLeft, 0F, 0F, 0F);
botRightOut = new ModelRenderer(this, 0, 0);
botRightOut.addBox(-8F, 22F, 6F, 2, 2, 1);
botRightOut.setRotationPoint(0F, 0F, 0F);
botRightOut.setTextureSize(128, 128);
botRightOut.mirror = true;
setRotation(botRightOut, 0F, 0F, 0F);
botLeftOut = new ModelRenderer(this, 0, 0);
botLeftOut.addBox(6F, 22F, 6F, 2, 2, 1);
botLeftOut.setRotationPoint(0F, 0F, 0F);
botLeftOut.setTextureSize(128, 128);
botLeftOut.mirror = true;
setRotation(botLeftOut, 0F, 0F, 0F);
topRightOut = new ModelRenderer(this, 0, 0);
topRightOut.addBox(-8F, 8F, 6F, 2, 2, 1);
topRightOut.setRotationPoint(0F, 0F, 0F);
topRightOut.setTextureSize(128, 128);
topRightOut.mirror = true;
setRotation(topRightOut, 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)
{
tankBack.render(f5);
if (!top)
{
backTopSiding.render(f5);
topLeft.render(f5);
topRight.render(f5);
topRightOut.render(f5);
topLeftOut.render(f5);
}
if (!bot)
{
backBotSiding.render(f5);
botRight.render(f5);
botLeft.render(f5);
botRightOut.render(f5);
botLeftOut.render(f5);
}
if (!right)
{
backRightSiding.render(f5);
if (top)
{
topRight.render(f5);
}
}
else
{
tankBackRight.render(f5);
}
if (!left)
{
backLeftSiding.render(f5);
}
else
{
tankBackLeft.render(f5);
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -56,14 +56,7 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
}
if (block.blockID == FluidMech.blockTank.blockID)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.0F, (float) 1.0F, (float) 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderTank.getTankTexture(metadata)));
tank.renderMain(0.0625F);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderTank.getGuageTexture(metadata,4)));
tank.renderMeter(null, 0.0565F);
GL11.glPopMatrix();
}
if (block.blockID == FluidMech.blockRod.blockID)
{

View file

@ -1,152 +1,75 @@
package dark.fluid.client.render;
import hydraulic.api.ColorCode;
import hydraulic.helpers.LiquidRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
import dark.fluid.client.model.ModelLiquidTank;
import dark.fluid.client.model.ModelLiquidTankCorner;
import dark.fluid.client.model.ModelTankSide;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.TileEntityTank;
import dark.library.helpers.ConnectionHelper;
public class RenderTank extends TileEntitySpecialRenderer
{
private ModelLiquidTank model;
private ModelLiquidTankCorner modelC;
private ModelTankSide model;
public RenderTank()
{
model = new ModelLiquidTank();
modelC = new ModelLiquidTankCorner();
}
public void renderAModelAt(TileEntityTank te, double d, double d1, double d2, float f)
{
int meta = te.getBlockMetadata();
int guageMeta = meta;
LiquidStack stack = te.getTank().getLiquid();
int pos = 0;
if (stack != null)
{
pos = Math.min(((stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) / 2), 4);
if (meta == ColorCode.NONE.ordinal())
{
guageMeta = ColorCode.get(stack).ordinal();
}
}
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if (ConnectionHelper.corner(te) > 0)
{
bindTextureByName(this.getCornerTexture(meta));
int corner = ConnectionHelper.corner(te);
switch (corner)
{
case 2:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 4:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 1:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
}
modelC.render(0.0625F);
}
else
{
bindTextureByName(this.getTankTexture(meta));
model.renderMain(0.0625F);
bindTextureByName(this.getGuageTexture(guageMeta, pos));
model.renderMeter(te, 0.0625F);
}
GL11.glPopMatrix();
}
public static String getTankTexture(int meta)
{
String type = "";
switch (ColorCode.get(meta))
{
case RED:
type = "Lava";
break;
case BLUE:
type = "Water";
break;
case WHITE:
type = "Milk";
break;
case ORANGE:
type = "Steam";
break;
default:
type = "";
break;
}
return FluidMech.MODEL_TEXTURE_DIRECTORY + "tanks/" + type + "Tank.png";
}
public static String getGuageTexture(int meta, int pos)
{
String type = "";
switch (ColorCode.get(meta))
{
case RED:
type = "Lava";
break;
case YELLOW:
type = "Fuel";
break;
default:
type = "";
break;
}
return FluidMech.MODEL_TEXTURE_DIRECTORY + "tanks/guage/" + pos + type + ".png";
}
public static String getCornerTexture(int meta)
{
String type = "";
switch (ColorCode.get(meta))
{
case RED:
type = "Lava";
break;
case BLUE:
type = "Water";
break;
case WHITE:
type = "Milk";
break;
default:
type = "";
break;
}
return FluidMech.MODEL_TEXTURE_DIRECTORY + "tanks/Corner" + type + ".png";
model = new ModelTankSide();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
{
this.renderAModelAt((TileEntityTank) tileEntity, var2, var4, var6, var8);
}
if (tileEntity instanceof TileEntityTank)
{
TileEntityTank tileEntityTank = ((TileEntityTank) tileEntity);
ILiquidTank tank = tileEntityTank.getTank();
LiquidStack liquid = tank.getLiquid();
ColorCode color = tileEntityTank.getColor();
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)
{
int[] displayList = LiquidRenderer.getLiquidDisplayLists(liquid, tileEntity.worldObj, false);
if (displayList != null)
{
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bindTextureByName(LiquidRenderer.getLiquidSheet(liquid));
// GL11.glTranslatef((float) -0.475F, (float) -1.5F, (float) -0.475F);
GL11.glScalef(0.6F, 0.999F, 0.6F);
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.getCapacity()) * (LiquidRenderer.DISPLAY_STAGES - 1))]);
GL11.glPopAttrib();
}
}
GL11.glPopMatrix();
}
}
}