mirror of
https://git.zelz.net/catfoolyou/Project164.git
synced 2025-06-07 19:04:48 +00:00
135 lines
4.4 KiB
Java
135 lines
4.4 KiB
Java
package net.minecraft.src;
|
|
|
|
import net.lax1dude.eaglercraft.EaglerAdapter;
|
|
import net.lax1dude.eaglercraft.TextureLocation;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class RenderHorse extends RenderLiving
|
|
{
|
|
private static List<TextureLocation> horseVariantTextures = new ArrayList<TextureLocation>();
|
|
private static final TextureLocation whiteHorseTextures = new TextureLocation("textures/entity/horse/horse_white.png");
|
|
private static final TextureLocation muleTextures = new TextureLocation("textures/entity/horse/mule.png");
|
|
private static final TextureLocation donkeyTextures = new TextureLocation("textures/entity/horse/donkey.png");
|
|
private static final TextureLocation zombieHorseTextures = new TextureLocation("textures/entity/horse/horse_zombie.png");
|
|
private static final TextureLocation skeletonHorseTextures = new TextureLocation("textures/entity/horse/horse_skeleton.png");
|
|
|
|
public RenderHorse(ModelBase par1ModelBase, float par2)
|
|
{
|
|
super(par1ModelBase, par2);
|
|
}
|
|
|
|
protected void func_110847_a(EntityHorse par1EntityHorse, float par2)
|
|
{
|
|
float var3 = 1.0F;
|
|
int var4 = par1EntityHorse.getHorseType();
|
|
|
|
if (var4 == 1)
|
|
{
|
|
var3 *= 0.87F;
|
|
}
|
|
else if (var4 == 2)
|
|
{
|
|
var3 *= 0.92F;
|
|
}
|
|
|
|
EaglerAdapter.glScalef(var3, var3, var3);
|
|
super.preRenderCallback(par1EntityHorse, par2);
|
|
}
|
|
|
|
protected void renderHorse(EntityHorse par1EntityHorse, float par2, float par3, float par4, float par5, float par6, float par7)
|
|
{
|
|
if (par1EntityHorse.isInvisible())
|
|
{
|
|
this.mainModel.setRotationAngles(par2, par3, par4, par5, par6, par7, par1EntityHorse);
|
|
}
|
|
else
|
|
{
|
|
this.bindEntityTexture(par1EntityHorse);
|
|
this.mainModel.render(par1EntityHorse, par2, par3, par4, par5, par6, par7);
|
|
if(!horseVariantTextures.isEmpty()){
|
|
for(TextureLocation tex : horseVariantTextures){
|
|
tex.bindTexture();
|
|
this.mainModel.render(par1EntityHorse, par2, par3, par4, par5, par6, par7);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected TextureLocation getHorseTextures(EntityHorse par1EntityHorse)
|
|
{
|
|
if (!par1EntityHorse.func_110239_cn())
|
|
{
|
|
switch (par1EntityHorse.getHorseType())
|
|
{
|
|
case 0:
|
|
default:
|
|
return whiteHorseTextures;
|
|
|
|
case 1:
|
|
return donkeyTextures;
|
|
|
|
case 2:
|
|
return muleTextures;
|
|
|
|
case 3:
|
|
return zombieHorseTextures;
|
|
|
|
case 4:
|
|
return skeletonHorseTextures;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return this.getHorseVarTextures(par1EntityHorse);
|
|
}
|
|
}
|
|
|
|
private TextureLocation getHorseVarTextures(EntityHorse par1EntityHorse)
|
|
{
|
|
String var2 = par1EntityHorse.getHorseTexture();
|
|
TextureLocation var3 = new TextureLocation(var2);
|
|
|
|
String[] varTextures = par1EntityHorse.getVariantTexturePaths();
|
|
|
|
for(String tex : varTextures){
|
|
if(tex != null){
|
|
horseVariantTextures.add(new TextureLocation(tex));
|
|
}
|
|
}
|
|
|
|
return var3;
|
|
}
|
|
|
|
/**
|
|
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
|
* entityLiving, partialTickTime
|
|
*/
|
|
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
|
|
{
|
|
this.func_110847_a((EntityHorse)par1EntityLivingBase, par2);
|
|
}
|
|
|
|
/**
|
|
* Renders the model in RenderLiving
|
|
*/
|
|
protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7)
|
|
{
|
|
this.renderHorse((EntityHorse)par1EntityLivingBase, par2, par3, par4, par5, par6, par7);
|
|
}
|
|
|
|
@Override
|
|
protected void bindTexture(EntityLivingBase par1EntityLiving) {
|
|
this.getHorseTextures((EntityHorse) par1EntityLiving).bindTexture();
|
|
}
|
|
|
|
/**
|
|
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
|
*/
|
|
protected TextureLocation getEntityTexture(Entity par1Entity)
|
|
{
|
|
return this.getHorseTextures((EntityHorse)par1Entity);
|
|
}
|
|
}
|