resonant-induction/minecraft/liquidmechanics/client/render/RenderPump.java
Rseifert 1e5c47ad3f nothing much
Moved some stuff around, and made LiquidHandler able to be used in the
api folder to help other people work with this mod. The api is not
actual needed to work with this mod but it contains helpers to make life
easier.

Also added a method to LiquidHandler to get the name of a LiquidStack
which for some reason can't be directly gotten from the liquidStack
itself. Too get it i had to iterate over the hashMap used to store
liquids. If the LiquidStack is linked to a LiquidData it will use the
LiquidData name first.

Also removed PipeInstance since its not actual needed anymore now that
PipeColor is directly linked the pipe as well as the PipeBlock metadata.
2013-01-06 23:15:21 -05:00

76 lines
No EOL
2 KiB
Java

package liquidmechanics.client.render;
import liquidmechanics.api.helpers.LiquidData;
import liquidmechanics.api.helpers.LiquidHandler;
import liquidmechanics.client.model.ModelPump;
import liquidmechanics.common.LiquidMechanics;
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);
}
}