    001    package net.minecraft.src;
    002
    003    import net.minecraftforge.client.IItemRenderer;
    004    import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
    005    import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
    006    import net.minecraftforge.client.MinecraftForgeClient;
    007
    008    import cpw.mods.fml.common.Side;
    009    import cpw.mods.fml.common.asm.SideOnly;
    010    import org.lwjgl.opengl.GL11;
    011
    012    @SideOnly(Side.CLIENT)
    013    public class RenderSnowMan extends RenderLiving
    014    {
    015        /** A reference to the Snowman model in RenderSnowMan. */
    016        private ModelSnowMan snowmanModel;
    017
    018        public RenderSnowMan()
    019        {
    020            super(new ModelSnowMan(), 0.5F);
    021            this.snowmanModel = (ModelSnowMan)super.mainModel;
    022            this.setRenderPassModel(this.snowmanModel);
    023        }
    024
    025        /**
    026         * Renders this snowman's pumpkin.
    027         */
    028        protected void renderSnowmanPumpkin(EntitySnowman par1EntitySnowman, float par2)
    029        {
    030            super.renderEquippedItems(par1EntitySnowman, par2);
    031            ItemStack var3 = new ItemStack(Block.pumpkin, 1);
    032
    033            if (var3 != null && var3.getItem() instanceof ItemBlock)
    034            {
    035                GL11.glPushMatrix();
    036                this.snowmanModel.head.postRender(0.0625F);
    037
    038                IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
    039                boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
    040
    041                if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
    042                {
    043                    float var4 = 0.625F;
    044                    GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
    045                    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    046                    GL11.glScalef(var4, -var4, var4);
    047                }
    048
    049                this.renderManager.itemRenderer.renderItem(par1EntitySnowman, var3, 0);
    050                GL11.glPopMatrix();
    051            }
    052        }
    053
    054        protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    055        {
    056            this.renderSnowmanPumpkin((EntitySnowman)par1EntityLiving, par2);
    057        }
    058    }