package net.minecraft.client.renderer.entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBat;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class RenderBat extends RenderLiving
{
/**
* not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and
* it seems a good match for a bats size
*/
private int renderedBatSize;
public RenderBat()
{
super(new ModelBat(), 0.25F);
this.renderedBatSize = ((ModelBat)this.mainModel).getBatSize();
}
public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
{
int i = ((ModelBat)this.mainModel).getBatSize();
if (i != this.renderedBatSize)
{
this.renderedBatSize = i;
this.mainModel = new ModelBat();
}
super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
}
protected void func_82442_a(EntityBat par1EntityBat, float par2)
{
GL11.glScalef(0.35F, 0.35F, 0.35F);
}
protected void func_82445_a(EntityBat par1EntityBat, double par2, double par4, double par6)
{
super.renderLivingAt(par1EntityBat, par2, par4, par6);
}
protected void func_82444_a(EntityBat par1EntityBat, float par2, float par3, float par4)
{
if (!par1EntityBat.getIsBatHanging())
{
GL11.glTranslatef(0.0F, MathHelper.cos(par2 * 0.3F) * 0.1F, 0.0F);
}
else
{
GL11.glTranslatef(0.0F, -0.1F, 0.0F);
}
super.rotateCorpse(par1EntityBat, par2, par3, par4);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
{
this.func_82442_a((EntityBat)par1EntityLiving, par2);
}
protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
{
this.func_82444_a((EntityBat)par1EntityLiving, par2, par3, par4);
}
/**
* Sets a simple glTranslate on a LivingEntity.
*/
protected void renderLivingAt(EntityLiving par1EntityLiving, double par2, double par4, double par6)
{
this.func_82445_a((EntityBat)par1EntityLiving, par2, par4, par6);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.func_82443_a((EntityBat)par1EntityLiving, par2, par4, par6, par8, par9);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.func_82443_a((EntityBat)par1Entity, par2, par4, par6, par8, par9);
}
}