Add experimental option to skip hd skins when showing players as humans

This commit is contained in:
Sollace 2023-09-27 01:27:20 +01:00
parent 2c6c23d05c
commit 6013fa2ad5
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
5 changed files with 33 additions and 7 deletions

View file

@ -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

View file

@ -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<Boolean> horsieMode = value("settings", "horsieMode", false)
.addComment("Enables the alternative horsey models from the April Fools 2023 update");
public final Setting<Boolean> 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<SizePreset> sizeOverride = value("debug", "sizeOverride", SizePreset.UNSET)
.addComment("Overrides pony sizes")
@ -69,6 +73,7 @@ public class PonyConfig extends Config {
public final Setting<Boolean> flappyElytras = value("customisation", "flappyElytras", false)
.addComment("Pegasi will use their wings to fly even when they're wearing an elytra");
public final Setting<Boolean> 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");

View file

@ -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();

View file

@ -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

View file

@ -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",