Fix memory leaks in EnchantmentHelper (MC-128547) (#4880)

This commit is contained in:
Ben Staddon 2018-05-17 07:12:18 +01:00 committed by LexManos
parent e742a3f598
commit 8fdc6eff07

View file

@ -1,6 +1,34 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
@@ -302,7 +302,7 @@
@@ -140,6 +140,7 @@
field_77520_b.field_77497_a = 0;
field_77520_b.field_77496_b = p_77508_1_;
func_77516_a(field_77520_b, p_77508_0_);
+ field_77520_b.field_77496_b = null; //Forge Fix memory leaks: https://bugs.mojang.com/browse/MC-128547
return field_77520_b.field_77497_a;
}
@@ -171,6 +172,9 @@
{
func_77518_a(field_151388_d, p_151384_0_.func_184614_ca());
}
+
+ field_151388_d.field_151363_b = null; //Forge Fix memory leaks: https://bugs.mojang.com/browse/MC-128547
+ field_151388_d.field_151364_a = null;
}
public static void func_151385_b(EntityLivingBase p_151385_0_, Entity p_151385_1_)
@@ -187,6 +191,9 @@
{
func_77518_a(field_151389_e, p_151385_0_.func_184614_ca());
}
+
+ field_151389_e.field_151366_a = null; //Forge Fix memory leaks: https://bugs.mojang.com/browse/MC-128547
+ field_151389_e.field_151365_b = null;
}
public static int func_185284_a(Enchantment p_185284_0_, EntityLivingBase p_185284_1_)
@@ -302,7 +309,7 @@
public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_)
{
Item item = p_77514_3_.func_77973_b();
@ -9,7 +37,7 @@
if (i <= 0)
{
@@ -357,7 +357,7 @@
@@ -357,7 +364,7 @@
{
List<EnchantmentData> list = Lists.<EnchantmentData>newArrayList();
Item item = p_77513_1_.func_77973_b();
@ -18,7 +46,7 @@
if (i <= 0)
{
@@ -413,7 +413,7 @@
@@ -413,7 +420,7 @@
for (Enchantment enchantment : Enchantment.field_185264_b)
{