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

Update tile entity on client on cancelled block break. Fixes BUKKIT-2935

When a client tries to break a block it assumes it has done so unless told
otherwise by the server. This means the client also wipes out any tile
entity data it has for the block as well. We do not send this data when
updating the client so clients lose things like text on signs, skull type,
etc when they aren't allowed to break the block.
Dieser Commit ist enthalten in:
Travis Watkins 2012-11-14 20:03:58 -06:00
Ursprung df69ea8814
Commit e1afee008f
2 geänderte Dateien mit 11 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -279,6 +279,11 @@ public class ItemInWorldManager {
if (event.isCancelled()) {
// Let the client know the block still exists
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(i, j, k);
if (tileentity != null) {
this.player.netServerHandler.sendPacket(tileentity.getUpdatePacket());
}
return false;
}
}

Datei anzeigen

@ -542,8 +542,13 @@ public class NetServerHandler extends NetHandler {
// CraftBukkit start
if (i1 < this.server.getSpawnRadius() && !flag) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
// CraftBukkit end
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
// Update any tile entity data for this block
TileEntity tileentity = worldserver.getTileEntity(i, j, k);
if (tileentity != null) {
this.player.netServerHandler.sendPacket(tileentity.getUpdatePacket());
}
// CraftBukkit end
} else {
this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face);
}