9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Update changes from ver/1.21.4 branch

This commit is contained in:
Dreeam
2025-06-22 10:50:20 +08:00
24 changed files with 220 additions and 97 deletions

View File

@@ -1,23 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Leymooo <Vjatseslav.Maspanov@gmail.com>
Date: Wed, 11 Jun 2025 05:30:39 +0300
Subject: [PATCH] PaperPR: Fix excess slot updates / inventory state id desync
From: AJ Ferguson <fergusonjva@gmail.com>
Date: Mon, 6 Jan 2025 20:31:00 +1100
Subject: [PATCH] Paper: Fix excess slot updates
Original license: GPLv3
Original project: https://github.com/SparklyPower/SparklyPaper
Original project: https://github.com/PaperMC/Paper
Paper pull request: https://github.com/PaperMC/Paper/pull/12654
Fixes inventory state id desync with high ping causing inventory to be "buggy" (ghost items, items jumping to/from cursor, etc)
Without patch: https://youtu.be/hOXt3Rpkgtg
With patch: https://youtu.be/MtOYD7uieS4
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/df01cf867a2255024aacf9ac2ff6a56b2ffb7ce5#nms-patches/net/minecraft/world/inventory/Container.patch
https://discord.com/channels/289587909051416579/555462289851940864/1382165293308182699
https://github.com/PaperMC/Paper/commit/e714de636543d61fcd3682705484c8a15f4f3ca6
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
index 9dd3187fd968ab95e9d55b4c8cc74e782cc0f241..c5ede24d00f444d04c835af3a7f0154227492be4 100644
index 9dd3187fd968ab95e9d55b4c8cc74e782cc0f241..46c3353a9722cb9c8073cadbad0ced57bab0c390 100644
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -559,7 +559,7 @@ public abstract class AbstractContainerMenu {
@@ -25,7 +18,7 @@ index 9dd3187fd968ab95e9d55b4c8cc74e782cc0f241..c5ede24d00f444d04c835af3a7f01542
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() != net.minecraft.world.Container.MAX_STACK) { // Paper - Fix excess slot updates / inventory state id desync
+ if (player instanceof ServerPlayer serverPlayer && slot.getMaxStackSize() != Container.MAX_STACK) { // Paper - craftbukkkit - Fix excess slot updates
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) {