From c68d484d429d961732e939c6304629030ac49860 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 15 Feb 2023 16:27:11 +0000 Subject: [PATCH] Fixed rendering of legacy pony armour --- .../api/model/armour/ArmourRegistry.java | 1 + .../minelittlepony/api/model/armour/IArmour.java | 1 + .../api/model/armour/IArmourTextureResolver.java | 3 +++ .../client/model/armour/PonyArmourModel.java | 11 +++-------- .../render/entity/feature/ArmourFeature.java | 5 +---- .../assets/minelittlepony/models/armour_inner.json | 14 ++++++++++---- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/minelittlepony/api/model/armour/ArmourRegistry.java b/src/main/java/com/minelittlepony/api/model/armour/ArmourRegistry.java index 7b5db3df..9a044eaa 100644 --- a/src/main/java/com/minelittlepony/api/model/armour/ArmourRegistry.java +++ b/src/main/java/com/minelittlepony/api/model/armour/ArmourRegistry.java @@ -6,6 +6,7 @@ import net.minecraft.util.Identifier; import com.mojang.serialization.Lifecycle; +@Deprecated public final class ArmourRegistry { private ArmourRegistry() {} static final Registry> REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("minelittlepony", "armour")), Lifecycle.stable()); diff --git a/src/main/java/com/minelittlepony/api/model/armour/IArmour.java b/src/main/java/com/minelittlepony/api/model/armour/IArmour.java index 6864cf3a..c6b4c123 100644 --- a/src/main/java/com/minelittlepony/api/model/armour/IArmour.java +++ b/src/main/java/com/minelittlepony/api/model/armour/IArmour.java @@ -14,6 +14,7 @@ import com.minelittlepony.api.pony.IPonyData; * * @param The type of the contained armour model. */ +@Deprecated public interface IArmour extends IModelWrapper { /** * Registers a custom armour for the supplied item. diff --git a/src/main/java/com/minelittlepony/api/model/armour/IArmourTextureResolver.java b/src/main/java/com/minelittlepony/api/model/armour/IArmourTextureResolver.java index cbd7158f..a55b6249 100644 --- a/src/main/java/com/minelittlepony/api/model/armour/IArmourTextureResolver.java +++ b/src/main/java/com/minelittlepony/api/model/armour/IArmourTextureResolver.java @@ -7,12 +7,15 @@ import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; +import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver; + /** * A resolver for looking up the texture for a piece of armour. *

* This is for modders who want to override the default implementation found in {@link DefaultArmourTextureResolver}. */ public interface IArmourTextureResolver { + IArmourTextureResolver DEFAULT = new DefaultArmourTextureResolver(); /** * Gets the armour texture to be used for the given entity, armour piece, slot, and render layer. diff --git a/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java b/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java index ea6b48ad..bcced715 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java +++ b/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java @@ -90,8 +90,6 @@ public class PonyArmourModel extends AbstractPonyModel extends AbstractPonyModel & IPonyModel> extends AbstractPonyFeature { - private static final IArmourTextureResolver DEFAULT = new DefaultArmourTextureResolver(); - public ArmourFeature(IPonyRenderContext renderer) { super(renderer); } @@ -84,7 +81,7 @@ public class ArmourFeature & IP blue = Color.b(color); } - IArmourTextureResolver resolver = armour.getTextureResolver(DEFAULT); + IArmourTextureResolver resolver = armour.getTextureResolver(IArmourTextureResolver.DEFAULT); boolean glint = itemstack.hasGlint(); diff --git a/src/main/resources/assets/minelittlepony/models/armour_inner.json b/src/main/resources/assets/minelittlepony/models/armour_inner.json index 80cb4e02..46a2207b 100644 --- a/src/main/resources/assets/minelittlepony/models/armour_inner.json +++ b/src/main/resources/assets/minelittlepony/models/armour_inner.json @@ -3,6 +3,12 @@ "texture": {"w": 64, "h": 32}, "dilate": 0.27, "data": { + "body": { + "texture": { "u": 16, "v": 18 }, + "cubes": [ + { "from": [-4, 4, -2], "size": [ 8, 8, 4] } + ] + }, "chestpiece": { "texture": {"u": 16, "v": 8}, "cubes": [ @@ -19,10 +25,10 @@ "upper_torso": { "type": "mson:planar", "texture": {"u": 24, "v": 0}, - "east": [4, 4, 2, 8, 8, 32, 32], - "west": [-4, 4, 2, 8, 8, 23, 32], - "south": [-4, 4,10, 8, 8, 32, 23], - "up": [-4, 4, -2, 8, 12, 32, 23], + "east": [ 4, 4, 2, 8, 8, 32, 23], + "west": [ -4, 4, 2, 8, 8, 32, 23], + "south": [-4, 4, 10, 8, 8, 32, 23], + "up": [ -4, 4, 1, 8, 12, 32, 23], "__comment": "it's a little short, so the butt tends to show. :/" }, "right_arm": {