Dont resend blocks on interactions

In general, the client now has an acknowledgment system which will prevent block changes made by the client to be reverted correctly.

It should be noted that this system does not yet support block entities, so those still need to resynced when needed.
This commit is contained in:
Owen1212055
2023-06-27 21:09:11 -04:00
parent ddbfcd4403
commit 893616e851
3 changed files with 81 additions and 71 deletions

View File

@@ -37,7 +37,7 @@
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand);
+ if (event.isCancelled()) {
+ ((ServerPlayer) user).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
+ // ((ServerPlayer) user).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) // Paper - Don't resend blocks
+ ((ServerPlayer) user).getBukkitEntity().updateInventory(); // SPIGOT-4541
+ return InteractionResult.FAIL;
+ }
@@ -117,7 +117,7 @@
+ if (flag2 && entityhuman != null) {
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand);
+ if (event.isCancelled()) {
+ ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-4238: needed when looking through entity
+ // ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-4238: needed when looking through entity // Paper - Don't resend blocks
+ ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
+ return false;
+ }