    001    package net.minecraft.client.renderer.entity;
    002
    003    import cpw.mods.fml.relauncher.Side;
    004    import cpw.mods.fml.relauncher.SideOnly;
    005    import net.minecraft.block.Block;
    006    import net.minecraft.client.Minecraft;
    007    import net.minecraft.client.entity.EntityPlayerSP;
    008    import net.minecraft.client.gui.FontRenderer;
    009    import net.minecraft.client.model.ModelBiped;
    010    import net.minecraft.client.renderer.RenderBlocks;
    011    import net.minecraft.client.renderer.Tessellator;
    012    import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
    013    import net.minecraft.entity.Entity;
    014    import net.minecraft.entity.EntityLiving;
    015    import net.minecraft.entity.player.EntityPlayer;
    016    import net.minecraft.item.EnumAction;
    017    import net.minecraft.item.EnumArmorMaterial;
    018    import net.minecraft.item.Item;
    019    import net.minecraft.item.ItemBlock;
    020    import net.minecraft.item.ItemArmor;
    021    import net.minecraft.item.ItemStack;
    022    import net.minecraft.util.MathHelper;
    023    import org.lwjgl.opengl.GL11;
    024
    025    import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
    026    import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
    027    import net.minecraftforge.client.IItemRenderer;
    028    import net.minecraftforge.client.MinecraftForgeClient;
    029    import net.minecraftforge.client.ForgeHooksClient;
    030
    031    @SideOnly(Side.CLIENT)
    032    public class RenderPlayer extends RenderLiving
    033    {
    034        private ModelBiped modelBipedMain;
    035        private ModelBiped modelArmorChestplate;
    036        private ModelBiped modelArmor;
    037        public static String[] armorFilenamePrefix = new String[] {"cloth", "chain", "iron", "diamond", "gold"};
    038        public static float NAME_TAG_RANGE = 64.0f;
    039        public static float NAME_TAG_RANGE_SNEAK = 32.0f;
    040
    041        public RenderPlayer()
    042        {
    043            super(new ModelBiped(0.0F), 0.5F);
    044            this.modelBipedMain = (ModelBiped)this.mainModel;
    045            this.modelArmorChestplate = new ModelBiped(1.0F);
    046            this.modelArmor = new ModelBiped(0.5F);
    047        }
    048
    049        /**
    050         * Set the specified armor model as the player model. Args: player, armorSlot, partialTick
    051         */
    052        protected int setArmorModel(EntityPlayer par1EntityPlayer, int par2, float par3)
    053        {
    054            ItemStack var4 = par1EntityPlayer.inventory.armorItemInSlot(3 - par2);
    055
    056            if (var4 != null)
    057            {
    058                Item var5 = var4.getItem();
    059
    060                if (var5 instanceof ItemArmor)
    061                {
    062                    ItemArmor var6 = (ItemArmor)var5;
    063                    this.loadTexture(ForgeHooksClient.getArmorTexture(var4, "/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"));
    064                    ModelBiped var7 = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
    065                    var7.bipedHead.showModel = par2 == 0;
    066                    var7.bipedHeadwear.showModel = par2 == 0;
    067                    var7.bipedBody.showModel = par2 == 1 || par2 == 2;
    068                    var7.bipedRightArm.showModel = par2 == 1;
    069                    var7.bipedLeftArm.showModel = par2 == 1;
    070                    var7.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
    071                    var7.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
    072                    this.setRenderPassModel(var7);
    073
    074                    if (var7 != null)
    075                    {
    076                        var7.onGround = this.mainModel.onGround;
    077                    }
    078
    079                    if (var7 != null)
    080                    {
    081                        var7.isRiding = this.mainModel.isRiding;
    082                    }
    083
    084                    if (var7 != null)
    085                    {
    086                        var7.isChild = this.mainModel.isChild;
    087                    }
    088
    089                    float var8 = 1.0F;
    090
    091                    if (var6.getArmorMaterial() == EnumArmorMaterial.CLOTH)
    092                    {
    093                        int var9 = var6.getColor(var4);
    094                        float var10 = (float)(var9 >> 16 & 255) / 255.0F;
    095                        float var11 = (float)(var9 >> 8 & 255) / 255.0F;
    096                        float var12 = (float)(var9 & 255) / 255.0F;
    097                        GL11.glColor3f(var8 * var10, var8 * var11, var8 * var12);
    098
    099                        if (var4.isItemEnchanted())
    100                        {
    101                            return 31;
    102                        }
    103
    104                        return 16;
    105                    }
    106
    107                    GL11.glColor3f(var8, var8, var8);
    108
    109                    if (var4.isItemEnchanted())
    110                    {
    111                        return 15;
    112                    }
    113
    114                    return 1;
    115                }
    116            }
    117
    118            return -1;
    119        }
    120
    121        protected void func_82439_b(EntityPlayer par1EntityPlayer, int par2, float par3)
    122        {
    123            ItemStack var4 = par1EntityPlayer.inventory.armorItemInSlot(3 - par2);
    124
    125            if (var4 != null)
    126            {
    127                Item var5 = var4.getItem();
    128
    129                if (var5 instanceof ItemArmor)
    130                {
    131                    ItemArmor var6 = (ItemArmor)var5;
    132                    this.loadTexture(ForgeHooksClient.getArmorTexture(var4, "/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png"));
    133                    float var7 = 1.0F;
    134                    GL11.glColor3f(var7, var7, var7);
    135                }
    136            }
    137        }
    138
    139        public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9)
    140        {
    141            float var10 = 1.0F;
    142            GL11.glColor3f(var10, var10, var10);
    143            ItemStack var11 = par1EntityPlayer.inventory.getCurrentItem();
    144            this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = var11 != null ? 1 : 0;
    145
    146            if (var11 != null && par1EntityPlayer.getItemInUseCount() > 0)
    147            {
    148                EnumAction var12 = var11.getItemUseAction();
    149
    150                if (var12 == EnumAction.block)
    151                {
    152                    this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 3;
    153                }
    154                else if (var12 == EnumAction.bow)
    155                {
    156                    this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = true;
    157                }
    158            }
    159
    160            this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = par1EntityPlayer.isSneaking();
    161            double var14 = par4 - (double)par1EntityPlayer.yOffset;
    162
    163            if (par1EntityPlayer.isSneaking() && !(par1EntityPlayer instanceof EntityPlayerSP))
    164            {
    165                var14 -= 0.125D;
    166            }
    167
    168            super.doRenderLiving(par1EntityPlayer, par2, var14, par6, par8, par9);
    169            this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false;
    170            this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false;
    171            this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0;
    172        }
    173
    174        /**
    175         * Used to render a player's name above their head
    176         */
    177        protected void renderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6)
    178        {
    179            if (Minecraft.isGuiEnabled() && par1EntityPlayer != this.renderManager.livingPlayer && !par1EntityPlayer.getHasActivePotion())
    180            {
    181                float var8 = 1.6F;
    182                float var9 = 0.016666668F * var8;
    183                double var10 = par1EntityPlayer.getDistanceSqToEntity(this.renderManager.livingPlayer);
    184                float var12 = par1EntityPlayer.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE;
    185
    186                if (var10 < (double)(var12 * var12))
    187                {
    188                    String var13 = par1EntityPlayer.username;
    189
    190                    if (par1EntityPlayer.isSneaking())
    191                    {
    192                        FontRenderer var14 = this.getFontRendererFromRenderManager();
    193                        GL11.glPushMatrix();
    194                        GL11.glTranslatef((float)par2 + 0.0F, (float)par4 + 2.3F, (float)par6);
    195                        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    196                        GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    197                        GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    198                        GL11.glScalef(-var9, -var9, var9);
    199                        GL11.glDisable(GL11.GL_LIGHTING);
    200                        GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F);
    201                        GL11.glDepthMask(false);
    202                        GL11.glEnable(GL11.GL_BLEND);
    203                        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    204                        Tessellator var15 = Tessellator.instance;
    205                        GL11.glDisable(GL11.GL_TEXTURE_2D);
    206                        var15.startDrawingQuads();
    207                        int var16 = var14.getStringWidth(var13) / 2;
    208                        var15.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
    209                        var15.addVertex((double)(-var16 - 1), -1.0D, 0.0D);
    210                        var15.addVertex((double)(-var16 - 1), 8.0D, 0.0D);
    211                        var15.addVertex((double)(var16 + 1), 8.0D, 0.0D);
    212                        var15.addVertex((double)(var16 + 1), -1.0D, 0.0D);
    213                        var15.draw();
    214                        GL11.glEnable(GL11.GL_TEXTURE_2D);
    215                        GL11.glDepthMask(true);
    216                        var14.drawString(var13, -var14.getStringWidth(var13) / 2, 0, 553648127);
    217                        GL11.glEnable(GL11.GL_LIGHTING);
    218                        GL11.glDisable(GL11.GL_BLEND);
    219                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    220                        GL11.glPopMatrix();
    221                    }
    222                    else if (par1EntityPlayer.isPlayerSleeping())
    223                    {
    224                        this.renderLivingLabel(par1EntityPlayer, var13, par2, par4 - 1.5D, par6, 64);
    225                    }
    226                    else
    227                    {
    228                        this.renderLivingLabel(par1EntityPlayer, var13, par2, par4, par6, 64);
    229                    }
    230                }
    231            }
    232        }
    233
    234        /**
    235         * Method for adding special render rules
    236         */
    237        protected void renderSpecials(EntityPlayer par1EntityPlayer, float par2)
    238        {
    239            float var3 = 1.0F;
    240            GL11.glColor3f(var3, var3, var3);
    241            super.renderEquippedItems(par1EntityPlayer, par2);
    242            super.renderArrowsStuckInEntity(par1EntityPlayer, par2);
    243            ItemStack var4 = par1EntityPlayer.inventory.armorItemInSlot(3);
    244
    245            if (var4 != null)
    246            {
    247                GL11.glPushMatrix();
    248                this.modelBipedMain.bipedHead.postRender(0.0625F);
    249                float var5;
    250
    251                if (var4 != null && var4.getItem() instanceof ItemBlock)
    252                {
    253                    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var4, EQUIPPED);
    254                    boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var4, BLOCK_3D));
    255
    256                    if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType()))
    257                    {
    258                        var5 = 0.625F;
    259                        GL11.glTranslatef(0.0F, -0.25F, 0.0F);
    260                        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    261                        GL11.glScalef(var5, -var5, -var5);
    262                    }
    263
    264                    this.renderManager.itemRenderer.renderItem(par1EntityPlayer, var4, 0);
    265                }
    266                else if (var4.getItem().shiftedIndex == Item.skull.shiftedIndex)
    267                {
    268                    var5 = 1.0625F;
    269                    GL11.glScalef(var5, -var5, -var5);
    270                    String var6 = "";
    271
    272                    if (var4.hasTagCompound() && var4.getTagCompound().hasKey("SkullOwner"))
    273                    {
    274                        var6 = var4.getTagCompound().getString("SkullOwner");
    275                    }
    276
    277                    TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, var4.getItemDamage(), var6);
    278                }
    279
    280                GL11.glPopMatrix();
    281            }
    282
    283            float var7;
    284            float var8;
    285
    286            if (par1EntityPlayer.username.equals("deadmau5") && this.loadDownloadableImageTexture(par1EntityPlayer.skinUrl, (String)null))
    287            {
    288                for (int var20 = 0; var20 < 2; ++var20)
    289                {
    290                    float var25 = par1EntityPlayer.prevRotationYaw + (par1EntityPlayer.rotationYaw - par1EntityPlayer.prevRotationYaw) * par2 - (par1EntityPlayer.prevRenderYawOffset + (par1EntityPlayer.renderYawOffset - par1EntityPlayer.prevRenderYawOffset) * par2);
    291                    var7 = par1EntityPlayer.prevRotationPitch + (par1EntityPlayer.rotationPitch - par1EntityPlayer.prevRotationPitch) * par2;
    292                    GL11.glPushMatrix();
    293                    GL11.glRotatef(var25, 0.0F, 1.0F, 0.0F);
    294                    GL11.glRotatef(var7, 1.0F, 0.0F, 0.0F);
    295                    GL11.glTranslatef(0.375F * (float)(var20 * 2 - 1), 0.0F, 0.0F);
    296                    GL11.glTranslatef(0.0F, -0.375F, 0.0F);
    297                    GL11.glRotatef(-var7, 1.0F, 0.0F, 0.0F);
    298                    GL11.glRotatef(-var25, 0.0F, 1.0F, 0.0F);
    299                    var8 = 1.3333334F;
    300                    GL11.glScalef(var8, var8, var8);
    301                    this.modelBipedMain.renderEars(0.0625F);
    302                    GL11.glPopMatrix();
    303                }
    304            }
    305
    306            float var11;
    307
    308            if (this.loadDownloadableImageTexture(par1EntityPlayer.playerCloakUrl, (String)null) && !par1EntityPlayer.getHasActivePotion() && !par1EntityPlayer.getHideCape())
    309            {
    310                GL11.glPushMatrix();
    311                GL11.glTranslatef(0.0F, 0.0F, 0.125F);
    312                double var22 = par1EntityPlayer.field_71091_bM + (par1EntityPlayer.field_71094_bP - par1EntityPlayer.field_71091_bM) * (double)par2 - (par1EntityPlayer.prevPosX + (par1EntityPlayer.posX - par1EntityPlayer.prevPosX) * (double)par2);
    313                double var24 = par1EntityPlayer.field_71096_bN + (par1EntityPlayer.field_71095_bQ - par1EntityPlayer.field_71096_bN) * (double)par2 - (par1EntityPlayer.prevPosY + (par1EntityPlayer.posY - par1EntityPlayer.prevPosY) * (double)par2);
    314                double var9 = par1EntityPlayer.field_71097_bO + (par1EntityPlayer.field_71085_bR - par1EntityPlayer.field_71097_bO) * (double)par2 - (par1EntityPlayer.prevPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.prevPosZ) * (double)par2);
    315                var11 = par1EntityPlayer.prevRenderYawOffset + (par1EntityPlayer.renderYawOffset - par1EntityPlayer.prevRenderYawOffset) * par2;
    316                double var12 = (double)MathHelper.sin(var11 * (float)Math.PI / 180.0F);
    317                double var14 = (double)(-MathHelper.cos(var11 * (float)Math.PI / 180.0F));
    318                float var16 = (float)var24 * 10.0F;
    319
    320                if (var16 < -6.0F)
    321                {
    322                    var16 = -6.0F;
    323                }
    324
    325                if (var16 > 32.0F)
    326                {
    327                    var16 = 32.0F;
    328                }
    329
    330                float var17 = (float)(var22 * var12 + var9 * var14) * 100.0F;
    331                float var18 = (float)(var22 * var14 - var9 * var12) * 100.0F;
    332
    333                if (var17 < 0.0F)
    334                {
    335                    var17 = 0.0F;
    336                }
    337
    338                float var19 = par1EntityPlayer.prevCameraYaw + (par1EntityPlayer.cameraYaw - par1EntityPlayer.prevCameraYaw) * par2;
    339                var16 += MathHelper.sin((par1EntityPlayer.prevDistanceWalkedModified + (par1EntityPlayer.distanceWalkedModified - par1EntityPlayer.prevDistanceWalkedModified) * par2) * 6.0F) * 32.0F * var19;
    340
    341                if (par1EntityPlayer.isSneaking())
    342                {
    343                    var16 += 25.0F;
    344                }
    345
    346                GL11.glRotatef(6.0F + var17 / 2.0F + var16, 1.0F, 0.0F, 0.0F);
    347                GL11.glRotatef(var18 / 2.0F, 0.0F, 0.0F, 1.0F);
    348                GL11.glRotatef(-var18 / 2.0F, 0.0F, 1.0F, 0.0F);
    349                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
    350                this.modelBipedMain.renderCloak(0.0625F);
    351                GL11.glPopMatrix();
    352            }
    353
    354            ItemStack var21 = par1EntityPlayer.inventory.getCurrentItem();
    355
    356            if (var21 != null)
    357            {
    358                GL11.glPushMatrix();
    359                this.modelBipedMain.bipedRightArm.postRender(0.0625F);
    360                GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
    361
    362                if (par1EntityPlayer.fishEntity != null)
    363                {
    364                    var21 = new ItemStack(Item.stick);
    365                }
    366
    367                EnumAction var23 = null;
    368
    369                if (par1EntityPlayer.getItemInUseCount() > 0)
    370                {
    371                    var23 = var21.getItemUseAction();
    372                }
    373
    374                IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var21, EQUIPPED);
    375                boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var21, BLOCK_3D));
    376
    377                if (var21.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())))
    378                {
    379                    var7 = 0.5F;
    380                    GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
    381                    var7 *= 0.75F;
    382                    GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
    383                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    384                    GL11.glScalef(-var7, -var7, var7);
    385                }
    386                else if (var21.itemID == Item.bow.shiftedIndex)
    387                {
    388                    var7 = 0.625F;
    389                    GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
    390                    GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
    391                    GL11.glScalef(var7, -var7, var7);
    392                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
    393                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    394                }
    395                else if (Item.itemsList[var21.itemID].isFull3D())
    396                {
    397                    var7 = 0.625F;
    398
    399                    if (Item.itemsList[var21.itemID].shouldRotateAroundWhenRendering())
    400                    {
    401                        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    402                        GL11.glTranslatef(0.0F, -0.125F, 0.0F);
    403                    }
    404
    405                    if (par1EntityPlayer.getItemInUseCount() > 0 && var23 == EnumAction.block)
    406                    {
    407                        GL11.glTranslatef(0.05F, 0.0F, -0.1F);
    408                        GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
    409                        GL11.glRotatef(-10.0F, 1.0F, 0.0F, 0.0F);
    410                        GL11.glRotatef(-60.0F, 0.0F, 0.0F, 1.0F);
    411                    }
    412
    413                    GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
    414                    GL11.glScalef(var7, -var7, var7);
    415                    GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
    416                    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    417                }
    418                else
    419                {
    420                    var7 = 0.375F;
    421                    GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
    422                    GL11.glScalef(var7, var7, var7);
    423                    GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
    424                    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
    425                    GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
    426                }
    427
    428                float var10;
    429                int var27;
    430                float var28;
    431
    432                if (var21.getItem().requiresMultipleRenderPasses())
    433                {
    434                    for (var27 = 0; var27 < var21.getItem().getRenderPasses(var21.getItemDamage()); ++var27)
    435                    {
    436                        int var26 = var21.getItem().getColorFromItemStack(var21, var27);
    437                        var28 = (float)(var26 >> 16 & 255) / 255.0F;
    438                        var10 = (float)(var26 >> 8 & 255) / 255.0F;
    439                        var11 = (float)(var26 & 255) / 255.0F;
    440                        GL11.glColor4f(var28, var10, var11, 1.0F);
    441                        this.renderManager.itemRenderer.renderItem(par1EntityPlayer, var21, var27);
    442                    }
    443                }
    444                else
    445                {
    446                    var27 = var21.getItem().getColorFromItemStack(var21, 0);
    447                    var8 = (float)(var27 >> 16 & 255) / 255.0F;
    448                    var28 = (float)(var27 >> 8 & 255) / 255.0F;
    449                    var10 = (float)(var27 & 255) / 255.0F;
    450                    GL11.glColor4f(var8, var28, var10, 1.0F);
    451                    this.renderManager.itemRenderer.renderItem(par1EntityPlayer, var21, 0);
    452                }
    453
    454                GL11.glPopMatrix();
    455            }
    456        }
    457
    458        protected void renderPlayerScale(EntityPlayer par1EntityPlayer, float par2)
    459        {
    460            float var3 = 0.9375F;
    461            GL11.glScalef(var3, var3, var3);
    462        }
    463
    464        public void func_82441_a(EntityPlayer par1EntityPlayer)
    465        {
    466            float var2 = 1.0F;
    467            GL11.glColor3f(var2, var2, var2);
    468            this.modelBipedMain.onGround = 0.0F;
    469            this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
    470            this.modelBipedMain.bipedRightArm.render(0.0625F);
    471        }
    472
    473        /**
    474         * Renders player with sleeping offset if sleeping
    475         */
    476        protected void renderPlayerSleep(EntityPlayer par1EntityPlayer, double par2, double par4, double par6)
    477        {
    478            if (par1EntityPlayer.isEntityAlive() && par1EntityPlayer.isPlayerSleeping())
    479            {
    480                super.renderLivingAt(par1EntityPlayer, par2 + (double)par1EntityPlayer.field_71079_bU, par4 + (double)par1EntityPlayer.field_71082_cx, par6 + (double)par1EntityPlayer.field_71089_bV);
    481            }
    482            else
    483            {
    484                super.renderLivingAt(par1EntityPlayer, par2, par4, par6);
    485            }
    486        }
    487
    488        /**
    489         * Rotates the player if the player is sleeping. This method is called in rotateCorpse.
    490         */
    491        protected void rotatePlayer(EntityPlayer par1EntityPlayer, float par2, float par3, float par4)
    492        {
    493            if (par1EntityPlayer.isEntityAlive() && par1EntityPlayer.isPlayerSleeping())
    494            {
    495                GL11.glRotatef(par1EntityPlayer.getBedOrientationInDegrees(), 0.0F, 1.0F, 0.0F);
    496                GL11.glRotatef(this.getDeathMaxRotation(par1EntityPlayer), 0.0F, 0.0F, 1.0F);
    497                GL11.glRotatef(270.0F, 0.0F, 1.0F, 0.0F);
    498            }
    499            else
    500            {
    501                super.rotateCorpse(par1EntityPlayer, par2, par3, par4);
    502            }
    503        }
    504
    505        /**
    506         * Passes the specialRender and renders it
    507         */
    508        protected void passSpecialRender(EntityLiving par1EntityLiving, double par2, double par4, double par6)
    509        {
    510            this.renderName((EntityPlayer)par1EntityLiving, par2, par4, par6);
    511        }
    512
    513        /**
    514         * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
    515         * entityLiving, partialTickTime
    516         */
    517        protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
    518        {
    519            this.renderPlayerScale((EntityPlayer)par1EntityLiving, par2);
    520        }
    521
    522        protected void func_82408_c(EntityLiving par1EntityLiving, int par2, float par3)
    523        {
    524            this.func_82439_b((EntityPlayer)par1EntityLiving, par2, par3);
    525        }
    526
    527        /**
    528         * Queries whether should render the specified pass or not.
    529         */
    530        protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
    531        {
    532            return this.setArmorModel((EntityPlayer)par1EntityLiving, par2, par3);
    533        }
    534
    535        protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    536        {
    537            this.renderSpecials((EntityPlayer)par1EntityLiving, par2);
    538        }
    539
    540        protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    541        {
    542            this.rotatePlayer((EntityPlayer)par1EntityLiving, par2, par3, par4);
    543        }
    544
    545        /**
    546         * Sets a simple glTranslate on a LivingEntity.
    547         */
    548        protected void renderLivingAt(EntityLiving par1EntityLiving, double par2, double par4, double par6)
    549        {
    550            this.renderPlayerSleep((EntityPlayer)par1EntityLiving, par2, par4, par6);
    551        }
    552
    553        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    554        {
    555            this.renderPlayer((EntityPlayer)par1EntityLiving, par2, par4, par6, par8, par9);
    556        }
    557
    558        /**
    559         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    560         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    561         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    562         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    563         */
    564        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    565        {
    566            this.renderPlayer((EntityPlayer)par1Entity, par2, par4, par6, par8, par9);
    567        }
    568    }