mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 14:27:59 +01:00
Clear all skins and actually re-load them when clearing the cache.
This commit is contained in:
parent
c10c61b73b
commit
ca48785add
1 changed files with 11 additions and 4 deletions
|
@ -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<Type, ResourceLocation> customTextures = new HashMap<>();
|
||||
private Map<Type, MinecraftProfileTexture> customProfiles = new HashMap<>();
|
||||
|
||||
@Shadow @Final private GameProfile gameProfile;
|
||||
|
||||
@Shadow public abstract String getSkinType();
|
||||
@Shadow Map<Type, ResourceLocation> 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue