    001package net.minecraft.client.renderer.entity;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.model.ModelBiped;
    006import net.minecraft.client.model.ModelZombie;
    007import net.minecraft.client.model.ModelZombieVillager;
    008import net.minecraft.entity.Entity;
    009import net.minecraft.entity.EntityLiving;
    010import net.minecraft.entity.monster.EntityZombie;
    011
    012@SideOnly(Side.CLIENT)
    013public class RenderZombie extends RenderBiped
    014{
    015    private ModelBiped field_82434_o;
    016    private ModelZombieVillager field_82432_p;
    017    protected ModelBiped field_82437_k;
    018    protected ModelBiped field_82435_l;
    019    protected ModelBiped field_82436_m;
    020    protected ModelBiped field_82433_n;
    021    private int field_82431_q = 1;
    022
    023    public RenderZombie()
    024    {
    025        super(new ModelZombie(), 0.5F, 1.0F);
    026        this.field_82434_o = this.modelBipedMain;
    027        this.field_82432_p = new ModelZombieVillager();
    028    }
    029
    030    protected void func_82421_b()
    031    {
    032        this.field_82423_g = new ModelZombie(1.0F, true);
    033        this.field_82425_h = new ModelZombie(0.5F, true);
    034        this.field_82437_k = this.field_82423_g;
    035        this.field_82435_l = this.field_82425_h;
    036        this.field_82436_m = new ModelZombieVillager(1.0F, 0.0F, true);
    037        this.field_82433_n = new ModelZombieVillager(0.5F, 0.0F, true);
    038    }
    039
    040    protected int func_82429_a(EntityZombie par1EntityZombie, int par2, float par3)
    041    {
    042        this.func_82427_a(par1EntityZombie);
    043        return super.shouldRenderPass(par1EntityZombie, par2, par3);
    044    }
    045
    046    public void func_82426_a(EntityZombie par1EntityZombie, double par2, double par4, double par6, float par8, float par9)
    047    {
    048        this.func_82427_a(par1EntityZombie);
    049        super.doRenderLiving(par1EntityZombie, par2, par4, par6, par8, par9);
    050    }
    051
    052    protected void func_82428_a(EntityZombie par1EntityZombie, float par2)
    053    {
    054        this.func_82427_a(par1EntityZombie);
    055        super.renderEquippedItems(par1EntityZombie, par2);
    056    }
    057
    058    private void func_82427_a(EntityZombie par1EntityZombie)
    059    {
    060        if (par1EntityZombie.isVillager())
    061        {
    062            if (this.field_82431_q != this.field_82432_p.func_82897_a())
    063            {
    064                this.field_82432_p = new ModelZombieVillager();
    065                this.field_82431_q = this.field_82432_p.func_82897_a();
    066                this.field_82436_m = new ModelZombieVillager(1.0F, 0.0F, true);
    067                this.field_82433_n = new ModelZombieVillager(0.5F, 0.0F, true);
    068            }
    069
    070            this.mainModel = this.field_82432_p;
    071            this.field_82423_g = this.field_82436_m;
    072            this.field_82425_h = this.field_82433_n;
    073        }
    074        else
    075        {
    076            this.mainModel = this.field_82434_o;
    077            this.field_82423_g = this.field_82437_k;
    078            this.field_82425_h = this.field_82435_l;
    079        }
    080
    081        this.modelBipedMain = (ModelBiped)this.mainModel;
    082    }
    083
    084    protected void func_82430_a(EntityZombie par1EntityZombie, float par2, float par3, float par4)
    085    {
    086        if (par1EntityZombie.isConverting())
    087        {
    088            par3 += (float)(Math.cos((double)par1EntityZombie.ticksExisted * 3.25D) * Math.PI * 0.25D);
    089        }
    090
    091        super.rotateCorpse(par1EntityZombie, par2, par3, par4);
    092    }
    093
    094    protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    095    {
    096        this.func_82428_a((EntityZombie)par1EntityLiving, par2);
    097    }
    098
    099    public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    100    {
    101        this.func_82426_a((EntityZombie)par1EntityLiving, par2, par4, par6, par8, par9);
    102    }
    103
    104    /**
    105     * Queries whether should render the specified pass or not.
    106     */
    107    protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
    108    {
    109        return this.func_82429_a((EntityZombie)par1EntityLiving, par2, par3);
    110    }
    111
    112    protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    113    {
    114        this.func_82430_a((EntityZombie)par1EntityLiving, par2, par3, par4);
    115    }
    116
    117    /**
    118     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    119     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    120     * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    121     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    122     */
    123    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    124    {
    125        this.func_82426_a((EntityZombie)par1Entity, par2, par4, par6, par8, par9);
    126    }
    127}