From ca48785add488e3f934d42d89005537d2382d56c Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Fri, 24 Aug 2018 23:35:18 -0400 Subject: [PATCH] Clear all skins and actually re-load them when clearing the cache. --- .../hdskins/mixin/MixinPlayerInfo.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java index 858c3433..8a922e22 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java @@ -21,17 +21,18 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.HashMap; import java.util.Map; import java.util.Optional; +import java.util.stream.Stream; @Mixin(NetworkPlayerInfo.class) public abstract class MixinPlayerInfo implements INetworkPlayerInfo { - private Map customTextures = new HashMap<>(); private Map customProfiles = new HashMap<>(); @Shadow @Final private GameProfile gameProfile; - - @Shadow public abstract String getSkinType(); + @Shadow Map playerTextures; + @Shadow private boolean playerTexturesLoaded; + @Shadow private String skinType; @SuppressWarnings("InvalidMemberReference") // mc-dev bug? @Redirect( @@ -88,8 +89,14 @@ public abstract class MixinPlayerInfo implements INetworkPlayerInfo { @Override public void deleteTextures() { TextureManager tm = Minecraft.getMinecraft().getTextureManager(); - this.customTextures.values().forEach(tm::deleteTexture); + Stream.concat(this.customTextures.values().stream(), this.playerTextures.values().stream()) + .forEach(tm::deleteTexture); this.customTextures.clear(); this.customProfiles.clear(); + this.playerTextures.clear(); + + this.skinType = null; + + this.playerTexturesLoaded = false; } }