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