Fix setTileEntity causing the world to remove the new and old tile entities. Closes #2164

This commit is contained in:
LexManos 2016-05-28 21:03:24 -07:00
parent b8996b14bc
commit 978861b521
1 changed files with 44 additions and 35 deletions

View File

@ -364,7 +364,16 @@
throw new ReportedException(crashreport2);
}
}
@@ -1707,15 +1826,20 @@
@@ -1702,20 +1821,28 @@
if (this.func_175667_e(tileentity.func_174877_v()))
{
- this.func_175726_f(tileentity.func_174877_v()).func_177425_e(tileentity.func_174877_v());
+ //Forge: Bugfix: If we set the tile entity it immediately sets it in the chunk, so we could be desyned
+ Chunk chunk = this.func_175726_f(tileentity.func_174877_v());
+ if (chunk.func_177424_a(tileentity.func_174877_v(), net.minecraft.world.chunk.Chunk.EnumCreateEntityType.CHECK) == tileentity)
+ chunk.func_177425_e(tileentity.func_174877_v());
}
}
}
@ -387,7 +396,7 @@
this.field_72984_F.func_76318_c("pendingBlockEntities");
if (!this.field_147484_a.isEmpty())
@@ -1754,7 +1878,8 @@
@@ -1754,7 +1881,8 @@
public boolean func_175700_a(TileEntity p_175700_1_)
{
@ -397,7 +406,7 @@
if (flag && p_175700_1_ instanceof ITickable)
{
@@ -1788,9 +1913,13 @@
@@ -1788,9 +1916,13 @@
{
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
@ -413,7 +422,7 @@
{
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
@@ -1989,6 +2118,10 @@
@@ -1989,6 +2121,10 @@
blockpos$pooledmutableblockpos.func_185344_t();
return true;
}
@ -424,7 +433,7 @@
}
}
}
@@ -2028,6 +2161,16 @@
@@ -2028,6 +2164,16 @@
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos);
Block block = iblockstate.func_177230_c();
@ -441,7 +450,7 @@
if (iblockstate.func_185904_a() == p_72918_2_)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue()));
@@ -2104,6 +2247,9 @@
@@ -2104,6 +2250,9 @@
{
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2));
@ -451,7 +460,7 @@
if (iblockstate.func_185904_a() == p_72830_2_)
{
int j2 = ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue();
@@ -2136,6 +2282,7 @@
@@ -2136,6 +2285,7 @@
public Explosion func_72885_a(@Nullable Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
{
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
@ -459,7 +468,7 @@
explosion.func_77278_a();
explosion.func_77279_a(true);
return explosion;
@@ -2258,6 +2405,7 @@
@@ -2258,6 +2408,7 @@
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_)
{
@ -467,7 +476,7 @@
if (!this.func_189509_E(p_175690_1_))
{
if (p_175690_2_ != null && !p_175690_2_.func_145837_r())
@@ -2283,8 +2431,10 @@
@@ -2283,8 +2434,10 @@
else
{
this.func_175700_a(p_175690_2_);
@ -479,7 +488,7 @@
}
}
}
@@ -2297,6 +2447,8 @@
@@ -2297,6 +2450,8 @@
{
tileentity.func_145843_s();
this.field_147484_a.remove(tileentity);
@ -488,7 +497,7 @@
}
else
{
@@ -2309,6 +2461,7 @@
@@ -2309,6 +2464,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
@ -496,7 +505,7 @@
}
public void func_147457_a(TileEntity p_147457_1_)
@@ -2335,7 +2488,7 @@
@@ -2335,7 +2491,7 @@
if (chunk != null && !chunk.func_76621_g())
{
IBlockState iblockstate = this.func_180495_p(p_175677_1_);
@ -505,7 +514,7 @@
}
else
{
@@ -2358,6 +2511,7 @@
@@ -2358,6 +2514,7 @@
{
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
@ -513,7 +522,7 @@
}
public void func_72835_b()
@@ -2367,6 +2521,11 @@
@@ -2367,6 +2524,11 @@
protected void func_72947_a()
{
@ -525,7 +534,7 @@
if (this.field_72986_A.func_76059_o())
{
this.field_73004_o = 1.0F;
@@ -2380,6 +2539,11 @@
@@ -2380,6 +2542,11 @@
protected void func_72979_l()
{
@ -537,7 +546,7 @@
if (!this.field_73011_w.func_177495_o())
{
if (!this.field_72995_K)
@@ -2499,6 +2663,11 @@
@@ -2499,6 +2666,11 @@
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{
@ -549,7 +558,7 @@
Biome biome = this.func_180494_b(p_175670_1_);
float f = biome.func_180626_a(p_175670_1_);
@@ -2540,6 +2709,11 @@
@@ -2540,6 +2712,11 @@
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{
@ -561,7 +570,7 @@
Biome biome = this.func_180494_b(p_175708_1_);
float f = biome.func_180626_a(p_175708_1_);
@@ -2557,7 +2731,7 @@
@@ -2557,7 +2734,7 @@
{
IBlockState iblockstate = this.func_180495_p(p_175708_1_);
@ -570,7 +579,7 @@
{
return true;
}
@@ -2589,10 +2763,11 @@
@@ -2589,10 +2766,11 @@
else
{
IBlockState iblockstate = this.func_180495_p(p_175638_1_);
@ -585,7 +594,7 @@
{
j = 1;
}
@@ -2691,7 +2866,7 @@
@@ -2691,7 +2869,7 @@
int j4 = j2 + enumfacing.func_96559_d();
int k4 = k2 + enumfacing.func_82599_e();
blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4);
@ -594,7 +603,7 @@
i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);
if (i3 == l2 - l4 && j < this.field_72994_J.length)
@@ -2799,10 +2974,10 @@
@@ -2799,10 +2977,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();
@ -609,7 +618,7 @@
for (int i1 = i; i1 <= j; ++i1)
{
@@ -2855,10 +3030,10 @@
@@ -2855,10 +3033,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_)
{
@ -624,7 +633,7 @@
List<T> list = Lists.<T>newArrayList();
for (int i1 = i; i1 < j; ++i1)
@@ -2938,11 +3113,13 @@
@@ -2938,11 +3116,13 @@
public void func_175650_b(Collection<Entity> p_175650_1_)
{
@ -641,7 +650,7 @@
}
}
@@ -2955,7 +3132,7 @@
@@ -2955,7 +3135,7 @@
{
IBlockState iblockstate = this.func_180495_p(p_175716_2_);
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_176223_P().func_185890_d(this, p_175716_2_);
@ -650,7 +659,7 @@
}
public int func_181545_F()
@@ -3038,7 +3215,7 @@
@@ -3038,7 +3218,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
{
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
@ -659,7 +668,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_)
@@ -3235,7 +3412,7 @@
@@ -3235,7 +3415,7 @@
public long func_72905_C()
{
@ -668,7 +677,7 @@
}
public long func_82737_E()
@@ -3245,17 +3422,17 @@
@@ -3245,17 +3425,17 @@
public long func_72820_D()
{
@ -689,7 +698,7 @@
if (!this.func_175723_af().func_177746_a(blockpos))
{
@@ -3267,7 +3444,7 @@
@@ -3267,7 +3447,7 @@
public void func_175652_B(BlockPos p_175652_1_)
{
@ -698,7 +707,7 @@
}
@SideOnly(Side.CLIENT)
@@ -3287,12 +3464,18 @@
@@ -3287,12 +3467,18 @@
if (!this.field_72996_f.contains(p_72897_1_))
{
@ -717,7 +726,7 @@
return true;
}
@@ -3386,8 +3569,7 @@
@@ -3386,8 +3572,7 @@
public boolean func_180502_D(BlockPos p_180502_1_)
{
@ -727,7 +736,7 @@
}
@Nullable
@@ -3448,12 +3630,12 @@
@@ -3448,12 +3633,12 @@
public int func_72800_K()
{
@ -742,7 +751,7 @@
}
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
@@ -3503,7 +3685,7 @@
@@ -3503,7 +3688,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
@ -751,7 +760,7 @@
}
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
@@ -3537,7 +3719,7 @@
@@ -3537,7 +3722,7 @@
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{
@ -760,7 +769,7 @@
{
BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing);
@@ -3545,18 +3727,14 @@
@@ -3545,18 +3730,14 @@
{
IBlockState iblockstate = this.func_180495_p(blockpos);
@ -783,7 +792,7 @@
}
}
}
@@ -3622,6 +3800,87 @@
@@ -3622,6 +3803,87 @@
return i >= -k && i <= k && j >= -k && j <= k;
}