From de7253594fd4eb9325ffbad2c2afb940e73beabf Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 10 Dec 2022 21:16:37 +0000 Subject: [PATCH] Update hdskins --- gradle.properties | 2 +- .../client/hdskins/MineLPHDSkins.java | 23 +++++-------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/gradle.properties b/gradle.properties index a251767d..08620377 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,5 +22,5 @@ org.gradle.daemon=false # Dependencies modmenu_version=5.0.0-alpha.3 kirin_version=1.13.0-beta.3 - hd_skins_version=6.7.0-beta.4 + hd_skins_version=6.7.0-beta.5 mson_version=1.7.0-beta.1 diff --git a/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java b/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java index fd2dcbfa..151723b3 100644 --- a/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java +++ b/src/main/java/com/minelittlepony/client/hdskins/MineLPHDSkins.java @@ -7,17 +7,13 @@ import com.minelittlepony.common.client.gui.ScrollContainer; import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.common.event.ClientReadyCallback; import com.minelittlepony.hdskins.client.*; -import com.minelittlepony.hdskins.client.ducks.ClientPlayerInfo; import com.minelittlepony.hdskins.client.dummy.DummyPlayer; import com.minelittlepony.hdskins.client.gui.GuiSkins; -import com.minelittlepony.hdskins.client.resources.LocalPlayerSkins; -import com.minelittlepony.hdskins.mixin.client.MixinClientPlayer; import com.minelittlepony.hdskins.profile.SkinType; import com.mojang.authlib.GameProfile; import java.util.*; -import java.util.stream.Collectors; import org.jetbrains.annotations.Nullable; @@ -80,21 +76,14 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { public Set getAvailableSkins(Entity entity) { if (entity instanceof DummyPlayer dummy) { - return SkinType.REGISTRY.stream() - .filter(type -> { - return dummy.getTextures().get(type).isReady() - || (dummy.getTextures().getPosture().getActiveSkinType() == type && dummy.getTextures() instanceof LocalPlayerSkins); - }) - .map(SkinType::getId) - .collect(Collectors.toSet()); + return dummy.getTextures().getProvidedSkinTypes(); } if (entity instanceof AbstractClientPlayerEntity player) { - PlayerSkins skins = ((ClientPlayerInfo)((MixinClientPlayer)player).getBackingClientData()).getSkins(); - return SkinType.REGISTRY.stream() - .filter(type -> skins.getSkin(type) != null) - .map(SkinType::getId) - .collect(Collectors.toSet()); + PlayerSkins skins = PlayerSkins.of(player); + if (skins != null) { + return skins.getProvidedSkinTypes(); + } } return Set.of(); @@ -105,7 +94,7 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer { return Optional.of(dummy.getTextures().get(type).getId()); } - return Optional.ofNullable(((ClientPlayerInfo)((MixinClientPlayer)player).getBackingClientData()).getSkins().getSkin(type)); + return Optional.of(player).map(PlayerSkins::of).map(skins -> skins.getSkin(type)); } @Override