package com.projectreddog.machinemod.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.projectreddog.machinemod.model.tileentity.ModelLiquidPipe;
import com.projectreddog.machinemod.reference.Reference;
import com.projectreddog.machinemod.tileentities.TileEntityLiquidPipe;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class TileEntityLiquidPipeRenderer extends TileEntitySpecialRenderer {
private ModelLiquidPipe teModel = new ModelLiquidPipe();
private static ResourceLocation resourceLocation;
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f, int i) {
Tessellator tessellator = Tessellator.getInstance();
// Minecraft.getMinecraft().entityRenderer.enableLightMap() and
// .disableLightMap(),
GL11.glPushMatrix();
// GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslated(x + .5d, y + .5d, z + .5d);
// GL11.glEnable(GL11.GL_DEPTH_TEST);
// GL11.glEnableClientState(GL11.GL_LIGHTING);
if (Reference.enableDebugPipeCode) {
if (tileentity instanceof TileEntityLiquidPipe) {
TileEntityLiquidPipe te = (TileEntityLiquidPipe) tileentity;
GlStateManager.color(((float) te.getFluidAmount() / te.getCapacity()), 0F, 0.0F, 1.0F);
}
}
this.bindTexture(getResourceLocation());
// GL11.glScalef(-.5F, -.5F, .5F);
this.teModel.render(tileentity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
// ((ModelTractor) this.modelTractor).renderGroupObject("Plow_Cube");
// GL11.glDisableClientState(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
public static ResourceLocation getResourceLocation() {
if (resourceLocation == null) {
resourceLocation = new ResourceLocation("machinemod", Reference.MODEL_PIPE_TEXTURE_LOCATION);
}
return resourceLocation;
}
}