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