001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005 import org.lwjgl.opengl.GL11;
006
007 @SideOnly(Side.CLIENT)
008 public class RenderVillager extends RenderLiving
009 {
010 /** Model of the villager. */
011 protected ModelVillager villagerModel;
012
013 public RenderVillager()
014 {
015 super(new ModelVillager(0.0F), 0.5F);
016 this.villagerModel = (ModelVillager)this.mainModel;
017 }
018
019 /**
020 * Determines wether Villager Render pass or not.
021 */
022 protected int shouldVillagerRenderPass(EntityVillager par1EntityVillager, int par2, float par3)
023 {
024 return -1;
025 }
026
027 public void renderVillager(EntityVillager par1EntityVillager, double par2, double par4, double par6, float par8, float par9)
028 {
029 super.doRenderLiving(par1EntityVillager, par2, par4, par6, par8, par9);
030 }
031
032 /**
033 * Passes the Villager special render.
034 */
035 protected void passVillagerSpecialRender(EntityVillager par1EntityVillager, double par2, double par4, double par6) {}
036
037 protected void renderVillagerEquipedItems(EntityVillager par1EntityVillager, float par2)
038 {
039 super.renderEquippedItems(par1EntityVillager, par2);
040 }
041
042 protected void preRenderVillager(EntityVillager par1EntityVillager, float par2)
043 {
044 float var3 = 0.9375F;
045
046 if (par1EntityVillager.getGrowingAge() < 0)
047 {
048 var3 = (float)((double)var3 * 0.5D);
049 this.shadowSize = 0.25F;
050 }
051 else
052 {
053 this.shadowSize = 0.5F;
054 }
055
056 GL11.glScalef(var3, var3, var3);
057 }
058
059 /**
060 * Passes the specialRender and renders it
061 */
062 protected void passSpecialRender(EntityLiving par1EntityLiving, double par2, double par4, double par6)
063 {
064 this.passVillagerSpecialRender((EntityVillager)par1EntityLiving, par2, par4, par6);
065 }
066
067 /**
068 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
069 * entityLiving, partialTickTime
070 */
071 protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
072 {
073 this.preRenderVillager((EntityVillager)par1EntityLiving, par2);
074 }
075
076 /**
077 * Queries whether should render the specified pass or not.
078 */
079 protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
080 {
081 return this.shouldVillagerRenderPass((EntityVillager)par1EntityLiving, par2, par3);
082 }
083
084 protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
085 {
086 this.renderVillagerEquipedItems((EntityVillager)par1EntityLiving, par2);
087 }
088
089 public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
090 {
091 this.renderVillager((EntityVillager)par1EntityLiving, par2, par4, par6, par8, par9);
092 }
093
094 /**
095 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
096 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
097 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
098 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
099 */
100 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
101 {
102 this.renderVillager((EntityVillager)par1Entity, par2, par4, par6, par8, par9);
103 }
104 }