mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 12:52:19 +00:00
Fix CME (#1008)
This commit is contained in:
1 parent
e7fa7f62d0
commit
97ae04c2fa
1 file changed
+8
-10
@@ -311,20 +311,18 @@ public class TexturePackAPI {
|
||||
public static void flushUnusedTextures() {
|
||||
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
|
||||
if (textureManager != null) {
|
||||
Set<ResourceLocation> texturesToUnload = new HashSet<>();
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<Map.Entry<ResourceLocation, ITextureObject>> entrySet = textureManager.mapTextureObjects.entrySet();
|
||||
for (Map.Entry<ResourceLocation, ITextureObject> entry : entrySet) {
|
||||
ResourceLocation resource = entry.getKey();
|
||||
Map.Entry<ResourceLocation, ITextureObject>[] arr = (Map.Entry<ResourceLocation, ITextureObject>[])
|
||||
textureManager.mapTextureObjects.entrySet().toArray(new Map.Entry[0]);
|
||||
for (Map.Entry<ResourceLocation, ITextureObject> entry : arr) {
|
||||
ITextureObject texture = entry.getValue();
|
||||
if (texture instanceof SimpleTexture && !(texture instanceof ThreadDownloadImageData)
|
||||
&& !TexturePackAPI.hasResource(resource)) {
|
||||
texturesToUnload.add(resource);
|
||||
if (texture instanceof SimpleTexture && !(texture instanceof ThreadDownloadImageData)) {
|
||||
ResourceLocation resource = entry.getKey();
|
||||
if (!TexturePackAPI.hasResource(resource)) {
|
||||
unloadTexture(resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ResourceLocation resource : texturesToUnload) {
|
||||
unloadTexture(resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user