Skip to content

Commit

Permalink
Revert "Invalidate tile entities that are queued for removal (Minecra…
Browse files Browse the repository at this point in the history
…ftForge#5512)"

This reverts commit 75788f6.

This solution is invalid as TEs are free to modify the world tileEntities
list, usually indirectly via chunkloading, from inside invalidate().

This happens in vanilla, in TileEntityChest#invalidate, where it calls
checkForAdjacentChests(), which has the potential to load neighboring
chunks and cause a CME.

A more sophisticated solution is needed.
  • Loading branch information
tterrag1098 committed Apr 13, 2019
1 parent 3c426a2 commit 633fd9b
Showing 1 changed file with 31 additions and 37 deletions.
68 changes: 31 additions & 37 deletions patches/minecraft/net/minecraft/world/World.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -704,21 +704,15 @@
}
else
{
@@ -2289,11 +2483,13 @@
@@ -2289,6 +2483,7 @@

this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
+ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes
}

public void func_147457_a(TileEntity p_147457_1_)
{
this.field_147483_b.add(p_147457_1_);
+ p_147457_1_.func_145843_s(); // Forge: invalidate TE promptly as removal happens later
}

public boolean func_175665_u(BlockPos p_175665_1_)
@@ -2315,7 +2511,7 @@
@@ -2315,7 +2510,7 @@
if (chunk1 != null && !chunk1.func_76621_g())
{
IBlockState iblockstate1 = this.func_180495_p(p_175677_1_);
Expand All @@ -727,15 +721,15 @@
}
else
{
@@ -2338,6 +2534,7 @@
@@ -2338,6 +2533,7 @@
{
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
+ this.field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_);
}

public void func_72835_b()
@@ -2347,6 +2544,11 @@
@@ -2347,6 +2543,11 @@

