diff --git a/paper-server/patches/features/0015-Moonrise-optimisation-patches.patch b/paper-server/patches/features/0015-Moonrise-optimisation-patches.patch index 8b02fd272..3af917b55 100644 --- a/paper-server/patches/features/0015-Moonrise-optimisation-patches.patch +++ b/paper-server/patches/features/0015-Moonrise-optimisation-patches.patch @@ -27569,7 +27569,7 @@ index 085040aa98704f2874bcd95b751b0a81dcdb15ad..cd72273468f596b640bd2d10d846fbe8 } diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 1a04df3ba206e473ff6faadf79435fad2e00c324..5a60f2598560571e156612bf256c1c340d92a922 100644 +index 57af8cd7629fa14176c6e7a29956617ec9506999..63fecebe6048b0d3372ea84ac74dc74744de3273 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -186,7 +186,7 @@ import net.minecraft.world.scores.Team; @@ -27581,7 +27581,7 @@ index 1a04df3ba206e473ff6faadf79435fad2e00c324..5a60f2598560571e156612bf256c1c34 private static final Logger LOGGER = LogUtils.getLogger(); private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; -@@ -422,6 +422,36 @@ public class ServerPlayer extends Player { +@@ -415,6 +415,36 @@ public class ServerPlayer extends Player { public @Nullable String clientBrandName = null; // Paper - Brand support public @Nullable org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event diff --git a/paper-server/patches/features/0025-Optional-per-player-mob-spawns.patch b/paper-server/patches/features/0025-Optional-per-player-mob-spawns.patch index 4b791809a..b521f05eb 100644 --- a/paper-server/patches/features/0025-Optional-per-player-mob-spawns.patch +++ b/paper-server/patches/features/0025-Optional-per-player-mob-spawns.patch @@ -78,10 +78,10 @@ index 5d63bf024cbcbd2f627c64fee77553c9a512bd15..f863377a807b672f49f7140688f378ec profiler.popPush("tickSpawningChunks"); diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 57e7d0a8b5f2a5bc65b0f290fb655625b1481f31..60a46174d9cd6adc2fd141c1e5e4a439ded0fc45 100644 +index 4b2801749328f250ce5735fbe7f6941a6bede01a..af04fcdba1e57b4eac678235b56ad3e1c70169b7 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -402,6 +402,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -395,6 +395,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc public boolean queueHealthUpdatePacket; public @Nullable net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; // Paper end - cancellable death event diff --git a/paper-server/patches/features/0026-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/paper-server/patches/features/0026-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index 7000a4a5c..0f67c9da6 100644 --- a/paper-server/patches/features/0026-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/paper-server/patches/features/0026-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -60,10 +60,10 @@ index f863377a807b672f49f7140688f378eca2cf650b..59e8a5e1b35c81883c9b1ca00c6e55d7 spawnState = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); } else { diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 60a46174d9cd6adc2fd141c1e5e4a439ded0fc45..75fa38570d758a48303a3a6dfb881b616a50f81c 100644 +index af04fcdba1e57b4eac678235b56ad3e1c70169b7..3781d9cc174b7aecacb9b9855d52c7b1ff05835c 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -406,6 +406,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -399,6 +399,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length; public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper end - Optional per player mob spawns diff --git a/paper-server/patches/sources/net/minecraft/network/HashedStack.java.patch b/paper-server/patches/sources/net/minecraft/network/HashedStack.java.patch deleted file mode 100644 index 8f72f1fe5..000000000 --- a/paper-server/patches/sources/net/minecraft/network/HashedStack.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/net/minecraft/network/HashedStack.java -+++ b/net/minecraft/network/HashedStack.java -@@ -17,7 +_,7 @@ - } - - @Override -- public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator) { -+ public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator, final boolean simplifyMatching) { // Paper - add flag to simplify remote matching logic - return stack.isEmpty(); - } - }; -@@ -27,7 +_,7 @@ - hashedStack -> hashedStack instanceof HashedStack.ActualItem actualItem ? Optional.of(actualItem) : Optional.empty() - ); - -- boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator); -+ boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator, final boolean simplifyMatching); // Paper - add flag to simplify remote matching logic - - static HashedStack create(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator) { - return (HashedStack)(stack.isEmpty() -@@ -47,10 +_,10 @@ - ); - - @Override -- public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator) { -+ public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator, final boolean simplifyMatching) { // Paper - add flag to simplify remote matching logic - return this.count == stack.getCount() - && this.item.equals(stack.getItemHolder()) -- && this.components.matches(stack.getComponentsPatch(), hashGenerator); -+ && (simplifyMatching || this.components.matches(stack.getComponentsPatch(), hashGenerator)); // Paper - add flag to simplify remote matching logic - } - } - } diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index 076f8107a..9470cf950 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -18,7 +18,7 @@ @Nullable private Vec3 startingToFallPosition; @Nullable -@@ -281,6 +_,20 @@ +@@ -281,6 +_,13 @@ } } @@ -28,26 +28,10 @@ + ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(ServerPlayer.this.inventoryMenu.containerId, ServerPlayer.this.inventoryMenu.incrementStateId(), net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy())); + } + // Paper end - Sync offhand slot in menus -+ -+ // Paper start - add flag to simplify remote matching logic -+ @Override -+ public ServerPlayer player() { -+ return ServerPlayer.this; -+ } -+ // Paper end - add flag to simplify remote matching logic + @Override public void sendSlotChange(AbstractContainerMenu container, int slot, ItemStack itemStack) { ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(container.containerId, container.incrementStateId(), slot, itemStack)); -@@ -302,7 +_,7 @@ - - @Override - public RemoteSlot createSlot() { -- return new RemoteSlot.Synchronized(this.cache::getUnchecked); -+ return new RemoteSlot.Synchronized(this.cache::getUnchecked, ServerPlayer.this.getBukkitEntity().simplifyContainerDesyncCheck()); // Paper - add flag to simplify remote matching logic - } - }; - private final ContainerListener containerListener = new ContainerListener() { @@ -316,6 +_,32 @@ } } diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/ContainerSynchronizer.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/ContainerSynchronizer.java.patch index b5e0c30bc..23243402a 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/ContainerSynchronizer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/ContainerSynchronizer.java.patch @@ -1,15 +1,9 @@ --- a/net/minecraft/world/inventory/ContainerSynchronizer.java +++ b/net/minecraft/world/inventory/ContainerSynchronizer.java -@@ -13,4 +_,12 @@ +@@ -13,4 +_,6 @@ void sendDataChange(AbstractContainerMenu container, int id, int value); RemoteSlot createSlot(); + + default void sendOffHandSlotChange() {} // Paper - Sync offhand slot in menus -+ -+ // Paper start - add flag to simplify remote matching logic -+ default net.minecraft.server.level.@org.jspecify.annotations.Nullable ServerPlayer player() { -+ return null; -+ } -+ // Paper end - add flag to simplify remote matching logic } diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/RemoteSlot.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/RemoteSlot.java.patch deleted file mode 100644 index 5002dfb42..000000000 --- a/paper-server/patches/sources/net/minecraft/world/inventory/RemoteSlot.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/minecraft/world/inventory/RemoteSlot.java -+++ b/net/minecraft/world/inventory/RemoteSlot.java -@@ -29,12 +_,14 @@ - - public static class Synchronized implements RemoteSlot { - private final HashedPatchMap.HashGenerator hasher; -+ private final boolean simplifyMatching; // Paper - add flag to simplify remote matching logic - @Nullable - private ItemStack remoteStack = null; - @Nullable - private HashedStack remoteHash = null; - -- public Synchronized(HashedPatchMap.HashGenerator hasher) { -+ public Synchronized(HashedPatchMap.HashGenerator hasher, final boolean simplifyMatching) { // Paper - add flag to simplify remote matching logic -+ this.simplifyMatching = simplifyMatching; // Paper - add flag to simplify remote matching logic - this.hasher = hasher; - } - -@@ -54,7 +_,7 @@ - public boolean matches(ItemStack stack) { - if (this.remoteStack != null) { - return ItemStack.matches(this.remoteStack, stack); -- } else if (this.remoteHash != null && this.remoteHash.matches(stack, this.hasher)) { -+ } else if (this.remoteHash != null && this.remoteHash.matches(stack, this.hasher, this.simplifyMatching)) { // Paper - add flag to simplify remote matching logic - this.remoteStack = stack.copy(); - return true; - } else {