    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 RenderWitch extends RenderLiving
    009    {
    010        private ModelWitch field_82414_a;
    011        private int field_82413_f;
    012
    013        public RenderWitch()
    014        {
    015            super(new ModelWitch(0.0F), 0.5F);
    016            this.field_82414_a = (ModelWitch)this.mainModel;
    017            this.field_82413_f = this.field_82414_a.func_82899_a();
    018        }
    019
    020        public void func_82412_a(EntityWitch par1EntityWitch, double par2, double par4, double par6, float par8, float par9)
    021        {
    022            ItemStack var10 = par1EntityWitch.getHeldItem();
    023
    024            if (this.field_82414_a.func_82899_a() != this.field_82413_f)
    025            {
    026                System.out.println("Updating witch model");
    027                this.mainModel = this.field_82414_a = new ModelWitch(0.0F);
    028                this.field_82413_f = this.field_82414_a.func_82899_a();
    029            }
    030
    031            this.field_82414_a.field_82900_g = var10 != null;
    032            super.doRenderLiving(par1EntityWitch, par2, par4, par6, par8, par9);
    033        }
    034
    035        protected void func_82411_a(EntityWitch par1EntityWitch, float par2)
    036        {
    037            float var3 = 1.0F;
    038            GL11.glColor3f(var3, var3, var3);
    039            super.renderEquippedItems(par1EntityWitch, par2);
    040            ItemStack var4 = par1EntityWitch.getHeldItem();
    041
    042            if (var4 != null)
    043            {
    044                GL11.glPushMatrix();
    045                float var5;
    046
    047                if (this.mainModel.isChild)
    048                {
    049                    var5 = 0.5F;
    050                    GL11.glTranslatef(0.0F, 0.625F, 0.0F);
    051                    GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
    052                    GL11.glScalef(var5, var5, var5);
    053                }
    054
    055                this.field_82414_a.field_82898_f.postRender(0.0625F);
    056                GL11.glTranslatef(-0.0625F, 0.53125F, 0.21875F);
    057
    058                if (var4.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType()))
    059                {
    060                    var5 = 0.5F;
    061                    GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
    062                    var5 *= 0.75F;
    063                    GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
    064                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    065                    GL11.glScalef(var5, -var5, var5);
    066                }
    067                else if (var4.itemID == Item.bow.shiftedIndex)
    068                {
    069                    var5 = 0.625F;
    070                    GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
    071                    GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
    072                    GL11.glScalef(var5, -var5, var5);
    073                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
    074                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    075                }
    076                else if (Item.itemsList[var4.itemID].isFull3D())
    077                {
    078                    var5 = 0.625F;
    079
    080                    if (Item.itemsList[var4.itemID].shouldRotateAroundWhenRendering())
    081                    {
    082                        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    083                        GL11.glTranslatef(0.0F, -0.125F, 0.0F);
    084                    }
    085
    086                    this.func_82410_b();
    087                    GL11.glScalef(var5, -var5, var5);
    088                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
    089                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    090                }
    091                else
    092                {
    093                    var5 = 0.375F;
    094                    GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
    095                    GL11.glScalef(var5, var5, var5);
    096                    GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
    097                    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
    098                    GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
    099                }
    100
    101                GL11.glRotatef(-15.0F, 1.0F, 0.0F, 0.0F);
    102                GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    103                this.renderManager.itemRenderer.renderItem(par1EntityWitch, var4, 0);
    104
    105                if (var4.getItem().requiresMultipleRenderPasses())
    106                {
    107                    this.renderManager.itemRenderer.renderItem(par1EntityWitch, var4, 1);
    108                }
    109
    110                GL11.glPopMatrix();
    111            }
    112        }
    113
    114        protected void func_82410_b()
    115        {
    116            GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
    117        }
    118
    119        protected void func_82409_b(EntityWitch par1EntityWitch, float par2)
    120        {
    121            float var3 = 0.9375F;
    122            GL11.glScalef(var3, var3, var3);
    123        }
    124
    125        /**
    126         * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
    127         * entityLiving, partialTickTime
    128         */
    129        protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
    130        {
    131            this.func_82409_b((EntityWitch)par1EntityLiving, par2);
    132        }
    133
    134        protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    135        {
    136            this.func_82411_a((EntityWitch)par1EntityLiving, par2);
    137        }
    138
    139        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    140        {
    141            this.func_82412_a((EntityWitch)par1EntityLiving, par2, par4, par6, par8, par9);
    142        }
    143
    144        /**
    145         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    146         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    147         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    148         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    149         */
    150        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    151        {
    152            this.func_82412_a((EntityWitch)par1Entity, par2, par4, par6, par8, par9);
    153        }
    154    }