resonant-induction/minecraft/liquidmechanics/client/render/RenderPump.java
Rseifert a3c43609ea Got rid of Enum system
What i have is not much diffrent but its a start to allowing more liquid
types without having to add them myself. The current method has 3
defualt liquids that are preset. The new system also uses String names
to ID liquid instead of Enums. A new class Called LiquidData will keep
track of the data need to ID, and use the Liquids.

In the process i also fixed a few crafting recipes that were
removed/messed up in a patch a while back.

Plan for new system
*Have default liquid type that come with textures/renders
*Have several univeral pipes that can accept all Liquid types
*Have a way of placeing a universal pipe and then converting to a
regulated pipe, pipe that only take one liquid type
*Have a tool for doing the above
*Change the release Valve to be univeral with a GUI to restrict flow and
Liquid type extracted
2013-01-03 12:18:47 -05:00

76 lines
No EOL
2 KiB
Java

package liquidmechanics.client.render;
import liquidmechanics.client.model.ModelPump;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityPump;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
public class RenderPump extends TileEntitySpecialRenderer
{
int type = 0;
private ModelPump model;
public RenderPump()
{
model = new ModelPump();
}
public void renderAModelAt(TileEntityPump tileEntity, double d, double d1, double d2, float f)
{
LiquidData type = tileEntity.type;
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
switch (LiquidHandler.getMeta(type))
{
default:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png");
break;
case 1:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png");
break;// water
case 2:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/LavaPump.png");
break;// lava
case 3:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/OilPump.png");
break;// oil
// case 4://fuel
}
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
switch (meta)
{
case 1:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 2:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 0:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
}
model.renderMain(0.0625F);
model.renderC1(0.0625F);
model.renderC2(0.0625F);
model.renderC3(0.0625F);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityPump) tileEntity, var2, var4, var6, var8);
}
}