diff --git a/gradle.properties b/gradle.properties index d73f68a4..68318cf1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,5 +22,5 @@ org.gradle.daemon=false # Dependencies modmenu_version=8.0.0-beta.1 kirin_version=1.16.0-beta.3+1.20.2 - hd_skins_version=6.11.0-beta.4+1.20.2 + hd_skins_version=6.11.0-beta.6+1.20.2 mson_version=1.9.0-beta.1 diff --git a/src/main/java/com/minelittlepony/api/config/PonyConfig.java b/src/main/java/com/minelittlepony/api/config/PonyConfig.java index 10037467..6a1d4b2a 100644 --- a/src/main/java/com/minelittlepony/api/config/PonyConfig.java +++ b/src/main/java/com/minelittlepony/api/config/PonyConfig.java @@ -54,6 +54,10 @@ public class PonyConfig extends Config { .addComment("Helps to prevent entities from vanishing when they're in long stacks"); public final Setting horsieMode = value("settings", "horsieMode", false) .addComment("Enables the alternative horsey models from the April Fools 2023 update"); + public final Setting mixedHumanSkins = value("settings", "mixedHumanSkins", false) + .addComment("(Experimental) When displaying humans, use mojang's skin server instead.") + .addComment("(Experimental) Only takes effect on pony level = HUMANS") + .addComment("(Experimental) Will cause the vanilla skin to show if the hd skin is a pony skin"); public final Setting sizeOverride = value("debug", "sizeOverride", SizePreset.UNSET) .addComment("Overrides pony sizes") @@ -69,6 +73,7 @@ public class PonyConfig extends Config { public final Setting flappyElytras = value("customisation", "flappyElytras", false) .addComment("Pegasi will use their wings to fly even when they're wearing an elytra"); + public final Setting noFun = value("customisation", "noFun", false) .addComment("Disables certain easter eggs and secrets (party pooper)") .addComment("Turning this off may help with compatibility in some cases"); diff --git a/src/main/java/com/minelittlepony/client/SkinsProxy.java b/src/main/java/com/minelittlepony/client/SkinsProxy.java index 85dac3a2..ab75877c 100644 --- a/src/main/java/com/minelittlepony/client/SkinsProxy.java +++ b/src/main/java/com/minelittlepony/client/SkinsProxy.java @@ -21,7 +21,6 @@ public class SkinsProxy { public static SkinsProxy instance = new SkinsProxy(); - @Nullable public Identifier getSkinTexture(GameProfile profile) { PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider(); return skins.getSkinTextures(profile).texture(); diff --git a/src/main/java/com/minelittlepony/client/compat/hdskins/MineLPHDSkins.java b/src/main/java/com/minelittlepony/client/compat/hdskins/MineLPHDSkins.java index 0f232bfb..47c6d548 100644 --- a/src/main/java/com/minelittlepony/client/compat/hdskins/MineLPHDSkins.java +++ b/src/main/java/com/minelittlepony/client/compat/hdskins/MineLPHDSkins.java @@ -1,5 +1,7 @@ package com.minelittlepony.client.compat.hdskins; +import com.minelittlepony.api.config.PonyConfig; +import com.minelittlepony.api.config.PonyLevel; import com.minelittlepony.api.pony.Pony; import com.minelittlepony.api.pony.PonyData; import com.minelittlepony.api.pony.meta.Wearable; @@ -56,6 +58,25 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { // Ponify the skins GUI. GuiSkins.setSkinsGui(GuiSkinsMineLP::new); }); + + HDSkins.getInstance().getSkinPrioritySorter().addSelector((skinType, playerSkins) -> { + if (skinType == SkinType.SKIN && PonyConfig.getInstance().mixedHumanSkins.get()) { + PonyLevel level = PonyConfig.getInstance().ponyLevel.get(); + + if (level == PonyLevel.HUMANS && isPony(playerSkins.hd()) && !isPony(playerSkins.vanilla())) { + return playerSkins.vanilla(); + } + } + return playerSkins.combined(); + }); + } + + static boolean isPony(PlayerSkins.Layer layer) { + return layer + .getSkin(SkinType.SKIN) + .map(Pony.getManager()::getPony) + .filter(pony -> !pony.metadata().race().isHuman()) + .isPresent(); } @Override @@ -80,10 +101,10 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { } if (entity instanceof AbstractClientPlayerEntity player) { - PlayerSkins skins = PlayerSkins.of(player); - if (skins != null) { - return skins.combined().getProvidedSkinTypes(); - } + return PlayerSkins.of(player) + .map(PlayerSkins::combined) + .map(PlayerSkins.Layer::getProvidedSkinTypes) + .orElseGet(Set::of); } return Set.of(); @@ -110,7 +131,7 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { } } - return Optional.of(player).map(PlayerSkins::of).flatMap(skins -> skins.combined().getSkin(type)); + return Optional.of(player).flatMap(PlayerSkins::of).map(PlayerSkins::combined).flatMap(skins -> skins.getSkin(type)); } @Override diff --git a/src/main/resources/assets/minelittlepony/lang/en_us.json b/src/main/resources/assets/minelittlepony/lang/en_us.json index dad78e0e..393149ba 100644 --- a/src/main/resources/assets/minelittlepony/lang/en_us.json +++ b/src/main/resources/assets/minelittlepony/lang/en_us.json @@ -23,6 +23,7 @@ "minelp.options.flappyelytras": "Flap Wings whilst Gliding", "minelp.options.horsiemode": "Horsey Horse Mode", "minelp.options.nofun": "Boring Mode", + "minelp.options.mixedhumanskins": "(Experimental) Vanilla Humans", "minelp.options.button": "Display On Title Screen", "minelp.options.button.on": "Always Display\n\nBoth the pony button and HD Skins button are visible (if installed)", "minelp.options.button.auto": "Display only when HD Skins is not installed",