mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Convert elytra and pony head to json
This commit is contained in:
parent
b01eae5ed4
commit
ba52fe59de
7 changed files with 71 additions and 48 deletions
|
@ -1,9 +1,9 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.part.PonyEars;
|
||||||
import com.minelittlepony.client.model.part.PonySnout;
|
import com.minelittlepony.client.model.part.PonySnout;
|
||||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||||
import com.minelittlepony.client.pony.PonyData;
|
import com.minelittlepony.client.pony.PonyData;
|
||||||
import com.minelittlepony.client.util.render.Part;
|
|
||||||
import com.minelittlepony.model.ICapitated;
|
import com.minelittlepony.model.ICapitated;
|
||||||
import com.minelittlepony.pony.IPonyData;
|
import com.minelittlepony.pony.IPonyData;
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
|
@ -17,26 +17,10 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
|
||||||
|
|
||||||
private UnicornHorn horn;
|
private UnicornHorn horn;
|
||||||
|
|
||||||
private ModelPart ears;
|
private PonyEars ears;
|
||||||
|
|
||||||
public IPonyData metadata = new PonyData();
|
public IPonyData metadata = new PonyData();
|
||||||
|
|
||||||
public ModelPonyHead() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
snout = new PonySnout(this, 0, -3, 2);
|
|
||||||
horn = new UnicornHorn(this, 0, 0, 0, -1, 4);
|
|
||||||
|
|
||||||
snout.init(0, 0);
|
|
||||||
|
|
||||||
ears = new Part(this, 0, 0)
|
|
||||||
.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);
|
|
||||||
|
|
||||||
getHead().addChild(ears);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelPart getHead() {
|
public ModelPart getHead() {
|
||||||
return skull;
|
return skull;
|
||||||
|
@ -50,7 +34,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||||
snout.isHidden = metadata.getRace().isHuman();
|
snout.isHidden = metadata.getRace().isHuman();
|
||||||
ears.visible = !snout.isHidden;
|
ears.setVisible(!snout.isHidden);
|
||||||
|
|
||||||
snout.setGender(metadata.getGender());
|
snout.setGender(metadata.getGender());
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,11 @@ package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
|
||||||
import net.minecraft.client.render.entity.model.AnimalModel;
|
import net.minecraft.client.render.entity.model.AnimalModel;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.minelittlepony.client.util.render.Part;
|
|
||||||
|
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
|
@ -20,13 +17,8 @@ public class PonyElytra<T extends LivingEntity> extends AnimalModel<T> {
|
||||||
|
|
||||||
public boolean isSneaking;
|
public boolean isSneaking;
|
||||||
|
|
||||||
private Part rightWing = new Part(this, 22, 0);
|
private ModelPart rightWing;
|
||||||
private Part leftWing = new Part(this, 22, 0);
|
private ModelPart leftWing;
|
||||||
|
|
||||||
public PonyElytra() {
|
|
||||||
leftWing .box(-10, 0, 0, 10, 20, 2, 1);
|
|
||||||
rightWing.flip().box( 0, 0, 0, 10, 20, 2, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Iterable<ModelPart> getHeadParts() {
|
protected Iterable<ModelPart> getHeadParts() {
|
||||||
|
|
|
@ -13,18 +13,18 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class PonyEars implements IPart {
|
public class PonyEars implements IPart {
|
||||||
|
|
||||||
private final Part head;
|
private final ModelPart head;
|
||||||
private final boolean bat;
|
private final boolean bat;
|
||||||
|
|
||||||
private Part right;
|
private ModelPart right;
|
||||||
private Part left;
|
private ModelPart left;
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> PonyEars(Part head, boolean bat) {
|
public <T extends Model & ICapitated<ModelPart>> PonyEars(ModelPart head, boolean bat) {
|
||||||
this.head = head;
|
this.head = head;
|
||||||
this.bat = bat;
|
this.bat = bat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
right = head.child().tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch);
|
right = head.child().tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch);
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,14 @@ public class PonySnout implements IPart {
|
||||||
private final ICapitated<ModelPart> head;
|
private final ICapitated<ModelPart> head;
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony) {
|
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony) {
|
||||||
this(pony, 0, 0, 0);
|
this(pony, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony, int x, int y, int z) {
|
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony, int y, int z) {
|
||||||
head = pony;
|
head = pony;
|
||||||
|
|
||||||
mare = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F);
|
mare = new Part(pony).offset(HEAD_CENTRE_X, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F);
|
||||||
stallion = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z);
|
stallion = new Part(pony).offset(HEAD_CENTRE_X, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z);
|
||||||
|
|
||||||
pony.getHead().addChild(stallion);
|
pony.getHead().addChild(stallion);
|
||||||
pony.getHead().addChild(mare);
|
pony.getHead().addChild(mare);
|
||||||
|
|
|
@ -29,23 +29,23 @@ public class UnicornHorn implements IPart {
|
||||||
|
|
||||||
protected boolean isVisible = true;
|
protected boolean isVisible = true;
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony, float yOffset, float stretch) {
|
public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony) {
|
||||||
this(pony, yOffset, stretch, 0, 0, 0);
|
this(pony, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) {
|
public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony, int y, int z) {
|
||||||
horn = new Part(pony, 0, 3);
|
horn = new Part(pony, 0, 3);
|
||||||
glow = new Part(pony, 0, 3);
|
glow = new Part(pony, 0, 3);
|
||||||
|
|
||||||
horn.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
|
horn.offset(HORN_X, HORN_Y + y, HORN_Z + z)
|
||||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
.around(HEAD_RP_X, HEAD_RP_Y, HEAD_RP_Z)
|
||||||
.box(0, 0, 0, 1, 4, 1, stretch)
|
.box(0, 0, 0, 1, 4, 1, 0)
|
||||||
.pitch = 0.5F;
|
.pitch = 0.5F;
|
||||||
|
|
||||||
glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
|
glow.offset(HORN_X, HORN_Y + y, HORN_Z + z)
|
||||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
.around(HEAD_RP_X, HEAD_RP_Y , HEAD_RP_Z)
|
||||||
.cone(0, 0, 0, 1, 4, 1, stretch + 0.5F)
|
.cone(0, 0, 0, 1, 4, 1, 0.5F)
|
||||||
.cone(0, 0, 0, 1, 3, 1, stretch + 0.8F);
|
.cone(0, 0, 0, 1, 3, 1, 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
13
src/main/resources/assets/minelittlepony/models/elytra.json
Normal file
13
src/main/resources/assets/minelittlepony/models/elytra.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"texture": {"u": 22, "w": 64, "h": 32},
|
||||||
|
"left_wing": {
|
||||||
|
"cubes": [
|
||||||
|
{"from": [-10, 0, 0], "size": [10, 20, 2], "stretch": 1}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"right_wing": {
|
||||||
|
"cubes": [
|
||||||
|
{"from": [ 0, 0, 0], "size": [10, 20, 2], "stretch": 1, "mirror": true}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
34
src/main/resources/assets/minelittlepony/models/head.json
Normal file
34
src/main/resources/assets/minelittlepony/models/head.json
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"texture": {"u": 32, "w": 64, "h": 64},
|
||||||
|
"locals": {
|
||||||
|
"snout_x": -3,
|
||||||
|
"snout_z": 2,
|
||||||
|
"horn_x": -1,
|
||||||
|
"horn_z": 4
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"cubes": [
|
||||||
|
{"from": [-4, -8, -4], "size": [8, 8, 8], "stretch": 0.25}
|
||||||
|
],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "snout",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.PonySnout",
|
||||||
|
"content: "minelitlepony:components/snout"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "ears",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.PonyEars",
|
||||||
|
"content": "minelittlepony:components/ears"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "horn",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.UnicornHorn",
|
||||||
|
"content": "minelittlepony:components/horn"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue