100 lines
2.7 KiB
Java
Executable file
100 lines
2.7 KiB
Java
Executable file
package client.renderer.entity;
|
|
|
|
import java.util.Set;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import client.Client;
|
|
import client.renderer.model.ModelHorse;
|
|
import client.renderer.texture.LayeredTexture;
|
|
import common.collect.Sets;
|
|
import common.entity.animal.EntityHorse;
|
|
|
|
public class RenderHorse extends RenderLiving<EntityHorse>
|
|
{
|
|
private static final Set<String> loaded = Sets.<String>newHashSet();
|
|
private static final String whiteHorseTextures = "textures/entity/horse_white.png";
|
|
private static final String muleTextures = "textures/entity/mule.png";
|
|
private static final String donkeyTextures = "textures/entity/donkey.png";
|
|
private static final String zombieHorseTextures = "textures/entity/horse_zombie.png";
|
|
private static final String skeletonHorseTextures = "textures/entity/horse_skeleton.png";
|
|
|
|
public RenderHorse(RenderManager rendermanagerIn, ModelHorse model)
|
|
{
|
|
super(rendermanagerIn, model);
|
|
}
|
|
|
|
/**
|
|
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
|
* entityLiving, partialTickTime
|
|
*/
|
|
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
|
|
{
|
|
float f = 1.0F;
|
|
int i = entitylivingbaseIn.getHorseType();
|
|
|
|
if (i == 1)
|
|
{
|
|
f *= 0.87F;
|
|
}
|
|
else if (i == 2)
|
|
{
|
|
f *= 0.92F;
|
|
}
|
|
|
|
GL11.glScalef(f, f, f);
|
|
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
|
|
}
|
|
|
|
/**
|
|
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
|
*/
|
|
protected String getEntityTexture(EntityHorse entity)
|
|
{
|
|
if (!entity.func_110239_cn())
|
|
{
|
|
switch (entity.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.func_110848_b(entity);
|
|
}
|
|
}
|
|
|
|
private String func_110848_b(EntityHorse horse)
|
|
{
|
|
String s = horse.getHorseTexture();
|
|
|
|
if (!horse.func_175507_cI())
|
|
{
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
if (!loaded.contains(s))
|
|
{
|
|
Client.CLIENT.getTextureManager().loadTexture(s, new LayeredTexture(horse.getVariantTexturePaths()));
|
|
loaded.add(s);
|
|
}
|
|
|
|
return s;
|
|
}
|
|
}
|
|
}
|