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