diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index be9f8b95..74ab6989 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -1,11 +1,9 @@ package com.minelittlepony.client.model; import com.minelittlepony.client.model.armour.ModelPonyArmour; -import com.minelittlepony.client.model.part.PonySnout; import com.minelittlepony.client.model.armour.ArmourWrapper; import com.minelittlepony.client.transform.PonyTransformation; import com.minelittlepony.model.BodyPart; -import com.minelittlepony.model.IPart; import com.minelittlepony.model.armour.IEquestrianArmour; import com.minelittlepony.mson.api.ModelContext; import com.minelittlepony.mson.api.model.MsonPart; @@ -29,10 +27,6 @@ public abstract class AbstractPonyModel extends ClientPo protected ModelPart neck; - protected IPart tail; - protected PonySnout snout; - protected IPart ears; - @Override public void init(ModelContext context) { super.init(context); @@ -47,9 +41,6 @@ public abstract class AbstractPonyModel extends ClientPo upperTorso = context.findByName("upper_torso"); upperTorsoOverlay = context.findByName("saddle"); neck = context.findByName("neck"); - tail = context.findByName("tail"); - snout = context.findByName("snout"); - ears = context.findByName("ears"); } @Override @@ -113,8 +104,6 @@ public abstract class AbstractPonyModel extends ClientPo } animateWears(); - - snout.setGender(getMetadata().getGender()); } /** @@ -200,8 +189,6 @@ public abstract class AbstractPonyModel extends ClientPo * @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}. */ protected void shakeBody(float move, float swing, float bodySwing, float ticks) { - tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks); - upperTorso.yaw = bodySwing; torso.yaw = bodySwing; neck.yaw = bodySwing; @@ -611,7 +598,6 @@ public abstract class AbstractPonyModel extends ClientPo torso.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); upperTorso.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); torso.rotate(stack); - tail.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId); } protected void renderVest(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { @@ -645,8 +631,6 @@ public abstract class AbstractPonyModel extends ClientPo upperTorsoOverlay.visible = visible; neck.visible = visible; - - tail.setVisible(visible); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/ModelType.java b/src/main/java/com/minelittlepony/client/model/ModelType.java index ed45aa57..6e5297a7 100644 --- a/src/main/java/com/minelittlepony/client/model/ModelType.java +++ b/src/main/java/com/minelittlepony/client/model/ModelType.java @@ -5,6 +5,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.VexEntity; import net.minecraft.util.Identifier; +import com.minelittlepony.client.model.armour.ModelPonyArmour; import com.minelittlepony.client.model.entity.ModelBreezie; import com.minelittlepony.client.model.entity.ModelEnderStallion; import com.minelittlepony.client.model.entity.ModelGuardianPony; @@ -50,6 +51,9 @@ public final class ModelType { public static final ModelKey ENDERMAN = register("enderman", ModelEnderStallion::new); public static final ModelKey> BREEZIE = register("breezie", ModelBreezie::new); + public static final ModelKey> ARMOUR_INNER = register("armour_inner", ModelPonyArmour::new); + public static final ModelKey> ARMOUR_OUTER = register("armour_outer", ModelPonyArmour::new); + public static final PlayerModelKey> ALICORN = registerPlayer("alicorn", Race.ALICORN, ModelAlicorn::new); public static final PlayerModelKey> UNICORN = registerPlayer("unicorn", Race.UNICORN, ModelUnicorn::new); public static final PlayerModelKey> KIRIN = registerPlayer("kirin", Race.KIRIN, ModelUnicorn::new); diff --git a/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java b/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java index cc8f93c0..7b349c92 100644 --- a/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java +++ b/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java @@ -12,6 +12,7 @@ import com.minelittlepony.mson.api.Mson; import com.minelittlepony.mson.api.MsonModel; import java.util.function.Function; +import java.util.function.Supplier; public class PlayerModelKey { @@ -59,6 +60,12 @@ public class PlayerModelKey public Function getFactory() { return d -> rendererFactory.create(d, slim, (ModelKey>)this); } + + @Override + public V createModel(Supplier supplier) { + PlayerModelKey.this.slim = this.slim; + return key.createModel(supplier); + } } public interface RendererFactory { diff --git a/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java b/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java index 546aaa4c..92bd47ff 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java @@ -2,6 +2,7 @@ package com.minelittlepony.client.model.armour; import net.minecraft.entity.LivingEntity; +import com.minelittlepony.client.model.ModelType; import com.minelittlepony.model.armour.ArmourLayer; import com.minelittlepony.model.armour.IEquestrianArmour; import com.minelittlepony.pony.IPonyData; @@ -14,8 +15,8 @@ public class ArmourWrapper implements IEquestrianArmour< private final ModelPonyArmour innerLayer; public ArmourWrapper(Supplier> supplier) { - outerLayer = supplier.get(); - innerLayer = supplier.get(); + outerLayer = ModelType.ARMOUR_INNER.createModel(supplier); + innerLayer = ModelType.ARMOUR_OUTER.createModel(supplier); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java b/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java index 08290cf9..4034d634 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java @@ -7,10 +7,10 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import com.minelittlepony.client.model.AbstractPonyModel; -import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.IModel; import com.minelittlepony.model.armour.ArmourVariant; import com.minelittlepony.model.armour.IArmour; +import com.minelittlepony.mson.api.ModelContext; public class ModelPonyArmour extends AbstractPonyModel implements IArmour { @@ -25,6 +25,14 @@ public class ModelPonyArmour extends AbstractPonyModel extends AbstractPonyModel extends AbstractPonyModel extends AbstractPonyModel { private final boolean smallArms; + protected IPart tail; + protected PonySnout snout; + protected IPart ears; + public ModelEarthPony(boolean smallArms) { this.smallArms = smallArms; } + @Override + public void init(ModelContext context) { + super.init(context); + + tail = context.findByName("tail"); + snout = context.findByName("snout"); + ears = context.findByName("ears"); + } + @Override public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) { super.setAngles(entity, move, swing, ticks, headYaw, headPitch); + snout.setGender(getMetadata().getGender()); cape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0; } + @Override + protected void shakeBody(float move, float swing, float bodySwing, float ticks) { + super.shakeBody(move, swing, bodySwing, ticks); + tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks); + } + + @Override + protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { + super.renderBody(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); + tail.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId); + } + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + tail.setVisible(visible); + } + @Override protected float getLegOutset() { if (smallArms) { diff --git a/src/main/resources/assets/minelittlepony/models/armour.json b/src/main/resources/assets/minelittlepony/models/armour.json deleted file mode 100644 index 81bec048..00000000 --- a/src/main/resources/assets/minelittlepony/models/armour.json +++ /dev/null @@ -1,335 +0,0 @@ -{ - "parent": "mson:steve", - "texture": { - "w": 64, "h": 64 - }, - "locals": { - "arm_length": 12, - "arm_width": 4, - "arm_depth": 4, - "arm_x": 0, - "arm_x_neg": ["#arm_x", "-", "#arm_width"], - "arm_z": [2, "-", "#arm_depth"], - "arm_rotation_x": 3, - "arm_rotation_x_neg": [0, "-", "#arm_rotation_x"], - "arm_rotation_y": 8 - }, - "head": { - "offset": [ 0, -1, -2 ], - "center": [ 0, 0, -2 ], - "cubes": [ - { "from": [-4, -4, -4], "size": [ 8, 8, 8] } - ], - "children": [ - { - "type": "mson:slot", - "name": "snout", - "implementation": "com.minelittlepony.client.model.part.PonySnout", - "content": "minelittlepony:components/snout" - }, - { - "type": "mson:slot", - "name": "ears", - "implementation": "com.minelittlepony.client.model.part.PonyEars", - "content": "minelittlepony:components/ears" - } - ] - }, - "helmet": { - "texture": { "u": 32, "v": 0 }, - "offset": [ 0, -1, -2 ], - "center": [ 0, 0, -2 ], - "cubes": [ - { "from": [-4, -4, -4], "size": [ 8, 8, 8], "stretch": 0.5 } - ] - }, - "torso": { - "texture": { "u": 16, "v": 16 }, - "cubes": [ - { "from": [-4, 4, -2], "size": [ 8, 8, 4] } - ] - }, - "upper_torso": { - "texture": { "u": 24, "v": 0 }, - "offset": [ 0, 8, 6 ], - "cubes": [ - { - "type": "mson:plane", "__comment": "body sides", - "texture": { "u": 24, "v": 0 }, - "face": "east", - "position": [ 4, -4, -4 ], "size": [ 8, 8 ] - }, - { - "type": "mson:plane", "__comment": "body sides", - "texture": { "u": 24, "v": 0 }, - "mirror": [ false, false, true ], - "face": "west", - "position": [ -4, -4, -4 ], "size": [ 8, 8 ] - }, - { - "type": "mson:plane", "__comment": "cutie mark", - "texture": { "u": 4, "v": 0 }, - "face": "east", - "position": [ 4, -4, 4 ], "size": [ 8, 4 ] - }, - { - "type": "mson:plane", "__comment": "cutie mark", - "texture": { "u": 4, "v": 0 }, - "mirror": [ false, false, true ], - "face": "east", - "position": [ -4, -4, 4 ], "size": [ 8, 4 ] - }, - { - "type": "mson:plane", "__comment": "stomach", - "texture": { "u": 56, "v": 0 }, - "face": "down", - "position": [ -4, 4, -4 ], - "size": [ 8, 8 ] - }, - { - "type": "mson:plane", "__comment": "butt", - "texture": { "u": 36, "v": 16 }, - "face": "south", - "position": [ -4, -4, 8 ], "size": [ 8, 4 ] - }, - { - "type": "mson:plane", "__comment": "butt", - "texture": { "u": 36, "v": 16 }, - "face": "south", - "position": [ -4, 0, 8 ], - "size": [ 8, 4 ] - }, - { - "type": "mson:plane", "__comment": "butt", - "texture": { "u": 36, "v": 16 }, - "face": "down", - "position": [ -4, 4, 4 ], "size": [ 8, 4 ] - }, - { - "type": "mson:plane", "__comment": "back", - "texture": { "u": 32, "v": 20 }, - "mirror": [ false, false, true ], - "face": "up", - "position": [ -4, -4, -4 ], "size": [ 8, 12 ] - } - ], - "children": [ - { - "type": "mson:planar", - "texture": { "u": 32, "v": 0 }, - "rotate": [0.5, 0, 0], - "up": [-1, 2, 2, 2, 6], - "down": [-1, 4, 2, 2, 6], - "east": [ 1, 2, 2, 2, 6], - "south":[-1, 2, 8, 2, 2], - "cubes": [ - { - "type": "mson:plane", - "mirror": [ false, false, true ], - "face": "west", - "position": [ -1, -2, -2 ], "size": [ 2, 6 ] - } - ] - } - ] - }, - "neck": { - "type": "mson:planar", - "texture": { "u": 0, "v": 16 }, - "rotate": [0.166, 0, 0], - "north": [-2, 1.199998, -2.8, 4, 4], - "south": [-2, 1.199998, 1.2, 4, 4], - "east": [ 2, 1.199998, -2.8, 4, 4], - "west": [-2, 1.199998, -2.8, 4, 4] - }, - "jacket": { - "texture": { "u": 16, "v": 32 }, - "cubes": [ - { "from": [-4, 0, -2], "size": [ 8, 12, 4], "stretch": 0.25 }, - { "from": [-4, 4, -2], "size": [ 8, 8, 4 ], "stretch": 0.25 } - ] - }, - "saddle": { - "texture": { "u": 24, "v": 0 }, - "offset": [0, 8, 6], - "cubes": [ - { - "type": "mson:plane", "__comment": "body sides a", - "texture": { "u": 12, "v": 32 }, - "face": "east", - "position": [ 4, -4, -4 ], "size": [ 4, 8 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "body sides a", - "texture": { "u": 12, "v": 32 }, - "mirror": [ false, false, true ], - "face": "west", - "position": [ -4, -4, -4 ], "size": [ 4, 8 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "body sides b", - "texture": { "u": 12, "v": 48 }, - "face": "east", - "position": [ 4, 0, -4 ], "size": [ 4, 8 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "body sides b", - "mirror": [ false, false, true ], - "texture": { "u": 12, "v": 48 }, - "face": "west", - "position": [ -4, 0, -4 ], "size": [ 4, 8 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "qt mark a", - "texture": { "u": 0, "v": 32 }, - "face": "east", - "position": [ 4, -4, 4 ], "size": [ 4, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "qt mark a", - "mirror": [ false, false, true ], - "texture": { "u": 0, "v": 32 }, - "face": "west", - "position": [ -4, -4, 4 ], "size": [ 4, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "qt mark b", - "texture": { "u": 0, "v": 48 }, - "face": "east", - "position": [ 4, 0, 4 ], "size": [ 4, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "qt mark b", - "texture": { "u": 0, "v": 48 }, - "face": "west", - "position": [ -4, 0, 4 ], "size": [ 4, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "stomach a", - "texture": { "u": 28, "v": 48 }, - "face": "down", - "position": [ -4, 4, -4 ], "size": [ 8, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "stomach b", - "texture": { "u": 44, "v": 48 }, - "face": "down", - "position": [ -4, 4, 0 ], "size": [ 8, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "stomach c", - "texture": { "u": 36, "v": 32 }, - "face": "down", - "position": [ -4, 4, 4 ], "size": [ 8, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "butt", - "texture": { "u": 36, "v": 32 }, - "face": "south", - "position": [ -4, -4, 8 ], "size": [ 8, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "butt", - "texture": { "u": 36, "v": 32 }, - "face": "south", - "position": [ -4, 0, 8 ], "size": [ 8, 4 ], "stretch": 0.25 - }, - { - "type": "mson:plane", "__comment": "back", - "texture": { "u": 32, "v": 36 }, - "face": "up", - "position": [ -4, -4, -4 ], "size": [ 8, 12 ], "stretch": 0.25 - } - ] - }, - "tail": { - "type": "mson:slot", - "name": "tail", - "implementation": "com.minelittlepony.client.model.part.PonyTail", - "content": "minelittlepony:components/tail" - }, - "right_arm": { - "center": ["#arm_rotation_x_neg", "#arm_rotation_y", 0], - "texture": { "u": 40, "v": 16 }, - "cubes": [ - { - "from": [ "#arm_x_neg", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ] - } - ] - }, - "left_arm": { - "center": ["#arm_rotation_x", "#arm_rotation_y", 0], - "texture": { "u": 32, "v": 48 }, - "cubes": [ - { - "from": [ "#arm_x", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ] - } - ] - }, - "right_leg": { - "center": ["#arm_rotation_x_neg", 0, 0], - "texture": { "u": 0, "v": 16 }, - "cubes": [ - { - "from": [ "#arm_x_neg", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ] - } - ] - }, - "left_leg": { - "center": ["#arm_rotation_x", 0, 0], - "texture": { "u": 16, "v": 48 }, - "cubes": [ - { - "from": [ "#arm_x", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ] - } - ] - }, - "right_sleeve": { - "center": ["#arm_rotation_x_neg", "#arm_rotation_y", 0], - "texture": { "u": 40, "v": 32 }, - "cubes": [ - { - "from": [ "#arm_x_neg", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ], - "stretch": 0.25 - } - ] - }, - "left_sleeve": { - "center": ["#arm_rotation_x", "#arm_rotation_y", 0], - "texture": { "u": 48, "v": 48 }, - "cubes": [ - { - "from": [ "#arm_x", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ], - "stretch": 0.25 - } - ] - }, - "right_pant_leg": { - "center": ["#arm_rotation_x_neg", 0, 0], - "texture": { "u": 0, "v": 32 }, - "cubes": [ - { - "from": [ "#arm_x_neg", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ], - "stretch": 0.25 - } - ] - }, - "left_pant_leg": { - "center": ["#arm_rotation_x", 0, 0], - "texture": { "u": 0, "v": 48 }, - "cubes": [ - { - "from": [ "#arm_x", 4, "#arm_z"], - "size": [ "#arm_width", "#arm_length", "#arm_depth" ], - "stretch": 0.25 - } - ] - } -} diff --git a/src/main/resources/assets/minelittlepony/models/armour_inner.json b/src/main/resources/assets/minelittlepony/models/armour_inner.json new file mode 100644 index 00000000..705181a1 --- /dev/null +++ b/src/main/resources/assets/minelittlepony/models/armour_inner.json @@ -0,0 +1,106 @@ +{ + "parent": "minelittlepony:steve_pony", + "scale": 0.25, + "chestpiece": { + "texture": {"u": 16, "v": 8}, + "cubes": [ + {"from": [-4, 4, -2], "size": [8, 8, 16]} + ] + }, + "head": { + "offset": [ 0, -1, -2 ], + "center": [ 0, 0, -2 ], + "cubes": [ + { "from": [-4, -4, -4], "size": [ 8, 8, 8] }, + { "from": [-4, -6, -1], "size": [ 2, 2, 2], "texture": {"u": 0, "v": 0}, "stretch": -0.125 }, + { "from": [ 2, -6, -1], "size": [ 2, 2, 2], "texture": {"u": 0, "v": 4}, "stretch": -0.125 } + ], + "children": [ + { + "type": "mson:slot", + "name": "snout", + "implementation": "com.minelittlepony.client.model.part.PonySnout", + "content": "minelittlepony:components/snout" + }, + { + "type": "mson:slot", + "name": "ears", + "implementation": "com.minelittlepony.client.model.part.PonyEars", + "content": "minelittlepony:components/ears" + } + ] + }, + "upper_torso": { + "type": "mson:planar", + "texture": {"u": 24, "v": 0}, + "offset": [0, 8, 6], + "east": [4, -4, -4, 8, 8, 32, 32], + "west": [-4, -4, -4, 8, 8, 32, 23], + "south": [-4, -4, 4, 8, 8, 32, 23], + "up": [-4, -4, -8, 8, 12, 32, 23], + "__comment": "it's a little short, so the butt tends to show. :/" + }, + "right_arm": { + "center": ["#arm_rotation_x_neg", "#arm_rotation_y", 0], + "texture": { "u": 0, "v": 16 }, + "cubes": [ + { + "from": [ "#arm_x_neg", 4, "#arm_z"], + "size": [ "#arm_width", "#arm_length", "#arm_depth" ] + } + ] + }, + "left_arm": { + "center": ["#arm_rotation_x", "#arm_rotation_y", 0], + "mirror": true, + "texture": { "u": 0, "v": 16 }, + "cubes": [ + { + "from": [ "#arm_x", 4, "#arm_z"], + "size": [ "#arm_width", "#arm_length", "#arm_depth" ] + } + ] + }, + "right_leg": { + "center": ["#arm_rotation_x_neg", 0, 0], + "texture": { "u": 48, "v": 8 }, + "cubes": [ + { + "from": [ "#arm_x_neg", 4, "#arm_z"], + "size": [ "#arm_width", "#arm_length", "#arm_depth" ] + } + ] + }, + "left_leg": { + "center": ["#arm_rotation_x", 0, 0], + "mirror": true, + "texture": { "u": 48, "v": 8 }, + "cubes": [ + { + "from": [ "#arm_x", 4, "#arm_z"], + "size": [ "#arm_width", "#arm_length", "#arm_depth" ] + } + ] + }, + "steve_right_leg": { + "center": ["#arm_rotation_x_neg", 0, 0], + "texture": { "u": 0, "v": 16 }, + "cubes": [ + { + "from": [ "#arm_x_neg", 4, "#arm_z"], + "size": [ "#arm_width", "#arm_length", "#arm_depth" ] + } + ] + }, + "steve_left_leg": { + "center": ["#arm_rotation_x", 0, 0], + "mirror": true, + "texture": { "u": 0, "v": 16 }, + "cubes": [ + { + "from": [ "#arm_x", 4, "#arm_z"], + "size": [ "#arm_width", "#arm_length", "#arm_depth" ] + } + ] + } +} diff --git a/src/main/resources/assets/minelittlepony/models/armour_outer.json b/src/main/resources/assets/minelittlepony/models/armour_outer.json new file mode 100644 index 00000000..44c787aa --- /dev/null +++ b/src/main/resources/assets/minelittlepony/models/armour_outer.json @@ -0,0 +1,4 @@ +{ + "parent": "minelittlepony:armour_inner", + "scale": 0.125 +}