Fix onBlockAdded being called twice for ItemEntity placing non-TE blocks (#7607)

This commit is contained in:
Take Weiland authored and GitHub committed 2021-02-09 13:02:08 -08:00
1 parent f450d4025d
commit 8460227ddf
2 files changed
+7 -6

No files matched your search

@@ -26,7 +26,7 @@
}
public Chunk(World p_i49947_1_, ChunkPrimer p_i49947_2_) {
@@ -264,14 +265,14 @@
@@ -264,28 +265,28 @@
if (!this.field_76637_e.field_72995_K) {
blockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_);
@@ -43,7 +43,11 @@
TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK);
if (tileentity != null) {
tileentity.func_145836_u();
@@ -282,10 +283,10 @@
}
}
- if (!this.field_76637_e.field_72995_K) {
+ if (!this.field_76637_e.field_72995_K && !this.field_76637_e.captureBlockSnapshots) {
p_177436_2_.func_215705_a(this.field_76637_e, p_177436_1_, blockstate, p_177436_3_);
}
@@ -678,10 +678,7 @@ public class ForgeHooks
int updateFlag = snap.getFlag();
BlockState oldBlock = snap.getReplacedBlock();
BlockState newBlock = world.getBlockState(snap.getPos());
if (!newBlock.hasTileEntity()) // Containers get placed automatically
{
newBlock.onBlockAdded(world, snap.getPos(), oldBlock, false);
}
newBlock.onBlockAdded(world, snap.getPos(), oldBlock, false);
world.markAndNotifyBlock(snap.getPos(), world.getChunkAt(snap.getPos()), oldBlock, newBlock, updateFlag, 512);
}