package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.

// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode 

import java.util.HashMap;
import java.util.Map;

import net.lax1dude.eaglercraft.EaglerAdapter;

public class TileEntityMobSpawnerRenderer extends TileEntitySpecialRenderer {

	public TileEntityMobSpawnerRenderer() {
		entityHashMap = new HashMap();
	}

	public void renderTileEntityMobSpawner(TileEntityMobSpawner tileentitymobspawner, double d, double d1, double d2,
			float f) {
		EaglerAdapter.glPushMatrix();
		EaglerAdapter.glTranslatef((float) d + 0.5F, (float) d1, (float) d2 + 0.5F);
		Entity entity = (Entity) entityHashMap.get(tileentitymobspawner.getMobID());
		if (entity == null) {
			entity = EntityList.createEntityInWorld(tileentitymobspawner.getMobID(), null);
			entityHashMap.put(tileentitymobspawner.getMobID(), entity);
		}
		if (entity != null) {
			entity.setWorld(tileentitymobspawner.worldObj);
			float f1 = 0.4375F;
			EaglerAdapter.glTranslatef(0.0F, 0.4F, 0.0F);
			EaglerAdapter.glRotatef(
					(float) (tileentitymobspawner.yaw2
							+ (tileentitymobspawner.yaw - tileentitymobspawner.yaw2) * (double) f) * 10F,
					0.0F, 1.0F, 0.0F);
			EaglerAdapter.glRotatef(-30F, 1.0F, 0.0F, 0.0F);
			EaglerAdapter.glTranslatef(0.0F, -0.4F, 0.0F);
			EaglerAdapter.glScalef(f1, f1, f1);
			entity.setLocationAndAngles(d, d1, d2, 0.0F, 0.0F);
			RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, f);
		}
		EaglerAdapter.glPopMatrix();
	}

	public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
		renderTileEntityMobSpawner((TileEntityMobSpawner) tileentity, d, d1, d2, f);
	}

	private Map entityHashMap;
}
