2019-11-23 22:07:39 +01:00
|
|
|
package com.minelittlepony.client.model;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2021-02-06 15:52:06 +01:00
|
|
|
import com.minelittlepony.api.model.ICapitated;
|
2020-04-03 23:54:12 +02:00
|
|
|
import com.minelittlepony.api.pony.IPonyData;
|
2019-11-23 22:59:33 +01:00
|
|
|
import com.minelittlepony.client.model.part.PonyEars;
|
2019-11-23 22:19:13 +01:00
|
|
|
import com.minelittlepony.client.model.part.PonySnout;
|
|
|
|
import com.minelittlepony.client.model.part.UnicornHorn;
|
2019-03-23 20:49:34 +01:00
|
|
|
import com.minelittlepony.client.pony.PonyData;
|
2019-11-29 00:13:15 +01:00
|
|
|
import com.minelittlepony.mson.api.ModelContext;
|
|
|
|
import com.minelittlepony.mson.api.MsonModel;
|
2020-04-03 23:54:12 +02:00
|
|
|
|
2019-11-22 18:24:22 +01:00
|
|
|
import net.minecraft.client.model.ModelPart;
|
2019-11-23 22:06:07 +01:00
|
|
|
import net.minecraft.client.render.VertexConsumer;
|
2020-11-26 14:41:15 +01:00
|
|
|
import net.minecraft.client.render.entity.model.SkullEntityModel;
|
2019-11-23 22:06:07 +01:00
|
|
|
import net.minecraft.client.util.math.MatrixStack;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2020-11-26 14:41:15 +01:00
|
|
|
public class PonySkullModel extends SkullEntityModel implements MsonModel, ICapitated<ModelPart> {
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2018-06-10 21:55:13 +02:00
|
|
|
private PonySnout snout;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2019-11-23 22:06:07 +01:00
|
|
|
private UnicornHorn horn;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2019-11-23 22:59:33 +01:00
|
|
|
private PonyEars ears;
|
2018-06-10 21:55:13 +02:00
|
|
|
|
2019-11-29 10:31:09 +01:00
|
|
|
private ModelPart hair;
|
|
|
|
|
2019-11-30 17:49:04 +01:00
|
|
|
public IPonyData metadata = PonyData.NULL;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2020-11-26 14:41:15 +01:00
|
|
|
public PonySkullModel(ModelPart tree) {
|
|
|
|
super(tree);
|
|
|
|
}
|
|
|
|
|
2019-11-29 00:13:15 +01:00
|
|
|
@Override
|
|
|
|
public void init(ModelContext context) {
|
2019-11-29 10:31:09 +01:00
|
|
|
hair = context.findByName("hair");
|
2019-11-29 00:13:15 +01:00
|
|
|
snout = context.findByName("snout");
|
|
|
|
horn = context.findByName("horn");
|
|
|
|
ears = context.findByName("ears");
|
|
|
|
}
|
|
|
|
|
2018-05-26 22:50:30 +02:00
|
|
|
@Override
|
2019-11-22 18:24:22 +01:00
|
|
|
public ModelPart getHead() {
|
2021-02-07 10:43:25 +01:00
|
|
|
return head;
|
2018-05-26 22:50:30 +02:00
|
|
|
}
|
|
|
|
|
2019-11-29 10:31:09 +01:00
|
|
|
@Override
|
2022-06-11 20:46:24 +02:00
|
|
|
public void setHeadRotation(float animationProgress, float yaw, float pitch) {
|
|
|
|
super.setHeadRotation(animationProgress, yaw, pitch);
|
2021-02-07 10:43:25 +01:00
|
|
|
hair.yaw = head.yaw;
|
|
|
|
hair.pitch = head.pitch;
|
2019-11-29 10:31:09 +01:00
|
|
|
}
|
|
|
|
|
2018-05-26 22:50:30 +02:00
|
|
|
@Override
|
2019-11-23 22:06:07 +01:00
|
|
|
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
2019-11-24 17:05:56 +01:00
|
|
|
snout.setVisible(!metadata.getRace().isHuman());
|
|
|
|
ears.setVisible(!metadata.getRace().isHuman());
|
2018-05-26 22:50:30 +02:00
|
|
|
|
|
|
|
snout.setGender(metadata.getGender());
|
|
|
|
|
2019-11-29 10:31:09 +01:00
|
|
|
hair.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
2021-02-07 10:43:25 +01:00
|
|
|
head.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2019-07-24 23:37:22 +02:00
|
|
|
if (metadata.hasHorn()) {
|
2019-11-23 22:06:07 +01:00
|
|
|
getHead().rotate(stack);
|
|
|
|
horn.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, null);
|
2018-05-26 22:50:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|