Mekanism-tilera-Edition/common/mekanism/generators/client/RenderElectrolyticSeparator.java
2013-07-20 12:10:14 -04:00

46 lines
1.7 KiB
Java

package mekanism.generators.client;
import mekanism.api.EnumGas;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.generators.common.TileEntityElectrolyticSeparator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderElectrolyticSeparator extends TileEntitySpecialRenderer
{
private ModelElectrolyticSeparator model = new ModelElectrolyticSeparator();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
renderAModelAt((TileEntityElectrolyticSeparator)tileEntity, x, y, z, partialTick);
}
private void renderAModelAt(TileEntityElectrolyticSeparator tileEntity, double x, double y, double z, float partialTick)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, tileEntity.outputType == EnumGas.HYDROGEN ? "ElectrolyticSeparatorHydrogen.png" :
(tileEntity.outputType == EnumGas.OXYGEN ? "ElectrolyticSeparatorOxygen.png" : "ElectrolyticSeparatorNone.png")));
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
}
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
model.render(0.0625F);
GL11.glPopMatrix();
}
}