diff --git a/src/main/java/com/minelittlepony/api/pony/meta/Wearable.java b/src/main/java/com/minelittlepony/api/pony/meta/Wearable.java index 40a95498..017b6fc2 100644 --- a/src/main/java/com/minelittlepony/api/pony/meta/Wearable.java +++ b/src/main/java/com/minelittlepony/api/pony/meta/Wearable.java @@ -7,6 +7,8 @@ import com.minelittlepony.client.model.gear.SaddleBags; import com.minelittlepony.common.util.Color; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; public enum Wearable implements TriggerPixelType { NONE (0x00, null), @@ -26,6 +28,7 @@ public enum Wearable implements TriggerPixelType { private final Identifier texture; public static final List VALUES = Arrays.stream(values()).toList(); + public static final Map REGISTRY = VALUES.stream().collect(Collectors.toMap(Wearable::getId, Function.identity())); Wearable(int pixel, Identifier texture) { triggerValue = pixel; diff --git a/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java b/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java index 151723b3..e406e5a8 100644 --- a/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java +++ b/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.hdskins; +import com.minelittlepony.api.pony.IPony; import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.SkinsProxy; @@ -8,6 +9,7 @@ import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.common.event.ClientReadyCallback; import com.minelittlepony.hdskins.client.*; import com.minelittlepony.hdskins.client.dummy.DummyPlayer; +import com.minelittlepony.hdskins.client.dummy.PlayerSkins.PlayerSkin; import com.minelittlepony.hdskins.client.gui.GuiSkins; import com.minelittlepony.hdskins.profile.SkinType; @@ -91,7 +93,16 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { private Optional getSkin(SkinType type, AbstractClientPlayerEntity player) { if (player instanceof DummyPlayer dummy) { - return Optional.of(dummy.getTextures().get(type).getId()); + PlayerSkin skin = dummy.getTextures().get(type); + + if (skin.isReady()) { + return Optional.of(skin.getId()); + } + + PlayerSkin main = dummy.getTextures().get(SkinType.SKIN); + if (IPony.getManager().getPony(main.getId()).metadata().isWearing(Wearable.REGISTRY.getOrDefault(type.getId(), Wearable.NONE))) { + return Optional.of(main.getId()); + } } return Optional.of(player).map(PlayerSkins::of).map(skins -> skins.getSkin(type));