diff --git a/leaf-server/minecraft-patches/features/0109-Only-broadcast-carried-item-if-changed.patch b/leaf-server/minecraft-patches/features/0109-Only-broadcast-carried-item-if-changed.patch deleted file mode 100644 index 4c6d05ba..00000000 --- a/leaf-server/minecraft-patches/features/0109-Only-broadcast-carried-item-if-changed.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Taiyou06 -Date: Thu, 20 Feb 2025 20:58:30 +0100 -Subject: [PATCH] Only broadcast carried item if changed - - -diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java -index 6033f629ac457472ad10f8e346732a596aea52d9..ba37e6b52ceb5f73e9c18cc555e768f43857e549 100644 ---- a/net/minecraft/world/inventory/AbstractContainerMenu.java -+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -225,24 +225,38 @@ public abstract class AbstractContainerMenu { - } - - public void broadcastChanges() { -+ // Leaf start - Only broadcast carried item if changed -+ // Avoid allocating supplier if no changes -+ boolean hasChanges = false; -+ - for (int i = 0; i < this.slots.size(); i++) { - ItemStack item = this.slots.get(i).getItem(); -- Supplier supplier = Suppliers.memoize(item::copy); -- this.triggerSlotListeners(i, item, supplier); -- this.synchronizeSlotToRemote(i, item, supplier); -+ ItemStack lastItem = this.lastSlots.get(i); -+ -+ // Fast path - reference equality check first -+ if (item != lastItem && !ItemStack.matches(lastItem, item)) { -+ hasChanges = true; -+ Supplier supplier = Suppliers.memoize(item::copy); -+ this.triggerSlotListeners(i, item, supplier); -+ this.synchronizeSlotToRemote(i, item, supplier); -+ } - } - -- this.synchronizeCarriedToRemote(); -+ // Only synchronize carried item if there were slot changes -+ if (hasChanges) { -+ this.synchronizeCarriedToRemote(); -+ } - -+ // Data slot synchronization - for (int i = 0; i < this.dataSlots.size(); i++) { - DataSlot dataSlot = this.dataSlots.get(i); -- int i1 = dataSlot.get(); -+ int value = dataSlot.get(); // OBFHELPER - if (dataSlot.checkAndClearUpdateFlag()) { -- this.updateDataSlotListeners(i, i1); -+ this.updateDataSlotListeners(i, value); - } -- -- this.synchronizeDataSlotToRemote(i, i1); -+ this.synchronizeDataSlotToRemote(i, value); - } -+ // Leaf end - Only broadcast carried item if changed - } - - public void broadcastFullState() { diff --git a/leaf-server/minecraft-patches/features/0110-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch b/leaf-server/minecraft-patches/features/0109-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0110-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch rename to leaf-server/minecraft-patches/features/0109-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch diff --git a/leaf-server/minecraft-patches/features/0111-Sepals-Rearrange-the-attackable-conditions.patch b/leaf-server/minecraft-patches/features/0110-Sepals-Rearrange-the-attackable-conditions.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0111-Sepals-Rearrange-the-attackable-conditions.patch rename to leaf-server/minecraft-patches/features/0110-Sepals-Rearrange-the-attackable-conditions.patch diff --git a/leaf-server/minecraft-patches/features/0112-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch b/leaf-server/minecraft-patches/features/0111-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0112-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch rename to leaf-server/minecraft-patches/features/0111-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch diff --git a/leaf-server/minecraft-patches/features/0113-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch b/leaf-server/minecraft-patches/features/0112-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0113-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch rename to leaf-server/minecraft-patches/features/0112-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch diff --git a/leaf-server/minecraft-patches/features/0114-Optimize-checking-nearby-players-for-spawning.patch b/leaf-server/minecraft-patches/features/0113-Optimize-checking-nearby-players-for-spawning.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0114-Optimize-checking-nearby-players-for-spawning.patch rename to leaf-server/minecraft-patches/features/0113-Optimize-checking-nearby-players-for-spawning.patch diff --git a/leaf-server/minecraft-patches/features/0115-Cache-supporting-block-check.patch b/leaf-server/minecraft-patches/features/0114-Cache-supporting-block-check.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0115-Cache-supporting-block-check.patch rename to leaf-server/minecraft-patches/features/0114-Cache-supporting-block-check.patch diff --git a/leaf-server/minecraft-patches/features/0116-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch b/leaf-server/minecraft-patches/features/0115-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0116-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch rename to leaf-server/minecraft-patches/features/0115-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch diff --git a/leaf-server/minecraft-patches/features/0117-Replace-brain-activity-maps-with-optimized-collectio.patch b/leaf-server/minecraft-patches/features/0116-Replace-brain-activity-maps-with-optimized-collectio.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0117-Replace-brain-activity-maps-with-optimized-collectio.patch rename to leaf-server/minecraft-patches/features/0116-Replace-brain-activity-maps-with-optimized-collectio.patch diff --git a/leaf-server/minecraft-patches/features/0118-Remove-stream-in-villagers.patch b/leaf-server/minecraft-patches/features/0117-Remove-stream-in-villagers.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0118-Remove-stream-in-villagers.patch rename to leaf-server/minecraft-patches/features/0117-Remove-stream-in-villagers.patch diff --git a/leaf-server/minecraft-patches/features/0119-Optimize-baby-villager-sensor.patch b/leaf-server/minecraft-patches/features/0118-Optimize-baby-villager-sensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0119-Optimize-baby-villager-sensor.patch rename to leaf-server/minecraft-patches/features/0118-Optimize-baby-villager-sensor.patch diff --git a/leaf-server/minecraft-patches/features/0120-Only-player-pushable.patch b/leaf-server/minecraft-patches/features/0119-Only-player-pushable.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0120-Only-player-pushable.patch rename to leaf-server/minecraft-patches/features/0119-Only-player-pushable.patch diff --git a/leaf-server/minecraft-patches/features/0121-Remove-iterators-from-Inventory-contains.patch b/leaf-server/minecraft-patches/features/0120-Remove-iterators-from-Inventory-contains.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0121-Remove-iterators-from-Inventory-contains.patch rename to leaf-server/minecraft-patches/features/0120-Remove-iterators-from-Inventory-contains.patch diff --git a/leaf-server/minecraft-patches/features/0122-Alternative-Brain-Behaviour.patch b/leaf-server/minecraft-patches/features/0121-Alternative-Brain-Behaviour.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0122-Alternative-Brain-Behaviour.patch rename to leaf-server/minecraft-patches/features/0121-Alternative-Brain-Behaviour.patch diff --git a/leaf-server/minecraft-patches/features/0123-Cache-eligible-players-for-despawn-checks.patch b/leaf-server/minecraft-patches/features/0122-Cache-eligible-players-for-despawn-checks.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0123-Cache-eligible-players-for-despawn-checks.patch rename to leaf-server/minecraft-patches/features/0122-Cache-eligible-players-for-despawn-checks.patch diff --git a/leaf-server/minecraft-patches/features/0124-Slightly-optimise-getNearestPlayer.patch b/leaf-server/minecraft-patches/features/0123-Slightly-optimise-getNearestPlayer.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0124-Slightly-optimise-getNearestPlayer.patch rename to leaf-server/minecraft-patches/features/0123-Slightly-optimise-getNearestPlayer.patch