resonant-induction/minecraft/liquidmechanics/client/render/RenderPipe.java
Rseifert 183dc35c47 more Changes
*added Name to the color Enum
*added a new liquid call Waste liquid
*added effect for mixing liquids in pipes
*stored+filling=outcome
*lava+water = obby
*water+lava=cobble
*other+other=waste liquid
*Improve pipe render and create 14 new pipe textures
*Improved Tank render and creates some new textures
*Fixed lang file for all Blocks, items still don't work
*Fixed save issue using Compent Tags to save liquids
*Fixed Universal Pipe working with pumps
*Removed: Some crafting recipes plus fixed others
*Removed: Item version of pipe,tank, though a similar version is used
just for naming as a BlockItem
*Bug: Tanks don't work at all
2013-01-06 00:13:09 -05:00

67 lines
No EOL
2 KiB
Java

package liquidmechanics.client.render;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.client.model.ModelLargePipe;
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 ModelLargePipe SixPipe;
private TileEntity[] ents = new TileEntity[6];
public RenderPipe()
{
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);
int meta = 0;
if (te instanceof TileEntityPipe)
{
meta = te.getBlockMetadata();
ents = ((TileEntityPipe) te).connectedBlocks;
}
this.render(meta, ents);
GL11.glPopMatrix();
}
public static String getPipeTexture(int meta)
{
return LiquidMechanics.RESOURCE_PATH + "pipes/"+PipeColor.get(meta).getName()+"Pipe.png";
}
public void render(int meta, TileEntity[] ents)
{
bindTextureByName(this.getPipeTexture(meta));
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);
}
}