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 char var5 = 61680;
038 int var6 = var5 % 65536;
039 int var7 = var5 / 65536;
040 OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var6 / 1.0F, (float)var7 / 1.0F);
041 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
042 GL11.glColor4f(1.0F, 1.0F, 1.0F, var4);
043 return 1;
044 }
045 }
046
047 protected void scaleSpider(EntitySpider par1EntitySpider, float par2)
048 {
049 float var3 = par1EntitySpider.spiderScaleAmount();
050 GL11.glScalef(var3, var3, var3);
051 }
052
053 /**
054 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
055 * entityLiving, partialTickTime
056 */
057 protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
058 {
059 this.scaleSpider((EntitySpider)par1EntityLiving, par2);
060 }
061
062 protected float getDeathMaxRotation(EntityLiving par1EntityLiving)
063 {
064 return this.setSpiderDeathMaxRotation((EntitySpider)par1EntityLiving);
065 }
066
067 /**
068 * Queries whether should render the specified pass or not.
069 */
070 protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
071 {
072 return this.setSpiderEyeBrightness((EntitySpider)par1EntityLiving, par2, par3);
073 }
074 }