    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.client.model.ModelSpider;
    006    import net.minecraft.client.renderer.OpenGlHelper;
    007    import net.minecraft.entity.EntityLiving;
    008    import net.minecraft.entity.monster.EntitySpider;
    009    import org.lwjgl.opengl.GL11;
    010
    011    @SideOnly(Side.CLIENT)
    012    public class RenderSpider extends RenderLiving
    013    {
    014        public RenderSpider()
    015        {
    016            super(new ModelSpider(), 1.0F);
    017            this.setRenderPassModel(new ModelSpider());
    018        }
    019
    020        protected float setSpiderDeathMaxRotation(EntitySpider par1EntitySpider)
    021        {
    022            return 180.0F;
    023        }
    024
    025        /**
    026         * Sets the spider's glowing eyes
    027         */
    028        protected int setSpiderEyeBrightness(EntitySpider par1EntitySpider, int par2, float par3)
    029        {
    030            if (par2 != 0)
    031            {
    032                return -1;
    033            }
    034            else
    035            {
    036                this.loadTexture("/mob/spider_eyes.png");
    037                float var4 = 1.0F;
    038                GL11.glEnable(GL11.GL_BLEND);
    039                GL11.glDisable(GL11.GL_ALPHA_TEST);
    040                GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    041
    042                if (par1EntitySpider.getHasActivePotion())
    043                {
    044                    GL11.glDepthMask(false);
    045                }
    046                else
    047                {
    048                    GL11.glDepthMask(true);
    049                }
    050
    051                char var5 = 61680;
    052                int var6 = var5 % 65536;
    053                int var7 = var5 / 65536;
    054                OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var6 / 1.0F, (float)var7 / 1.0F);
    055                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    056                GL11.glColor4f(1.0F, 1.0F, 1.0F, var4);
    057                return 1;
    058            }
    059        }
    060
    061        protected void scaleSpider(EntitySpider par1EntitySpider, float par2)
    062        {
    063            float var3 = par1EntitySpider.spiderScaleAmount();
    064            GL11.glScalef(var3, var3, var3);
    065        }
    066
    067        /**
    068         * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
    069         * entityLiving, partialTickTime
    070         */
    071        protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
    072        {
    073            this.scaleSpider((EntitySpider)par1EntityLiving, par2);
    074        }
    075
    076        protected float getDeathMaxRotation(EntityLiving par1EntityLiving)
    077        {
    078            return this.setSpiderDeathMaxRotation((EntitySpider)par1EntityLiving);
    079        }
    080
    081        /**
    082         * Queries whether should render the specified pass or not.
    083         */
    084        protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
    085        {
    086            return this.setSpiderEyeBrightness((EntitySpider)par1EntityLiving, par2, par3);
    087        }
    088    }