2018-04-25 16:40:47 +02:00
|
|
|
package com.minelittlepony.model.ponies;
|
|
|
|
|
|
|
|
import net.minecraft.entity.Entity;
|
2018-04-28 22:59:19 +02:00
|
|
|
import net.minecraft.entity.monster.EntityZombieVillager;
|
2018-04-25 16:40:47 +02:00
|
|
|
import net.minecraft.entity.passive.EntityVillager;
|
|
|
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
|
|
|
|
2018-06-04 22:24:32 +02:00
|
|
|
import com.minelittlepony.model.components.SaddleBags;
|
2018-04-28 16:39:32 +02:00
|
|
|
import com.minelittlepony.model.player.ModelAlicorn;
|
2018-04-25 16:40:47 +02:00
|
|
|
import com.minelittlepony.render.plane.PlaneRenderer;
|
|
|
|
|
2018-04-28 16:39:32 +02:00
|
|
|
public class ModelVillagerPony extends ModelAlicorn {
|
2018-04-25 16:40:47 +02:00
|
|
|
|
2018-06-04 22:24:32 +02:00
|
|
|
public PlaneRenderer apron, trinket;
|
|
|
|
|
|
|
|
public SaddleBags saddlebags;
|
2018-04-25 16:40:47 +02:00
|
|
|
|
|
|
|
public ModelVillagerPony() {
|
|
|
|
super(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-06-03 16:38:03 +02:00
|
|
|
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
|
|
|
super.shakeBody(move, swing, bodySwing, ticks);
|
2018-06-02 20:05:22 +02:00
|
|
|
|
2018-06-04 22:24:32 +02:00
|
|
|
saddlebags.setRotationAndAngles(rainboom, move, swing, bodySwing, ticks);
|
2018-06-02 20:05:22 +02:00
|
|
|
apron.rotateAngleY = bodySwing;
|
|
|
|
trinket.rotateAngleY = bodySwing;
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-05-01 12:38:13 +02:00
|
|
|
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
|
|
|
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
2018-04-25 16:40:47 +02:00
|
|
|
|
2018-04-28 22:59:19 +02:00
|
|
|
int profession = getProfession(entity);
|
|
|
|
if (profession > -1) {
|
2018-04-25 16:40:47 +02:00
|
|
|
if (profession < 2) {
|
2018-06-04 22:24:32 +02:00
|
|
|
saddlebags.renderPart(scale);
|
2018-04-25 16:40:47 +02:00
|
|
|
} else if (profession == 2) {
|
|
|
|
trinket.render(scale);
|
|
|
|
} else if (profession > 2) {
|
|
|
|
apron.render(scale);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-28 22:59:19 +02:00
|
|
|
protected int getProfession(Entity entity) {
|
|
|
|
if (entity instanceof EntityVillager) {
|
|
|
|
return ((EntityVillager) entity).getProfession();
|
|
|
|
}
|
|
|
|
if (entity instanceof EntityZombieVillager) {
|
|
|
|
return ((EntityZombieVillager) entity).getProfession();
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-04-25 16:40:47 +02:00
|
|
|
@Override
|
|
|
|
protected void initTextures() {
|
|
|
|
super.initTextures();
|
2018-06-04 22:24:32 +02:00
|
|
|
saddlebags = new SaddleBags(this);
|
2018-04-26 16:01:31 +02:00
|
|
|
apron = new PlaneRenderer(this, 56, 16);
|
|
|
|
trinket = new PlaneRenderer(this, 0, 3);
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void initPositions(float yOffset, float stretch) {
|
|
|
|
super.initPositions(yOffset, stretch);
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2018-06-04 22:24:32 +02:00
|
|
|
saddlebags.init(yOffset, stretch);
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2018-04-26 16:01:31 +02:00
|
|
|
apron.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
|
|
|
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
|
|
|
.addBackPlane(-4, -4, -9, 8, 10, stretch);
|
|
|
|
trinket.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
|
|
|
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
|
|
|
.addBackPlane(-2, -4, -9, 4, 5, stretch);
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|
|
|
|
}
|