resonant-induction/minecraft/liquidmechanics/client/render/RenderPipe.java
Rseifert a1ed4a5a4d BugFix: Fixed Tanks to drain correctly
Though it was the release valve but it turns out the Storage tanks
needed coding to drain themselves after giving the release valve the
liquid ammount present.

Other than that the rest of the changes are just renaming from past push
2013-01-03 07:34:57 -05:00

86 lines
No EOL
2.2 KiB
Java

package liquidmechanics.client.render;
import liquidmechanics.api.helpers.Liquid;
import liquidmechanics.client.model.ModelLargePipe;
import liquidmechanics.client.model.ModelPipe;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.tileentity.TileEntityPipe;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
public class RenderPipe extends TileEntitySpecialRenderer
{
private Liquid type = Liquid.DEFUALT;
private ModelPipe fourPipe;
private ModelLargePipe SixPipe;
private TileEntity[] ents = new TileEntity[6];
public RenderPipe()
{
fourPipe = new ModelPipe();
SixPipe = new ModelLargePipe();
}
public void renderAModelAt(TileEntity te, double d, double d1, double d2, float f)
{
// Texture file
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if (te instanceof TileEntityPipe)
{
type = ((TileEntityPipe) te).getType();
ents = ((TileEntityPipe) te).connectedBlocks;
}
this.render(type, ents);
GL11.glPopMatrix();
}
public void render(Liquid type, TileEntity[] ents)
{
switch (type.ordinal())
{
case 0:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixSteamPipe.png");
break;
case 1:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixWaterPipe.png");
break;
case 2:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixLavaPipe.png");
break;
case 3:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixOilPipe.png");
break;
default:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/DefaultPipe.png");
break;
}
if (ents[0] != null)
SixPipe.renderBottom();
if (ents[1] != null)
SixPipe.renderTop();
if (ents[3] != null)
SixPipe.renderFront();
if (ents[2] != null)
SixPipe.renderBack();
if (ents[5] != null)
SixPipe.renderRight();
if (ents[4] != null)
SixPipe.renderLeft();
SixPipe.renderMiddle();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityPipe) tileEntity, var2, var4, var6, var8);
}
}