Fixup sendAllDataToRemote calls

Reduces unnecessary item copies by a lot
This commit is contained in:
Nassim Jahnke
2025-07-06 21:59:50 +02:00
parent b4466ec981
commit a939945148
34 changed files with 141 additions and 123 deletions

View File

@@ -307,6 +307,15 @@
}
}
}
@@ -299,7 +_,7 @@
}
if (!player.isUsingItem()) {
- player.inventoryMenu.sendAllDataToRemote();
+ player.inventoryMenu.broadcastChanges(); // Paper - change to broadcastChanges, super old code that might not even be needed at all
}
return interactionResult;
@@ -307,15 +_,47 @@
}
}
@@ -348,7 +357,7 @@
+ } else if (blockState.is(net.minecraft.world.level.block.Blocks.JIGSAW) || blockState.is(net.minecraft.world.level.block.Blocks.STRUCTURE_BLOCK) || blockState.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) {
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
+ }
+ player.getBukkitEntity().updateInventory(); // SPIGOT-2867
+ player.containerMenu.forceHeldSlot(hand); // SPIGOT-2867
+ this.player.resyncUsingItem(this.player); // Paper - Properly cancel usable items
+ return (event.useItemInHand() != org.bukkit.event.Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS;
+ } else if (this.gameModeForPlayer == GameType.SPECTATOR) {