mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Fix minor memory leaks (#258)
* Fix memory leak caused by mob spawner items
* Use a weak hash map instead of manually clearing the map
* Clear manager reference to prevent holding a WorldClient reference through the GUI
* Revert "Use a weak hash map instead of manually clearing the map"
This reverts commit 91bb997250.
This commit is contained in:
1 parent
d20a80a77c
commit
de2b2ece69
2 files changed
+10
No files matched your search
@@ -299,6 +299,10 @@ public class ClientHandler
|
||||
lastworld = null;
|
||||
else if (gui instanceof GuiSelectWorld)
|
||||
NEIClientConfig.reloadSaves();
|
||||
else if(gui == null) {
|
||||
/* prevent WorldClient reference being held in the Gui */
|
||||
NEIController.manager = null;
|
||||
}
|
||||
}
|
||||
lastGui = gui;
|
||||
}
|
||||
@@ -328,6 +332,8 @@ public class ClientHandler
|
||||
|
||||
if (!Minecraft.getMinecraft().isSingleplayer())//wait for server to initiate in singleplayer
|
||||
NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~'));
|
||||
|
||||
ItemMobSpawner.clearEntityReferences(world);
|
||||
}
|
||||
|
||||
lastworld = world;
|
||||
|
||||
@@ -96,6 +96,10 @@ public class ItemMobSpawner extends ItemBlock
|
||||
return e;
|
||||
}
|
||||
|
||||
public static void clearEntityReferences(World newWorld) {
|
||||
entityHashMap.values().removeIf(e -> e.worldObj != newWorld);
|
||||
}
|
||||
|
||||
private void setDefaultTag(ItemStack itemstack) {
|
||||
if (!IDtoNameMap.containsKey(itemstack.getItemDamage()))
|
||||
itemstack.setItemDamage(idPig);
|
||||
|
||||
Reference in new issue
Block a user