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:
embeddedt authored and GitHub committed 2022-06-06 17:05:02 +02:00
1 parent d20a80a77c
commit de2b2ece69
2 files changed
+10

No files matched your search

@@ -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);