    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    import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
    007    import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
    008    import net.minecraftforge.client.IItemRenderer;
    009    import net.minecraftforge.client.MinecraftForgeClient;
    010
    011    @SideOnly(Side.CLIENT)
    012    public class RenderBiped extends RenderLiving
    013    {
    014        protected ModelBiped modelBipedMain;
    015        protected float field_77070_b;
    016
    017        public RenderBiped(ModelBiped par1ModelBiped, float par2)
    018        {
    019            this(par1ModelBiped, par2, 1.0F);
    020            this.modelBipedMain = par1ModelBiped;
    021        }
    022
    023        public RenderBiped(ModelBiped par1ModelBiped, float par2, float par3)
    024        {
    025            super(par1ModelBiped, par2);
    026            this.modelBipedMain = par1ModelBiped;
    027            this.field_77070_b = par3;
    028        }
    029
    030        protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    031        {
    032            super.renderEquippedItems(par1EntityLiving, par2);
    033            ItemStack var3 = par1EntityLiving.getHeldItem();
    034
    035            if (var3 != null)
    036            {
    037                GL11.glPushMatrix();
    038                this.modelBipedMain.bipedRightArm.postRender(0.0625F);
    039                GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
    040                float var4;
    041
    042                IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
    043                boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
    044
    045                if (var3.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())))
    046                {
    047                    var4 = 0.5F;
    048                    GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
    049                    var4 *= 0.75F;
    050                    GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
    051                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    052                    GL11.glScalef(var4, -var4, var4);
    053                }
    054                else if (var3.itemID == Item.bow.shiftedIndex)
    055                {
    056                    var4 = 0.625F;
    057                    GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
    058                    GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
    059                    GL11.glScalef(var4, -var4, var4);
    060                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
    061                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    062                }
    063                else if (Item.itemsList[var3.itemID].isFull3D())
    064                {
    065                    var4 = 0.625F;
    066                    GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
    067                    GL11.glScalef(var4, -var4, var4);
    068                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
    069                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    070                }
    071                else
    072                {
    073                    var4 = 0.375F;
    074                    GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
    075                    GL11.glScalef(var4, var4, var4);
    076                    GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
    077                    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
    078                    GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
    079                }
    080
    081                this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 0);
    082
    083                if (var3.getItem().requiresMultipleRenderPasses())
    084                {
    085                    for (int x = 1; x < var3.getItem().getRenderPasses(var3.getItemDamage()); x++)
    086                    {
    087                        this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, x);
    088                    }
    089                }
    090
    091                GL11.glPopMatrix();
    092            }
    093        }
    094    }