From ff5def481fc187c81a54f7aa5729e1f941b84ca0 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 10 May 2024 14:21:42 +0600 Subject: [PATCH] (fix) 3d skins with custom skins --- .../mixins/AbstractClientPlayerMixin.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java index bf2231c..07d73d8 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/AbstractClientPlayerMixin.java @@ -92,6 +92,26 @@ public abstract class AbstractClientPlayerMixin implements AbstractClientPlayerE } } + @Inject(method = "hasSkin", at = @At("HEAD"), cancellable = true) + public void mixinHasSkin(CallbackInfoReturnable cir) { + if(Minecraft.getMinecraft().currentScreen instanceof AdminRender) { + cir.setReturnValue(true); + cir.cancel(); + } + + if(Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Custom Skins").getValBoolean() && this.silent$getAccount() != null && this.silent$getAccount().getCustomSkin()) { + if(!CustomSkin.skins.containsKey(silent$nameClear.toLowerCase())) { + Client.logger.info(String.format("Custom Skin not found in cache! Putting Custom Skin to cache. (%s)", silent$nameClear)); + CustomSkin.skins.put(silent$nameClear.toLowerCase(), new CustomSkin()); + } + CustomSkin customSkin = CustomSkin.skins.get(silent$nameClear.toLowerCase()); + if(customSkin.getLocation() != null) { + cir.setReturnValue(true); + cir.cancel(); + } + } + } + @Inject(method = "getLocationSkin()Lnet/minecraft/util/ResourceLocation;", at = @At("HEAD"), cancellable = true) public void mixinSkinLocation(CallbackInfoReturnable cir) { if(Minecraft.getMinecraft().currentScreen instanceof AdminRender) {