protected void func_72947_a()
{
Expand All @@ -747,7 +741,7 @@
if (this.field_72986_A.func_76059_o())
{
this.field_73004_o = 1.0F;
@@ -2360,6 +2562,11 @@
@@ -2360,6 +2561,11 @@

protected void func_72979_l()
{
Expand All @@ -759,7 +753,7 @@
if (this.field_73011_w.func_191066_m())
{
if (!this.field_72995_K)
@@ -2484,6 +2691,11 @@
@@ -2484,6 +2690,11 @@

public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{
Expand All @@ -771,7 +765,7 @@
Biome biome = this.func_180494_b(p_175670_1_);
float f = biome.func_180626_a(p_175670_1_);

@@ -2525,6 +2737,11 @@
@@ -2525,6 +2736,11 @@

public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{
Expand All @@ -783,7 +777,7 @@
Biome biome = this.func_180494_b(p_175708_1_);
float f = biome.func_180626_a(p_175708_1_);

@@ -2542,7 +2759,7 @@
@@ -2542,7 +2758,7 @@
{
IBlockState iblockstate1 = this.func_180495_p(p_175708_1_);

Expand All @@ -792,7 +786,7 @@
{
return true;
}
@@ -2574,10 +2791,10 @@
@@ -2574,10 +2790,10 @@
else
{
IBlockState iblockstate1 = this.func_180495_p(p_175638_1_);
Expand All @@ -806,7 +800,7 @@
{
k2 = 1;
}
@@ -2589,7 +2806,7 @@
@@ -2589,7 +2805,7 @@

if (k2 >= 15)
{
Expand All @@ -815,7 +809,7 @@
}
else if (j2 >= 14)
{
@@ -2630,12 +2847,13 @@
@@ -2630,12 +2846,13 @@

public boolean func_180500_c(EnumSkyBlock p_180500_1_, BlockPos p_180500_2_)
{
Expand All @@ -830,7 +824,7 @@
int j2 = 0;
int k2 = 0;
this.field_72984_F.func_76320_a("getBrightness");
@@ -2673,7 +2891,7 @@
@@ -2673,7 +2890,7 @@
int l5 = MathHelper.func_76130_a(k4 - k3);
int i6 = MathHelper.func_76130_a(l4 - l3);

Expand All @@ -839,7 +833,7 @@
{
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s();

@@ -2683,7 +2901,8 @@
@@ -2683,7 +2900,8 @@
int k6 = k4 + enumfacing.func_96559_d();
int l6 = l4 + enumfacing.func_82599_e();
blockpos$pooledmutableblockpos.func_181079_c(j6, k6, l6);
Expand All @@ -849,7 +843,7 @@
j5 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);

if (j5 == i5 - i7 && k2 < this.field_72994_J.length)
@@ -2725,7 +2944,7 @@
@@ -2725,7 +2943,7 @@
int j9 = Math.abs(i8 - l3);
boolean flag = k2 < this.field_72994_J.length - 6;

Expand All @@ -858,7 +852,7 @@
{
if (this.func_175642_b(p_180500_1_, blockpos2.func_177976_e()) < k8)
{
@@ -2791,10 +3010,10 @@
@@ -2791,10 +3009,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate <? super Entity > p_175674_3_)
{
List<Entity> list = Lists.<Entity>newArrayList();
Expand All @@ -873,7 +867,7 @@

for (int j3 = j2; j3 <= k2; ++j3)
{
@@ -2847,10 +3066,10 @@
@@ -2847,10 +3065,10 @@

public <T extends Entity> List<T> func_175647_a(Class <? extends T > p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate <? super T > p_175647_3_)
{
Expand All @@ -888,7 +882,7 @@
List<T> list = Lists.<T>newArrayList();

for (int j3 = j2; j3 < k2; ++j3)
@@ -2930,11 +3149,13 @@
@@ -2930,11 +3148,13 @@

public void func_175650_b(Collection<Entity> p_175650_1_)
{
Expand All @@ -905,7 +899,7 @@
}
}

@@ -2948,7 +3169,8 @@
@@ -2948,7 +3168,8 @@
IBlockState iblockstate1 = this.func_180495_p(p_190527_2_);
AxisAlignedBB axisalignedbb = p_190527_3_ ? null : p_190527_1_.func_176223_P().func_185890_d(this, p_190527_2_);

Expand All @@ -915,7 +909,7 @@
{
return false;
}
@@ -2958,7 +3180,7 @@
@@ -2958,7 +3179,7 @@
}
else
{
Expand All @@ -924,7 +918,7 @@
}
}

@@ -3042,7 +3264,7 @@
@@ -3042,7 +3263,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
{
IBlockState iblockstate1 = this.func_180495_p(p_175651_1_);
Expand All @@ -933,7 +927,7 @@
}

public boolean func_175640_z(BlockPos p_175640_1_)
@@ -3208,6 +3430,8 @@
@@ -3208,6 +3429,8 @@
d2 *= ((Double)MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
}

Expand All @@ -942,7 +936,7 @@
if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
{
d0 = d1;
@@ -3269,7 +3493,7 @@
@@ -3269,7 +3492,7 @@

public long func_72905_C()
{
Expand All @@ -951,7 +945,7 @@
}

public long func_82737_E()
@@ -3279,17 +3503,17 @@
@@ -3279,17 +3502,17 @@

public long func_72820_D()
{
Expand All @@ -972,7 +966,7 @@

if (!this.func_175723_af().func_177746_a(blockpos1))
{
@@ -3301,7 +3525,7 @@
@@ -3301,7 +3524,7 @@

public void func_175652_B(BlockPos p_175652_1_)
{
Expand All @@ -981,7 +975,7 @@
}

@SideOnly(Side.CLIENT)
@@ -3321,12 +3545,18 @@
@@ -3321,12 +3544,18 @@

if (!this.field_72996_f.contains(p_72897_1_))
{
Expand All @@ -1000,7 +994,7 @@
return true;
}

@@ -3428,8 +3658,7 @@
@@ -3428,8 +3657,7 @@

public boolean func_180502_D(BlockPos p_180502_1_)
{
Expand All @@ -1010,7 +1004,7 @@
}

@Nullable
@@ -3490,12 +3719,12 @@
@@ -3490,12 +3718,12 @@

public int func_72800_K()
{
Expand All @@ -1025,7 +1019,7 @@
}

public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
@@ -3539,7 +3768,7 @@
@@ -3539,7 +3767,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
Expand All @@ -1034,7 +1028,7 @@
}

public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
@@ -3573,7 +3802,7 @@
@@ -3573,7 +3801,7 @@

public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{
Expand All @@ -1043,7 +1037,7 @@
{
BlockPos blockpos1 = p_175666_1_.func_177972_a(enumfacing);

@@ -3581,18 +3810,15 @@
@@ -3581,18 +3809,15 @@
{
IBlockState iblockstate1 = this.func_180495_p(blockpos1);

Expand All @@ -1066,7 +1060,7 @@
}
}
}
@@ -3658,6 +3884,124 @@
@@ -3658,6 +3883,124 @@
return j2 >= -128 && j2 <= 128 && k2 >= -128 && k2 <= 128;
}

Expand Down

0 comments on commit 633fd9b

Please sign in to comment.