package hmggirlfront.render.tile;


import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import hmggirlfront.block.tile.TileEntity_Spawn;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import objmodel.AdvancedModelLoader;
import objmodel.IModelCustom;

@SideOnly(Side.CLIENT)
public class TileRender_Spawn extends TileEntitySpecialRenderer<TileEntity_Spawn>
{
    private static final ResourceLocation box = new ResourceLocation("hmggirlfront:textures/blocks/model/spanwer_machine.png");
    private static final IModelCustom box_model = AdvancedModelLoader.loadModel(
    		new ResourceLocation("hmggirlfront:textures/blocks/model/spanwer_machine.mqo"));
    
    private static final ResourceLocation ibc01 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc01.png");
    private static final ResourceLocation ibc04 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc04.png");
    private static final ResourceLocation ibc05 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc05.png");
    private static final ResourceLocation ibc06 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc06.png");
    private static final ResourceLocation ibc07 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc07.png");
    private static final ResourceLocation ibc13 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc13.png");
    private static final ResourceLocation ibc14 = new ResourceLocation("hmggirlfront:textures/items/spawn/ibc14.png");
    
    private ResourceLocation texture;
    private boolean field_147509_j;
    private static final String __OBFID = "CL_00000965";

    public TileRender_Spawn()
    {
    }

    public void render(TileEntity_Spawn tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha)
    {
    	Minecraft minecraft = Minecraft.getMinecraft();
    	
        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glTranslatef((float)x + 0.5F, (float)y + 0F, (float)z + 0.5F);
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
        this.bindTexture(box);
        box_model.renderPart("mat1");
        GL11.glTranslatef(0F, 1.1F, 0F);
        GL11.glRotatef(minecraft.world.getWorldTime(), 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0F, -1.1F, -0F);
        if(tile.id == 1) {
        	this.bindTexture(ibc01);
        }else if(tile.id == 4) {
        	this.bindTexture(ibc04);
        }else if(tile.id == 5) {
        	this.bindTexture(ibc05);
        }else if(tile.id == 6) {
        	this.bindTexture(ibc06);
        }else if(tile.id == 7) {
        	this.bindTexture(ibc07);
        }else if(tile.id == 13) {
        	this.bindTexture(ibc13);
        }else if(tile.id == 14) {
        	this.bindTexture(ibc14);
        }
        box_model.renderPart("mat2");
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        
    }
}