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