Fix excess slot updates

By: AJ Ferguson <fergusonjva@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2025-06-21 13:15:53 +02:00
committed by Nassim Jahnke
parent c0dda0ea14
commit e714de6365

View File

@@ -157,7 +157,7 @@
slot.setChanged();
+ // CraftBukkit start - Make sure the client has the right slot contents
+ if (player instanceof ServerPlayer serverPlayer && slot.getMaxStackSize() != 64) {
+ if (player instanceof ServerPlayer serverPlayer && slot.getMaxStackSize() != Container.MAX_STACK) {
+ serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), slot.index, slot.getItem()));
+ // Updating a crafting inventory makes the client reset the result slot, have to send it again
+ if (this.getBukkitView().getType() == org.bukkit.event.inventory.InventoryType.WORKBENCH || this.getBukkitView().getType() == org.bukkit.event.inventory.InventoryType.CRAFTING) {