2015-11-17 06:09:04 +01:00
|
|
|
package com.brohoof.minelittlepony.renderer;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2015-11-17 06:09:04 +01:00
|
|
|
import com.brohoof.minelittlepony.MineLittlePony;
|
2015-12-09 04:14:42 +01:00
|
|
|
import com.brohoof.minelittlepony.PonyGender;
|
|
|
|
import com.brohoof.minelittlepony.PonyRace;
|
|
|
|
import com.brohoof.minelittlepony.TailLengths;
|
2015-11-17 06:09:04 +01:00
|
|
|
import com.brohoof.minelittlepony.model.ModelPony;
|
|
|
|
import com.brohoof.minelittlepony.model.PlayerModel;
|
|
|
|
import com.brohoof.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
|
|
|
import com.brohoof.minelittlepony.renderer.layer.LayerPonyArmor;
|
|
|
|
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkull;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
|
|
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.entity.EntityLiving;
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
import net.minecraft.entity.monster.EntityPigZombie;
|
|
|
|
import net.minecraft.entity.monster.EntitySkeleton;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
|
|
|
|
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving implements IRenderPony {
|
|
|
|
protected ModelPony mobModel;
|
|
|
|
protected PlayerModel playerModel;
|
|
|
|
|
|
|
|
public RenderPonyMob(RenderManager renderManager, PlayerModel playerModel) {
|
2015-12-09 04:14:42 +01:00
|
|
|
super(renderManager, playerModel.getModel(), playerModel.getShadowsize());
|
|
|
|
this.mobModel = playerModel.getModel();
|
2015-08-02 00:36:33 +02:00
|
|
|
this.playerModel = playerModel;
|
|
|
|
|
|
|
|
this.addLayer(new LayerPonyArmor(this));
|
|
|
|
this.addLayer(new LayerHeldPonyItem(this));
|
|
|
|
// this.addLayer(new LayerArrow(this));
|
|
|
|
this.addLayer(new LayerPonySkull(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void doRender(EntityLiving entity, double xPosition, double yPosition, double zPosition, float yaw,
|
|
|
|
float partialTicks) {
|
|
|
|
ItemStack heldItem = entity.getHeldItem();
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().heldItemRight = heldItem == null ? 0 : 1;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().isSneak = false;
|
|
|
|
this.playerModel.getModel().isFlying = false;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
|
|
|
if (entity instanceof EntitySkeleton) {
|
2015-12-09 04:14:42 +01:00
|
|
|
|
2015-12-14 09:29:10 +01:00
|
|
|
switch (entity.getUniqueID().hashCode() % 3) {
|
2015-08-02 00:36:33 +02:00
|
|
|
case 0:
|
|
|
|
case 1:
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().metadata.setRace(PonyRace.UNICORN);
|
2015-08-02 00:36:33 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
} else {
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (entity instanceof EntityPigZombie) {
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().metadata.setGender(PonyGender.STALLION);
|
2015-08-02 00:36:33 +02:00
|
|
|
} else {
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().metadata.setGender(PonyGender.MARE);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (entity instanceof EntitySkeleton) {
|
2015-12-09 04:14:42 +01:00
|
|
|
this.playerModel.getModel().metadata.setTail(TailLengths.STUB);
|
2015-12-14 09:29:10 +01:00
|
|
|
} else {
|
|
|
|
this.playerModel.getModel().metadata.setTail(TailLengths.FULL);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().isSleeping = false;
|
2015-11-17 06:17:35 +01:00
|
|
|
if (MineLittlePony.getConfig().getShowScale().get()) {
|
2015-08-02 00:36:33 +02:00
|
|
|
this.shadowSize = 0.4F;
|
|
|
|
}
|
|
|
|
|
|
|
|
double yOrigin = yPosition;
|
|
|
|
if (entity.isSneaking()) {
|
|
|
|
yOrigin -= 0.125D;
|
|
|
|
}
|
|
|
|
|
|
|
|
super.doRender(entity, xPosition, yOrigin, zPosition, yaw, partialTicks);
|
2015-12-14 09:29:10 +01:00
|
|
|
this.playerModel.getModel().aimedBow = false;
|
|
|
|
this.playerModel.getModel().isSneak = false;
|
|
|
|
this.playerModel.getModel().heldItemRight = 0;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
|
|
|
public void doRender(Entity entity, double xPosition, double yPosition, double zPosition, float yaw,
|
|
|
|
float partialTicks) {
|
|
|
|
this.doRender((T) entity, xPosition, yPosition, zPosition, yaw, partialTicks);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract ResourceLocation getEntityTexture(T var1);
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
|
|
|
protected ResourceLocation getEntityTexture(Entity var1) {
|
|
|
|
return this.getEntityTexture((T) var1);
|
|
|
|
}
|
|
|
|
|
2015-09-02 04:18:45 +02:00
|
|
|
protected void preRenderCallback(T entity, float partick) {}
|
2015-08-02 00:36:33 +02:00
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
|
|
|
protected void preRenderCallback(EntityLivingBase entitylivingbaseIn, float partialTickTime) {
|
|
|
|
preRenderCallback((T) entitylivingbaseIn, partialTickTime);
|
|
|
|
}
|
|
|
|
|
2015-12-09 04:14:42 +01:00
|
|
|
protected void rotateCorpse(T entity, float xPosition, float yPosition, float zPosition) {
|
|
|
|
super.rotateCorpse(entity, xPosition, yPosition, zPosition);
|
|
|
|
}
|
2015-08-02 00:36:33 +02:00
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
|
|
|
protected void rotateCorpse(EntityLivingBase entity, float xPosition, float yPosition, float zPosition) {
|
|
|
|
this.rotateCorpse((T) entity, xPosition, yPosition, zPosition);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public PlayerModel getPony() {
|
|
|
|
return playerModel;
|
|
|
|
}
|
|
|
|
}
|