From aa933861c4c59c9a6fa9a41f8bf455a44b16b173 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 29 Mar 2023 00:37:03 +0100 Subject: [PATCH] Fixed saddlebags using the wrong texture for changelings --- .../com/minelittlepony/api/pony/meta/Race.java | 17 +++++++++++++++-- .../client/hdskins/MineLPHDSkins.java | 2 +- .../client/model/part/PonyWings.java | 7 ++----- .../render/entity/PlayerPonyRenderer.java | 6 +----- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/minelittlepony/api/pony/meta/Race.java b/src/main/java/com/minelittlepony/api/pony/meta/Race.java index b7cc0030..0f244389 100644 --- a/src/main/java/com/minelittlepony/api/pony/meta/Race.java +++ b/src/main/java/com/minelittlepony/api/pony/meta/Race.java @@ -36,7 +36,6 @@ public enum Race implements TriggerPixelType { /** * Returns true if this pony has a horn (and by extension can cast magic). - * @return */ public boolean hasHorn() { return horn; @@ -50,12 +49,26 @@ public enum Race implements TriggerPixelType { } /** - * Returns true if this is a human. + * Returns true if this a changeling or reformed changeling. + */ + public boolean hasBugWings() { + return this == CHANGELING || this == CHANGEDLING; + } + + /** + * Returns true if this is not a pony. */ public boolean isHuman() { return this == HUMAN; } + /** + * Returns true if the model allows embedding saddlebags in the main body texture. + */ + public boolean supportsLegacySaddlebags() { + return !(this == BATPONY || hasBugWings()); + } + @Override public int getColorCode() { return triggerPixel; diff --git a/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java b/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java index 45e188dc..3e21a8b1 100644 --- a/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java +++ b/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java @@ -106,7 +106,7 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { IPonyData metadata = IPony.getManager().getPony(main.getId()).metadata(); if (wearable != Wearable.NONE && metadata.isWearing(wearable)) { - if (wearable.isSaddlebags() && metadata.getRace() != Race.BATPONY) { + if (wearable.isSaddlebags() && metadata.getRace().supportsLegacySaddlebags()) { return Optional.of(main.getId()); } diff --git a/src/main/java/com/minelittlepony/client/model/part/PonyWings.java b/src/main/java/com/minelittlepony/client/model/part/PonyWings.java index 8d047ec3..71b21905 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonyWings.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonyWings.java @@ -7,7 +7,6 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.MathHelper; import com.minelittlepony.api.model.*; -import com.minelittlepony.api.pony.meta.Race; import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.mson.api.ModelView; import com.minelittlepony.mson.api.MsonModel; @@ -120,16 +119,14 @@ public class PonyWings implements IPart, MsonModel { public void rotateWalking(float swing) { folded.yaw = swing * walkingRotationSpeed; - Race race = pegasus.getMetadata().getRace(); - if (race == Race.CHANGELING || race == Race.CHANGEDLING) { + if (pegasus.getMetadata().getRace().hasBugWings()) { extended.yaw = folded.yaw; } } public void rotateFlying(float roll) { extended.roll = roll; - Race race = pegasus.getMetadata().getRace(); - if (race == Race.CHANGELING || race == Race.CHANGEDLING) { + if (pegasus.getMetadata().getRace().hasBugWings()) { folded.roll = roll; } } diff --git a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java index c6035c37..e90b5bc5 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java @@ -2,7 +2,6 @@ package com.minelittlepony.client.render.entity; import com.minelittlepony.api.model.ModelAttributes; import com.minelittlepony.api.pony.IPony; -import com.minelittlepony.api.pony.meta.Race; import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.client.SkinsProxy; import com.minelittlepony.client.model.*; @@ -183,10 +182,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen @Override public Identifier getDefaultTexture(AbstractClientPlayerEntity entity, Wearable wearable) { return SkinsProxy.instance.getSkin(wearable.getId(), entity).orElseGet(() -> { - if (wearable.isSaddlebags()) { - if (getInternalRenderer().getModel().getMetadata().getRace() == Race.BATPONY) { - return wearable.getDefaultTexture(); - } + if (wearable.isSaddlebags() && getInternalRenderer().getModel().getMetadata().getRace().supportsLegacySaddlebags()) { return manager.getTexture(entity); }