2013-01-02 19:55:29 +01:00
|
|
|
package liquidmechanics.client.render;
|
|
|
|
|
2013-01-07 17:37:13 +01:00
|
|
|
import liquidmechanics.api.helpers.ColorCode;
|
2013-01-02 19:55:29 +01:00
|
|
|
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
|
|
|
|
{
|
2013-01-03 18:18:47 +01:00
|
|
|
private ModelLargePipe SixPipe;
|
|
|
|
private TileEntity[] ents = new TileEntity[6];
|
2013-01-02 19:55:29 +01:00
|
|
|
|
2013-01-03 18:18:47 +01:00
|
|
|
public RenderPipe()
|
|
|
|
{
|
|
|
|
SixPipe = new ModelLargePipe();
|
|
|
|
}
|
2013-01-02 19:55:29 +01:00
|
|
|
|
2013-01-03 18:18:47 +01:00
|
|
|
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);
|
2013-01-05 21:05:53 +01:00
|
|
|
int meta = 0;
|
2013-01-03 18:18:47 +01:00
|
|
|
if (te instanceof TileEntityPipe)
|
|
|
|
{
|
2013-01-05 21:05:53 +01:00
|
|
|
meta = te.getBlockMetadata();
|
2013-01-03 18:18:47 +01:00
|
|
|
ents = ((TileEntityPipe) te).connectedBlocks;
|
|
|
|
}
|
2013-01-05 21:05:53 +01:00
|
|
|
this.render(meta, ents);
|
2013-01-03 18:18:47 +01:00
|
|
|
GL11.glPopMatrix();
|
2013-01-02 19:55:29 +01:00
|
|
|
|
2013-01-03 18:18:47 +01:00
|
|
|
}
|
2013-01-05 21:05:53 +01:00
|
|
|
public static String getPipeTexture(int meta)
|
2013-01-03 18:18:47 +01:00
|
|
|
{
|
2013-01-07 17:37:13 +01:00
|
|
|
return LiquidMechanics.RESOURCE_PATH + "pipes/"+ColorCode.get(meta).getName()+"Pipe.png";
|
2013-01-05 21:05:53 +01:00
|
|
|
}
|
|
|
|
public void render(int meta, TileEntity[] ents)
|
|
|
|
{
|
|
|
|
bindTextureByName(this.getPipeTexture(meta));
|
2013-01-03 18:18:47 +01:00
|
|
|
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();
|
2013-01-02 19:55:29 +01:00
|
|
|
|
2013-01-03 18:18:47 +01:00
|
|
|
}
|
2013-01-02 19:55:29 +01:00
|
|
|
|
2013-01-03 18:18:47 +01:00
|
|
|
@Override
|
|
|
|
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
|
|
|
{
|
|
|
|
this.renderAModelAt((TileEntityPipe) tileEntity, var2, var4, var6, var8);
|
|
|
|
}
|
2013-01-02 19:55:29 +01:00
|
|
|
|
|
|
|
}
|