3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

SPIGOT-2833: Tile entities occasionally wiped after placement

Dieser Commit ist enthalten in:
md_5 2016-11-24 09:30:01 +11:00
Ursprung a0d5a841da
Commit 281376dfb5

Datei anzeigen

@ -75,7 +75,7 @@
this.F();
}
@@ -94,11 +128,137 @@
@@ -94,11 +128,138 @@
}
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
@ -152,6 +152,11 @@
+ this.setData(newData);
+ this.setCount(newCount);
+ }
+
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
+ world.setTileEntity(e.getKey(), e.getValue());
+ }
+
+ for (BlockState blockstate : blocks) {
+ int x = blockstate.getX();
+ int y = blockstate.getY();
@ -169,10 +174,6 @@
+ world.notifyAndUpdatePhysics(newblockposition, null, oldBlock.getBlockData(), block, updateFlag); // send null chunk as chunk.k() returns false by this point
+ }
+
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
+ world.setTileEntity(e.getKey(), e.getValue());
+ }
+
+ // Special case juke boxes as they update their tile entity. Copied from ItemRecord.
+ // PAIL: checkme on updates.
+ if (this.item instanceof ItemRecord) {
@ -214,7 +215,7 @@
return enuminteractionresult;
}
@@ -122,7 +282,7 @@
@@ -122,7 +283,7 @@
nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) {
@ -223,7 +224,7 @@
}
return nbttagcompound;
@@ -157,11 +317,30 @@
@@ -157,11 +318,30 @@
}
public void setData(int i) {
@ -256,7 +257,7 @@
}
public int k() {
@@ -205,6 +384,11 @@
@@ -205,6 +385,11 @@
entityhuman.b(StatisticList.c(this.item));
}
@ -268,7 +269,7 @@
this.damage = 0;
}
@@ -509,6 +693,12 @@
@@ -509,6 +694,12 @@
nbttaglist.add(nbttagcompound);
}