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: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-07 14:53:20 +01:00
|
|
|
import com.minelittlepony.client.util.render.Part;
|
2019-03-23 20:58:50 +01:00
|
|
|
import com.minelittlepony.model.ICapitated;
|
|
|
|
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-22 18:24:22 +01:00
|
|
|
public class ModelPonyHead extends SkullOverlayEntityModel implements 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:06:07 +01:00
|
|
|
private ModelPart ears;
|
2018-06-10 21:55:13 +02:00
|
|
|
|
2018-05-26 22:50:30 +02:00
|
|
|
public IPonyData metadata = new PonyData();
|
|
|
|
|
|
|
|
public ModelPonyHead() {
|
|
|
|
super();
|
|
|
|
|
2018-06-10 21:55:13 +02:00
|
|
|
snout = new PonySnout(this, 0, -3, 2);
|
|
|
|
horn = new UnicornHorn(this, 0, 0, 0, -1, 4);
|
|
|
|
|
|
|
|
snout.init(0, 0);
|
|
|
|
|
2019-11-07 14:53:20 +01:00
|
|
|
ears = new Part(this, 0, 0)
|
2019-04-14 22:23:00 +02:00
|
|
|
.offset(0, -3, 2).around(0, 0, -2)
|
|
|
|
.tex(12, 16).box(-3.999F, -6, 1, 2, 2, 2, 0)
|
|
|
|
.flip().box( 1.999F, -6, 1, 2, 2, 2, 0);
|
2018-06-10 21:55:13 +02:00
|
|
|
|
2019-05-27 17:59:15 +02:00
|
|
|
getHead().addChild(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
|
|
|
}
|
|
|
|
|
2018-06-21 19:28:22 +02:00
|
|
|
@Override
|
|
|
|
public boolean hasHeadGear() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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) {
|
2018-06-10 21:55:13 +02:00
|
|
|
snout.isHidden = metadata.getRace().isHuman();
|
2019-11-23 22:06:07 +01:00
|
|
|
ears.visible = !snout.isHidden;
|
2018-05-26 22:50:30 +02:00
|
|
|
|
|
|
|
snout.setGender(metadata.getGender());
|
|
|
|
|
2019-11-23 22:06:07 +01:00
|
|
|
super.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|