mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 20:47: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.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Mixin(NetworkPlayerInfo.class)
|
@Mixin(NetworkPlayerInfo.class)
|
||||||
public abstract class MixinPlayerInfo implements INetworkPlayerInfo {
|
public abstract class MixinPlayerInfo implements INetworkPlayerInfo {
|
||||||
|
|
||||||
|
|
||||||
private Map<Type, ResourceLocation> customTextures = new HashMap<>();
|
private Map<Type, ResourceLocation> customTextures = new HashMap<>();
|
||||||
private Map<Type, MinecraftProfileTexture> customProfiles = new HashMap<>();
|
private Map<Type, MinecraftProfileTexture> customProfiles = new HashMap<>();
|
||||||
|
|
||||||
@Shadow @Final private GameProfile gameProfile;
|
@Shadow @Final private GameProfile gameProfile;
|
||||||
|
@Shadow Map<Type, ResourceLocation> playerTextures;
|
||||||
@Shadow public abstract String getSkinType();
|
@Shadow private boolean playerTexturesLoaded;
|
||||||
|
@Shadow private String skinType;
|
||||||
|
|
||||||
@SuppressWarnings("InvalidMemberReference") // mc-dev bug?
|
@SuppressWarnings("InvalidMemberReference") // mc-dev bug?
|
||||||
@Redirect(
|
@Redirect(
|
||||||
|
@ -88,8 +89,14 @@ public abstract class MixinPlayerInfo implements INetworkPlayerInfo {
|
||||||
@Override
|
@Override
|
||||||
public void deleteTextures() {
|
public void deleteTextures() {
|
||||||
TextureManager tm = Minecraft.getMinecraft().getTextureManager();
|
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.customTextures.clear();
|
||||||
this.customProfiles.clear();
|
this.customProfiles.clear();
|
||||||
|
this.playerTextures.clear();
|
||||||
|
|
||||||
|
this.skinType = null;
|
||||||
|
|
||||||
|
this.playerTexturesLoaded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue