2019-11-23 22:07:39 +01:00
|
|
|
package com.minelittlepony.client.model;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
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-03-23 20:58:50 +01:00
|
|
|
import com.minelittlepony.model.ICapitated;
|
2019-11-29 00:13:15 +01:00
|
|
|
import com.minelittlepony.mson.api.ModelContext;
|
|
|
|
import com.minelittlepony.mson.api.MsonModel;
|
2019-03-23 20:58:50 +01:00
|
|
|
import com.minelittlepony.pony.IPonyData;
|
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;
|
2019-05-27 17:59:15 +02:00
|
|
|
import net.minecraft.client.render.entity.model.SkullOverlayEntityModel;
|
2019-11-23 22:06:07 +01:00
|
|
|
import net.minecraft.client.util.math.MatrixStack;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
2019-11-30 12:26:02 +01:00
|
|
|
public class PonySkullModel extends SkullOverlayEntityModel 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
|
|
|
|
2019-11-29 00:13:15 +01:00
|
|
|
@Override
|
|
|
|
public void init(ModelContext context) {
|
2019-11-29 10:31:09 +01:00
|
|
|
context.findByName("skull", skull);
|
|
|
|
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() {
|
2019-06-27 19:28:21 +02:00
|
|
|
return skull;
|
2018-05-26 22:50:30 +02:00
|
|
|
}
|
|
|
|
|
2019-11-29 10:31:09 +01:00
|
|
|
@Override
|
2020-03-27 19:14:50 +01:00
|
|
|
public void method_2821(float poweredTicks, float yaw, float pitch) {
|
|
|
|
super.method_2821(poweredTicks, yaw, pitch);
|
2019-11-29 10:31:09 +01:00
|
|
|
hair.yaw = skull.yaw;
|
|
|
|
hair.pitch = skull.pitch;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
skull.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|