2013-02-22 04:03:54 +01:00
|
|
|
package mekanism.client;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
2013-02-22 04:03:54 +01:00
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
|
|
|
|
2013-03-11 18:49:01 +01:00
|
|
|
import mekanism.api.GasTransmission;
|
2013-02-22 04:03:54 +01:00
|
|
|
import mekanism.api.ITubeConnection;
|
|
|
|
import mekanism.common.TileEntityPressurizedTube;
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-02-22 04:03:54 +01:00
|
|
|
public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
|
|
|
{
|
2013-04-18 04:40:11 +02:00
|
|
|
private ModelTransmitter model = new ModelTransmitter();
|
2013-04-13 02:25:21 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
|
|
|
{
|
|
|
|
renderAModelAt((TileEntityPressurizedTube)tileEntity, x, y, z, partialTick);
|
|
|
|
}
|
2013-02-22 04:03:54 +01:00
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
public void renderAModelAt(TileEntityPressurizedTube tileEntity, double x, double y, double z, float partialTick)
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
2013-03-18 17:23:57 +01:00
|
|
|
bindTextureByName("/mods/mekanism/render/PressurizedTube.png");
|
2013-02-22 04:03:54 +01:00
|
|
|
GL11.glPushMatrix();
|
2013-04-13 02:25:21 +02:00
|
|
|
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
|
2013-02-22 04:03:54 +01:00
|
|
|
GL11.glScalef(1.0F, -1F, -1F);
|
|
|
|
|
2013-03-11 18:49:01 +01:00
|
|
|
ITubeConnection[] connections = GasTransmission.getConnections(tileEntity);
|
2013-02-22 04:03:54 +01:00
|
|
|
|
|
|
|
for(ITubeConnection connection : connections)
|
|
|
|
{
|
2013-03-11 18:49:01 +01:00
|
|
|
if(connection != null)
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
|
|
|
int side = Arrays.asList(connections).indexOf(connection);
|
|
|
|
|
|
|
|
if(connection.canTubeConnect(ForgeDirection.getOrientation(side).getOpposite()))
|
|
|
|
{
|
|
|
|
model.renderSide(ForgeDirection.getOrientation(side));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
model.Center.render(0.0625F);
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
|
|
|
}
|