package com.harry9137.ct.client.renderer;
import com.harry9137.ct.client.model.*;
import com.harry9137.ct.init.modBlocks;
import com.harry9137.ct.reference.reference;
import com.harry9137.ct.tileentity.TileEntityWire;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
public class WireRender extends TileEntitySpecialRenderer {
public ModelWire wireModel = new ModelWire();
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float p_180535_8_, int p_180535_9_) {
GL11.glPushMatrix();
GL11.glTranslatef((float)d, (float)d1, (float)d2);
TileEntityWire tileEntityWire = (TileEntityWire)tileEntity;
renderBlockWire(tileEntityWire, tileEntity.getWorld(), tileEntity.getPos(), modBlocks.blockWireInstance);
GL11.glPopMatrix();
}
public void renderBlockWire(TileEntityWire tileEntityWire, World world, BlockPos pos, Block block) {
Tessellator tessellator = Tessellator.getInstance();
float f = block.getLightValue(world, pos);
float l = world.getLightBrightness(pos);
float l1 = l % 65536;
float l2 = l / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) l1, (float) l2);
GL11.glPushMatrix();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glRotatef(0.50F, 0F, 1F, 0F);
GL11.glTranslatef(0.0F, -0.53125F, 0F);
bindTexture(new ResourceLocation(reference.CUSTOM_RENDER_PATH + "/NewWire.png"));
wireModel.render(null, 0.0F, 0.0F, -0.0F, 0.0F, 0.0F, 0.0625F, tileEntityWire.Directions);
GL11.glPopMatrix();
}
}