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 RenderBat extends RenderLiving
009 {
010 /**
011 * not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and
012 * it seems a good match for a bats size
013 */
014 private int renderedBatSize;
015
016 public RenderBat()
017 {
018 super(new ModelBat(), 0.25F);
019 this.renderedBatSize = ((ModelBat)this.mainModel).getBatSize();
020 }
021
022 public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
023 {
024 int var10 = ((ModelBat)this.mainModel).getBatSize();
025
026 if (var10 != this.renderedBatSize)
027 {
028 this.renderedBatSize = var10;
029 this.mainModel = new ModelBat();
030 }
031
032 super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
033 }
034
035 protected void func_82442_a(EntityBat par1EntityBat, float par2)
036 {
037 GL11.glScalef(0.35F, 0.35F, 0.35F);
038 }
039
040 protected void func_82445_a(EntityBat par1EntityBat, double par2, double par4, double par6)
041 {
042 super.renderLivingAt(par1EntityBat, par2, par4, par6);
043 }
044
045 protected void func_82444_a(EntityBat par1EntityBat, float par2, float par3, float par4)
046 {
047 if (!par1EntityBat.getIsBatHanging())
048 {
049 GL11.glTranslatef(0.0F, MathHelper.cos(par2 * 0.3F) * 0.1F, 0.0F);
050 }
051 else
052 {
053 GL11.glTranslatef(0.0F, -0.1F, 0.0F);
054 }
055
056 super.rotateCorpse(par1EntityBat, par2, par3, par4);
057 }
058
059 /**
060 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
061 * entityLiving, partialTickTime
062 */
063 protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
064 {
065 this.func_82442_a((EntityBat)par1EntityLiving, par2);
066 }
067
068 protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
069 {
070 this.func_82444_a((EntityBat)par1EntityLiving, par2, par3, par4);
071 }
072
073 /**
074 * Sets a simple glTranslate on a LivingEntity.
075 */
076 protected void renderLivingAt(EntityLiving par1EntityLiving, double par2, double par4, double par6)
077 {
078 this.func_82445_a((EntityBat)par1EntityLiving, par2, par4, par6);
079 }
080
081 public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
082 {
083 this.func_82443_a((EntityBat)par1EntityLiving, par2, par4, par6, par8, par9);
084 }
085
086 /**
087 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
088 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
089 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
090 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
091 */
092 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
093 {
094 this.func_82443_a((EntityBat)par1Entity, par2, par4, par6, par8, par9);
095 }
096 }