package net.minecraft.client.renderer.entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.model.ModelEnderman;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@SideOnly(Side.CLIENT)
public class RenderEnderman extends RenderLiving
{
private static final ResourceLocation endermanEyesTexture = new ResourceLocation("textures/entity/enderman/enderman_eyes.png");
private static final ResourceLocation endermanTextures = new ResourceLocation("textures/entity/enderman/enderman.png");
/** The model of the enderman */
private ModelEnderman endermanModel;
private Random rnd = new Random();
private static final String __OBFID = "CL_00000989";
public RenderEnderman()
{
super(new ModelEnderman(), 0.5F);
this.endermanModel = (ModelEnderman)super.mainModel;
this.setRenderPassModel(this.endermanModel);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityEnderman p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.endermanModel.isCarrying = p_76986_1_.getCarriedBlock().getMaterial() != Material.air;
this.endermanModel.isAttacking = p_76986_1_.isScreaming();
if (p_76986_1_.isScreaming())
{
double d3 = 0.02D;
p_76986_2_ += this.rnd.nextGaussian() * d3;
p_76986_6_ += this.rnd.nextGaussian() * d3;
}
super.doRender((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityEnderman p_110775_1_)
{
return endermanTextures;
}
protected void renderEquippedItems(EntityEnderman p_77029_1_, float p_77029_2_)
{
super.renderEquippedItems(p_77029_1_, p_77029_2_);
if (p_77029_1_.getCarriedBlock().getMaterial() != Material.air)
{
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
float f1 = 0.5F;
GL11.glTranslatef(0.0F, 0.6875F, -0.75F);
f1 *= 1.0F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f1, -f1, f1);
int i = p_77029_1_.getBrightnessForRender(p_77029_2_);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.bindTexture(TextureMap.locationBlocksTexture);
this.field_147909_c.renderBlockAsItem(p_77029_1_.getCarriedBlock(), p_77029_1_.getCarryingData(), 1.0F);
GL11.glPopMatrix();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityEnderman p_77032_1_, int p_77032_2_, float p_77032_3_)
{
if (p_77032_2_ != 0)
{
return -1;
}
else
{
this.bindTexture(endermanEyesTexture);
float f1 = 1.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
GL11.glDisable(GL11.GL_LIGHTING);
if (p_77032_1_.isInvisible())
{
GL11.glDepthMask(false);
}
else
{
GL11.glDepthMask(true);
}
char c0 = 61680;
int j = c0 % 65536;
int k = c0 / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
return 1;
}
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityEnderman)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return this.shouldRenderPass((EntityEnderman)p_77032_1_, p_77032_2_, p_77032_3_);
}
protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_)
{
this.renderEquippedItems((EntityEnderman)p_77029_1_, p_77029_2_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityEnderman)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityEnderman)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityEnderman)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}