Attempt to properly resolve this daft metadata and TE nonsense. This might be mod impacting, if you maintain a reference to a TE via neighbour update calls - you

might see two TEs for a single setblock where previously you saw one. This is a phantom TE being created by badly written neighbour triggers - I'm looking at you
redstone.

Anyway, with luck, this'll close a slew of bugs across Forge, IC2, MFR, TE, RC. Yeah, fun times. Thanks to LexManos, skyboy and KingLemming for helping figure this
issue out. Quite frankly, from now on, issues with phantom TEs will be mods behaving badly. Modders will need to adapt.
This commit is contained in:
cpw 2014-08-12 23:56:09 -04:00
parent 016e303379
commit 6fafbf3b09
1 changed files with 26 additions and 31 deletions

View File

@ -31,7 +31,7 @@
}
public Block func_150810_a(final int p_150810_1_, final int p_150810_2_, final int p_150810_3_)
@@ -579,6 +585,8 @@
@@ -579,20 +585,33 @@
int l1 = this.field_76635_g * 16 + p_150807_1_;
int i2 = this.field_76647_h * 16 + p_150807_3_;
@ -40,39 +40,34 @@
if (!this.field_76637_e.field_72995_K)
{
block1.func_149725_f(this.field_76637_e, l1, p_150807_2_, i2, k1);
@@ -589,11 +597,21 @@
}
extendedblockstorage.func_150818_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_4_);
+ extendedblockstorage.func_76654_b(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); // This line duplicates the one below, so breakBlock fires with valid worldstate
if (!this.field_76637_e.field_72995_K)
{
block1.func_149749_a(this.field_76637_e, l1, p_150807_2_, i2, block1, k1);
+ extendedblockstorage.func_76654_b(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); //After break for redstone dust.
+ // After breakBlock a phantom TE might have been created with incorrect meta. This attempts to kill that phantom TE so the normal one can be create properly later
+ TileEntity te = this.getTileEntityUnsafe(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F);
+ if (te != null && te.shouldRefresh(block1, func_150810_a(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F), k1, func_76628_c(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F), field_76637_e, l1, p_150807_2_, i2))
+ {
+ this.func_150805_f(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F);
+ }
}
- else if (block1 instanceof ITileEntityProvider && block1 != p_150807_4_)
+ else if (block1.hasTileEntity(k1))
{
- this.field_76637_e.func_147475_p(l1, p_150807_2_, i2);
+ extendedblockstorage.func_76654_b(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); // Above TE to prevent requiring refresh
+ TileEntity te = this.getTileEntityUnsafe(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F);
+ if (te != null && te.shouldRefresh(block1, p_150807_4_, k1, p_150807_5_, field_76637_e, l1, p_150807_2_, i2))
+ {
+ this.field_76637_e.func_147475_p(l1, p_150807_2_, i2);
+ }
}
+ else
+ {
+ extendedblockstorage.func_76654_b(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); // Above everything else on the client.
+ }
if (extendedblockstorage.func_150819_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_) != p_150807_4_)
{
@@ -601,16 +619,13 @@
}
else
{
- extendedblockstorage.func_76654_b(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_);
-
if (flag)
{
this.func_76603_b();
@@ -609,8 +628,7 @@
}
else
{
@ -82,7 +77,7 @@
if (j2 > 0)
{
@@ -632,34 +647,19 @@
@@ -632,34 +650,19 @@
TileEntity tileentity;
@ -119,7 +114,7 @@
}
}
@@ -690,7 +690,7 @@
@@ -690,7 +693,7 @@
this.field_76643_l = true;
extendedblockstorage.func_76654_b(p_76589_1_, p_76589_2_ & 15, p_76589_3_, p_76589_4_);
@ -128,7 +123,7 @@
{
TileEntity tileentity = this.func_150806_e(p_76589_1_, p_76589_2_, p_76589_3_);
@@ -790,6 +790,7 @@
@@ -790,6 +793,7 @@
k = this.field_76645_j.length - 1;
}
@ -136,7 +131,7 @@
p_76612_1_.field_70175_ag = true;
p_76612_1_.field_70176_ah = this.field_76635_g;
p_76612_1_.field_70162_ai = k;
@@ -827,28 +828,27 @@
@@ -827,28 +831,27 @@
ChunkPosition chunkposition = new ChunkPosition(p_150806_1_, p_150806_2_, p_150806_3_);
TileEntity tileentity = (TileEntity)this.field_150816_i.get(chunkposition);
@ -175,7 +170,7 @@
}
public void func_150813_a(TileEntity p_150813_1_)
@@ -860,7 +860,7 @@
@@ -860,7 +863,7 @@
if (this.field_76636_d)
{
@ -184,7 +179,7 @@
}
}
@@ -872,7 +872,8 @@
@@ -872,7 +875,8 @@
p_150812_4_.field_145848_d = p_150812_2_;
p_150812_4_.field_145849_e = this.field_76647_h * 16 + p_150812_3_;
@ -194,7 +189,7 @@
{
if (this.field_150816_i.containsKey(chunkposition))
{
@@ -916,6 +917,7 @@
@@ -916,6 +920,7 @@
this.field_76637_e.func_72868_a(this.field_76645_j[i]);
}
@ -202,7 +197,7 @@
}
public void func_76623_d()
@@ -933,6 +935,7 @@
@@ -933,6 +938,7 @@
{
this.field_76637_e.func_72828_b(this.field_76645_j[i]);
}
@ -210,7 +205,7 @@
}
public void func_76630_e()
@@ -942,8 +945,8 @@
@@ -942,8 +948,8 @@
public void func_76588_a(Entity p_76588_1_, AxisAlignedBB p_76588_2_, List p_76588_3_, IEntitySelector p_76588_4_)
{
@ -221,7 +216,7 @@
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -979,8 +982,8 @@
@@ -979,8 +985,8 @@
public void func_76618_a(Class p_76618_1_, AxisAlignedBB p_76618_2_, List p_76618_3_, IEntitySelector p_76618_4_)
{
@ -232,7 +227,7 @@
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -1139,6 +1142,15 @@
@@ -1139,6 +1145,15 @@
@SideOnly(Side.CLIENT)
public void func_76607_a(byte[] p_76607_1_, int p_76607_2_, int p_76607_3_, boolean p_76607_4_)
{
@ -248,7 +243,7 @@
int k = 0;
boolean flag1 = !this.field_76637_e.field_73011_w.field_76576_e;
int l;
@@ -1241,13 +1253,27 @@
@@ -1241,13 +1256,27 @@
this.field_150814_l = true;
this.field_76646_k = true;
this.func_76590_a();
@ -277,7 +272,7 @@
}
public BiomeGenBase func_76591_a(int p_76591_1_, int p_76591_2_, WorldChunkManager p_76591_3_)
@@ -1450,4 +1476,48 @@
@@ -1450,4 +1479,48 @@
return true;
}