From 13b890950daa67c2c6d3d7c2e2fa78b6542ef698 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 20 Dec 2024 23:18:34 +0100 Subject: [PATCH] Apply remaining feature patches --- .../1076-Implement-chunk-view-API.patch | 51 --------- .../0021-Moonrise-optimisation-patches.patch | 41 +++++-- ...-data-to-disk-if-it-serializes-witho.patch | 1 - .../0028-Improved-Watchdog-Support.patch | 63 +++++------ ...l-more-information-in-watchdog-dumps.patch | 102 ++++-------------- ...030-Entity-load-save-limit-per-chunk.patch | 1 - ...culate-regionfile-header-if-it-is-co.patch | 1 - ...-Incremental-chunk-and-player-saving.patch | 22 ++-- .../0033-Optimise-general-POI-access.patch | 1 - .../0034-Optional-per-player-mob-spawns.patch | 26 ++--- ...ng-PreCreatureSpawnEvent-with-per-pl.patch | 14 +-- .../features/0036-Optimize-Hoppers.patch | 12 +-- ...on-checking-in-player-move-packet-ha.patch | 22 ++-- 13 files changed, 133 insertions(+), 224 deletions(-) delete mode 100644 feature-patches/1076-Implement-chunk-view-API.patch rename feature-patches/1060-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch => paper-server/patches/features/0027-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch (99%) rename feature-patches/1061-Improved-Watchdog-Support.patch => paper-server/patches/features/0028-Improved-Watchdog-Support.patch (86%) rename feature-patches/1062-Detail-more-information-in-watchdog-dumps.patch => paper-server/patches/features/0029-Detail-more-information-in-watchdog-dumps.patch (62%) rename feature-patches/1063-Entity-load-save-limit-per-chunk.patch => paper-server/patches/features/0030-Entity-load-save-limit-per-chunk.patch (99%) rename feature-patches/1064-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch => paper-server/patches/features/0031-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch (99%) rename feature-patches/1066-Incremental-chunk-and-player-saving.patch => paper-server/patches/features/0032-Incremental-chunk-and-player-saving.patch (85%) rename feature-patches/1067-Optimise-general-POI-access.patch => paper-server/patches/features/0033-Optimise-general-POI-access.patch (99%) rename feature-patches/1071-Optional-per-player-mob-spawns.patch => paper-server/patches/features/0034-Optional-per-player-mob-spawns.patch (92%) rename feature-patches/1072-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch => paper-server/patches/features/0035-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch (88%) rename feature-patches/2017-Optimize-Hoppers.patch => paper-server/patches/features/0036-Optimize-Hoppers.patch (98%) rename feature-patches/1070-Optimise-collision-checking-in-player-move-packet-ha.patch => paper-server/patches/features/0037-Optimise-collision-checking-in-player-move-packet-ha.patch (92%) diff --git a/feature-patches/1076-Implement-chunk-view-API.patch b/feature-patches/1076-Implement-chunk-view-API.patch deleted file mode 100644 index ede618a2ed..0000000000 --- a/feature-patches/1076-Implement-chunk-view-API.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Flo0 -Date: Thu, 5 Dec 2024 12:15:07 +0100 -Subject: [PATCH] Implement chunk view API - - -diff --git a/src/main/java/io/papermc/paper/FeatureHooks.java b/src/main/java/io/papermc/paper/FeatureHooks.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/io/papermc/paper/FeatureHooks.java -+++ b/src/main/java/io/papermc/paper/FeatureHooks.java -@@ -0,0 +0,0 @@ package io.papermc.paper; - import io.papermc.paper.command.PaperSubcommand; - import io.papermc.paper.command.subcommands.ChunkDebugCommand; - import io.papermc.paper.command.subcommands.FixLightCommand; -+import it.unimi.dsi.fastutil.longs.LongIterator; - import it.unimi.dsi.fastutil.longs.LongOpenHashSet; --import it.unimi.dsi.fastutil.longs.LongSet; - import it.unimi.dsi.fastutil.longs.LongSets; - import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; - import it.unimi.dsi.fastutil.objects.ObjectSet; -@@ -0,0 +0,0 @@ public final class FeatureHooks { - } - - public static Set getSentChunkKeys(final ServerPlayer player) { -- final LongSet keys = new LongOpenHashSet(); -- player.getChunkTrackingView().forEach(pos -> keys.add(pos.longKey)); -- return LongSets.unmodifiable(keys); -+ return LongSets.unmodifiable(player.moonrise$getChunkLoader().getSentChunksRaw().clone()); - } - - public static Set getSentChunks(final ServerPlayer player) { -- final ObjectSet chunks = new ObjectOpenHashSet<>(); -+ final LongOpenHashSet rawChunkKeys = player.moonrise$getChunkLoader().getSentChunksRaw(); -+ final ObjectSet chunks = new ObjectOpenHashSet<>(rawChunkKeys.size()); - final World world = player.serverLevel().getWorld(); -- player.getChunkTrackingView().forEach(pos -> { -- final org.bukkit.Chunk chunk = world.getChunkAt(pos.longKey); -- chunks.add(chunk); -- }); -+ final LongIterator iter = player.moonrise$getChunkLoader().getSentChunksRaw().longIterator(); -+ while (iter.hasNext()) { -+ chunks.add(world.getChunkAt(iter.nextLong(), false)); -+ } - return ObjectSets.unmodifiable(chunks); - } - - public static boolean isChunkSent(final ServerPlayer player, final long chunkKey) { -- return player.getChunkTrackingView().contains(new ChunkPos(chunkKey)); -+ return player.moonrise$getChunkLoader().getSentChunksRaw().contains(chunkKey); - } - } diff --git a/paper-server/patches/features/0021-Moonrise-optimisation-patches.patch b/paper-server/patches/features/0021-Moonrise-optimisation-patches.patch index 491cf50e1c..8bdfa4ff3f 100644 --- a/paper-server/patches/features/0021-Moonrise-optimisation-patches.patch +++ b/paper-server/patches/features/0021-Moonrise-optimisation-patches.patch @@ -22768,19 +22768,20 @@ index 0000000000000000000000000000000000000000..689ce367164e79e0426eeecb81dbbc52 + private SaveUtil() {} +} diff --git a/io/papermc/paper/FeatureHooks.java b/io/papermc/paper/FeatureHooks.java -index 184e6c6fe2ba522d0ea0774604839320c4152371..b329eb069f5b3d4f33a94d2045cb8f250d2a5684 100644 +index 184e6c6fe2ba522d0ea0774604839320c4152371..460bb584db04b582f3297ae419183f430aff1ec0 100644 --- a/io/papermc/paper/FeatureHooks.java +++ b/io/papermc/paper/FeatureHooks.java -@@ -1,6 +1,8 @@ +@@ -1,6 +1,9 @@ package io.papermc.paper; import io.papermc.paper.command.PaperSubcommand; +import io.papermc.paper.command.subcommands.ChunkDebugCommand; +import io.papermc.paper.command.subcommands.FixLightCommand; ++import it.unimi.dsi.fastutil.longs.LongIterator; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.LongSets; -@@ -31,9 +33,12 @@ import org.bukkit.World; +@@ -31,9 +34,12 @@ import org.bukkit.World; public final class FeatureHooks { public static void initChunkTaskScheduler(final boolean useParallelGen) { @@ -22793,7 +22794,35 @@ index 184e6c6fe2ba522d0ea0774604839320c4152371..b329eb069f5b3d4f33a94d2045cb8f25 } public static LevelChunkSection createSection(final Registry biomeRegistry, final Level level, final ChunkPos chunkPos, final int chunkSection) { -@@ -79,89 +84,30 @@ public final class FeatureHooks { +@@ -59,18 +65,19 @@ public final class FeatureHooks { + } + + public static Set getSentChunkKeys(final ServerPlayer player) { +- final LongSet keys = new LongOpenHashSet(); +- player.getChunkTrackingView().forEach(pos -> keys.add(pos.longKey)); +- return LongSets.unmodifiable(keys); ++ return LongSets.unmodifiable(player.moonrise$getChunkLoader().getSentChunksRaw().clone()); // Paper - rewrite chunk system + } + + public static Set getSentChunks(final ServerPlayer player) { +- final ObjectSet chunks = new ObjectOpenHashSet<>(); ++ // Paper start - rewrite chunk system ++ final LongOpenHashSet rawChunkKeys = player.moonrise$getChunkLoader().getSentChunksRaw(); ++ final ObjectSet chunks = new ObjectOpenHashSet<>(rawChunkKeys.size()); + final World world = player.serverLevel().getWorld(); +- player.getChunkTrackingView().forEach(pos -> { +- final org.bukkit.Chunk chunk = world.getChunkAt(pos.longKey); +- chunks.add(chunk); +- }); ++ final LongIterator iter = player.moonrise$getChunkLoader().getSentChunksRaw().longIterator(); ++ while (iter.hasNext()) { ++ chunks.add(world.getChunkAt(iter.nextLong(), false)); ++ } ++ // Paper end - rewrite chunk system + return ObjectSets.unmodifiable(chunks); + } + +@@ -79,89 +86,30 @@ public final class FeatureHooks { } public static boolean isSpiderCollidingWithWorldBorder(final Spider spider) { @@ -22888,7 +22917,7 @@ index 184e6c6fe2ba522d0ea0774604839320c4152371..b329eb069f5b3d4f33a94d2045cb8f25 long chunkKey = chunkTickets.getLongKey(); net.minecraft.util.SortedArraySet> tickets = chunkTickets.getValue(); -@@ -183,15 +129,15 @@ public final class FeatureHooks { +@@ -183,15 +131,15 @@ public final class FeatureHooks { } public static int getViewDistance(net.minecraft.server.level.ServerLevel world) { @@ -22907,7 +22936,7 @@ index 184e6c6fe2ba522d0ea0774604839320c4152371..b329eb069f5b3d4f33a94d2045cb8f25 } public static void setViewDistance(net.minecraft.server.level.ServerLevel world, int distance) { -@@ -209,31 +155,31 @@ public final class FeatureHooks { +@@ -209,31 +157,31 @@ public final class FeatureHooks { } public static void setSendViewDistance(net.minecraft.server.level.ServerLevel world, int distance) { diff --git a/feature-patches/1060-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/paper-server/patches/features/0027-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch similarity index 99% rename from feature-patches/1060-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch rename to paper-server/patches/features/0027-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch index 0561b403fb..454bf1d95d 100644 --- a/feature-patches/1060-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch +++ b/paper-server/patches/features/0027-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch @@ -7,7 +7,6 @@ Subject: [PATCH] Only write chunk data to disk if it serializes without This ensures at least a valid version of the chunk exists on disk, even if outdated - diff --git a/net/minecraft/world/level/chunk/storage/RegionFile.java b/net/minecraft/world/level/chunk/storage/RegionFile.java index 7da388ffab162c282cad0f297bb7304f3c2abbaf..ff4fc280409f680f3879a495e37cf1925b1a38f1 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFile.java diff --git a/feature-patches/1061-Improved-Watchdog-Support.patch b/paper-server/patches/features/0028-Improved-Watchdog-Support.patch similarity index 86% rename from feature-patches/1061-Improved-Watchdog-Support.patch rename to paper-server/patches/features/0028-Improved-Watchdog-Support.patch index c19faff35a..601c2bb5ea 100644 --- a/feature-patches/1061-Improved-Watchdog-Support.patch +++ b/paper-server/patches/features/0028-Improved-Watchdog-Support.patch @@ -88,7 +88,7 @@ index 3e0e88afcf010d9a3d46e48bca5cbdf98fe97544..8bd7999c17c8772451f873966f8c9096 cause = cause.getCause(); } diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java -index 4437283a5d157eede121b98be0112c1067eded5e..fc9ec242743f755a1f0c9ec6bccd11c82375d655 100644 +index e738405e5112584e02e01df2d5ede2676fa1bffb..560d80cb1177297210646b44ce25fd2fa3766d40 100644 --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java @@ -68,6 +68,7 @@ public class Main { @@ -100,19 +100,18 @@ index 4437283a5d157eede121b98be0112c1067eded5e..fc9ec242743f755a1f0c9ec6bccd11c8 /* CraftBukkit start - Replace everything OptionParser optionParser = new OptionParser(); diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 22dc6bec58702762e4a31415f9aed2df2b3ad0d6..73704871594ed7372d2b9dc332051cae741beb75 100644 +index 43306cac3549a03612077df3aacf501051d05a01..d077debf5936050484856e0b84f764967b5d3f5c 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -302,6 +302,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping - public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation -+ public volatile Thread shutdownThread; // Paper -+ public volatile boolean abnormalExit; // Paper - - public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -395,6 +397,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { +@@ -601,7 +601,13 @@ public class Connection extends SimpleChannelInboundHandler> { if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener) || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) { @@ -153,11 +95,11 @@ index e65c62dbe4c1560ae153e4c4344e9194c783a2f4..4535858701b2bb232b9d2feb2af65515 + // Paper end - detailed watchdog information } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 9cc47bda7197ca3f63b0ede9905c9a13931f84ed..05f45b490e823a455b23b23b26a7da3b447059ea 100644 +index 131ebdaec9ff09635689001e3b85bbe5845fbf98..9caa06f09409d36abf9e0a770ba004f4049e8e09 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -956,7 +956,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } +@@ -1239,7 +1239,26 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + // Paper start - log detailed entity tick information @@ -183,7 +125,7 @@ index 9cc47bda7197ca3f63b0ede9905c9a13931f84ed..05f45b490e823a455b23b23b26a7da3b entity.setOldPosAndRot(); ProfilerFiller profilerFiller = Profiler.get(); entity.tickCount++; -@@ -972,6 +991,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1255,6 +1274,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 } @@ -198,10 +140,10 @@ index 9cc47bda7197ca3f63b0ede9905c9a13931f84ed..05f45b490e823a455b23b23b26a7da3b private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 5a67aa9f1fe103e5622ed6fa93bc4bc25ddbb688..1ff09959aa95d9822ccb6724bbb3f441c768511a 100644 +index 3fd7f6bcdeff271a9843b2f2454f92d92069f539..3cefe3de62e3d6af7b514eb2f3df8e63c5aa5c1f 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -956,8 +956,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1062,8 +1062,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.onGround; } @@ -245,7 +187,7 @@ index 5a67aa9f1fe103e5622ed6fa93bc4bc25ddbb688..1ff09959aa95d9822ccb6724bbb3f441 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -1075,6 +1110,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1181,6 +1216,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess profilerFiller.pop(); } } @@ -259,7 +201,7 @@ index 5a67aa9f1fe103e5622ed6fa93bc4bc25ddbb688..1ff09959aa95d9822ccb6724bbb3f441 } private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) { -@@ -4348,7 +4390,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4643,7 +4685,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setDeltaMovement(Vec3 deltaMovement) { @@ -269,7 +211,7 @@ index 5a67aa9f1fe103e5622ed6fa93bc4bc25ddbb688..1ff09959aa95d9822ccb6724bbb3f441 } public void addDeltaMovement(Vec3 addend) { -@@ -4445,7 +4489,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4749,7 +4793,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - Fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/feature-patches/1063-Entity-load-save-limit-per-chunk.patch b/paper-server/patches/features/0030-Entity-load-save-limit-per-chunk.patch similarity index 99% rename from feature-patches/1063-Entity-load-save-limit-per-chunk.patch rename to paper-server/patches/features/0030-Entity-load-save-limit-per-chunk.patch index a931c2cffe..7f3828e1a2 100644 --- a/feature-patches/1063-Entity-load-save-limit-per-chunk.patch +++ b/paper-server/patches/features/0030-Entity-load-save-limit-per-chunk.patch @@ -8,7 +8,6 @@ to a chunk. The default values of -1 disable the limit. Although defaults are only included for certain entites, this allows setting limits for any entity type. - diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java index 7aea4e343581b977d11af90f9f65eac3532eade1..d21ce54ebb5724c04eadf56a2cde701d5eeb5db2 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java diff --git a/feature-patches/1064-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/paper-server/patches/features/0031-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch similarity index 99% rename from feature-patches/1064-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch rename to paper-server/patches/features/0031-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index 83577de6ed..e35d6a31a9 100644 --- a/feature-patches/1064-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/paper-server/patches/features/0031-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -9,7 +9,6 @@ we instead drop the current regionfile header and recalculate - hoping that at least then we don't swap chunks, and maybe recover them all. - diff --git a/net/minecraft/world/level/chunk/storage/RegionBitmap.java b/net/minecraft/world/level/chunk/storage/RegionBitmap.java index 64a718c98f799c62a5bb28e1e8e5f66cc96c915d..666f2e967c99f78422c83fb20e1a3bf3efa7845e 100644 --- a/net/minecraft/world/level/chunk/storage/RegionBitmap.java diff --git a/feature-patches/1066-Incremental-chunk-and-player-saving.patch b/paper-server/patches/features/0032-Incremental-chunk-and-player-saving.patch similarity index 85% rename from feature-patches/1066-Incremental-chunk-and-player-saving.patch rename to paper-server/patches/features/0032-Incremental-chunk-and-player-saving.patch index 17ee1796ca..282b9eb257 100644 --- a/feature-patches/1066-Incremental-chunk-and-player-saving.patch +++ b/paper-server/patches/features/0032-Incremental-chunk-and-player-saving.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Incremental chunk and player saving diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index f4fba4e2d12c7ab4b4eb9858cd738a9678a2d203..a0a75c84379432ccc525ab22d476c358c77f663b 100644 +index d077debf5936050484856e0b84f764967b5d3f5c..75efd8f11a42696319c0908b7cf911cf976a31b6 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -862,7 +862,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop chunks) { profiler.popPush("naturalSpawnCount"); int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); @@ -78,10 +78,10 @@ index 2f49dbc919f7f5eea9abce6106723c72f5ae45fb..078f208e104a652ce48458150389d19e profiler.popPush("spawnAndTick"); boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 0f00db82e85c9e510c2e4fe4065291971c408dad..dab58457ed02d3f8153c07de101262b1a0182d71 100644 +index a97b0b177a1fb0557af2af4d1f192513d7c0390d..4f8ef57d66a4562df0f5447988797cbdfbd3c9d5 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -368,6 +368,10 @@ public class ServerPlayer extends Player { +@@ -368,6 +368,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc public boolean queueHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; // Paper end - cancellable death event @@ -93,7 +93,7 @@ index 0f00db82e85c9e510c2e4fe4065291971c408dad..dab58457ed02d3f8153c07de101262b1 public org.bukkit.craftbukkit.entity.CraftPlayer.TransferCookieConnection transferCookieConnection; public String displayName; diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 6e6e028621ccc4597b2c24f54f53cb7f3de603e2..14e99450a8522b79e4c3805bd91439a950bc8f99 100644 +index 913ea92ace9d610c25bf28f703a3b227044aea63..ef8bacbbb43a9b80281a313ca43b7efff5a93e03 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java @@ -72,6 +72,14 @@ public final class NaturalSpawner { diff --git a/feature-patches/1072-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/paper-server/patches/features/0035-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch similarity index 88% rename from feature-patches/1072-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch rename to paper-server/patches/features/0035-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index d94b29471c..a3eacdf9c5 100644 --- a/feature-patches/1072-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/paper-server/patches/features/0035-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Improve cancelling PreCreatureSpawnEvent with per player mob diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index 6c5b2eb411fb60babbb0c74d5c075696ef70b38d..cf439285e4ba9babda228c36aa81dfc49db2c22a 100644 +index 9eed24939fc09f00a9dbce1be2ab9c34d024fd29..b3f498558614243cf633dcd71e3c49c2c55e6e0f 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -256,8 +256,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -255,8 +255,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -37,10 +37,10 @@ index 6c5b2eb411fb60babbb0c74d5c075696ef70b38d..cf439285e4ba9babda228c36aa81dfc4 // Paper end - Optional per player mob spawns diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 078f208e104a652ce48458150389d19ede6808ef..aa141c00a41d49daee8e4ab7be70ce4e4767b105 100644 +index 5576bf1d1d70ab7a010653d3207909b5de867e70..6540b2d6a1062d883811ce240c49d30d1925b291 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -479,7 +479,17 @@ public class ServerChunkCache extends ChunkSource { +@@ -576,7 +576,17 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled // re-set mob counts for (ServerPlayer player : this.level.players) { @@ -60,10 +60,10 @@ index 078f208e104a652ce48458150389d19ede6808ef..aa141c00a41d49daee8e4ab7be70ce4e 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 dab58457ed02d3f8153c07de101262b1a0182d71..2d20f42fbcfb67845323d994843d7b977aa867e0 100644 +index 4f8ef57d66a4562df0f5447988797cbdfbd3c9d5..e350c6ba7bd638d27abe34afd375903e603ad682 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -372,6 +372,7 @@ public class ServerPlayer extends Player { +@@ -372,6 +372,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 @@ -72,7 +72,7 @@ index dab58457ed02d3f8153c07de101262b1a0182d71..2d20f42fbcfb67845323d994843d7b97 public org.bukkit.craftbukkit.entity.CraftPlayer.TransferCookieConnection transferCookieConnection; public String displayName; diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 5e82a8fdaec5a6750040ebb687aa35bba4dcc2ba..23f7fb22906e49babc7784f4b3d1f8ea8e187b1d 100644 +index ef8bacbbb43a9b80281a313ca43b7efff5a93e03..17ce115e887cbbb06ad02ab7ddb488e27342c0e4 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java @@ -285,6 +285,11 @@ public final class NaturalSpawner { diff --git a/feature-patches/2017-Optimize-Hoppers.patch b/paper-server/patches/features/0036-Optimize-Hoppers.patch similarity index 98% rename from feature-patches/2017-Optimize-Hoppers.patch rename to paper-server/patches/features/0036-Optimize-Hoppers.patch index c501740535..eb195ce201 100644 --- a/feature-patches/2017-Optimize-Hoppers.patch +++ b/paper-server/patches/features/0036-Optimize-Hoppers.patch @@ -48,22 +48,22 @@ index 0000000000000000000000000000000000000000..24a2090e068ad3c0d08705050944abdf + } +} diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index d450d4af96716caff4b29a84d1d83ec4010854f0..8657e4fd7c5e0e23b69d9a982408a7d038f0a787 100644 +index 75efd8f11a42696319c0908b7cf911cf976a31b6..b7bb1b6b2c3c892712c44b4e006d9ceebbd8491a 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1563,6 +1563,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - BlockPhysicsEvent serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent + serverLevel.updateLagCompensationTick(); // Paper - lag compensation + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().location()); /* Drop global time updates if (this.tickCount % 20 == 0) { diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index 50cd12def88c9449cad8875c553f5ed9ef1cd791..3d93bb1aac5ad4830fc1dceddb6bebacee28f72a 100644 +index c255e11cb0981bd7e0456d4fd401beb5257be597..d6361863d6a1e364de262d6199373cbd68d1c699 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -815,10 +815,16 @@ public final class ItemStack implements DataComponentHolder { +@@ -808,10 +808,16 @@ public final class ItemStack implements DataComponentHolder { } public ItemStack copy() { @@ -103,7 +103,7 @@ index 2ebdf1ad323bb53dfe9eed319e25856b35a1443c..77618757c0e678532dbab814aceed83f } } diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 60e1e44f328e66d52ebf08476b533fef83bc5eba..eb02249b518c2d262315c4cd5965bec5d81166a1 100644 +index e58a32593e8b42bfc534d13457240860293dd3f4..5cd1326ad5d046c88b2b3449d610a78fa880b4cd 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -139,18 +139,56 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen diff --git a/feature-patches/1070-Optimise-collision-checking-in-player-move-packet-ha.patch b/paper-server/patches/features/0037-Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 92% rename from feature-patches/1070-Optimise-collision-checking-in-player-move-packet-ha.patch rename to paper-server/patches/features/0037-Optimise-collision-checking-in-player-move-packet-ha.patch index 9f8d28a29d..a2b8f8a47e 100644 --- a/feature-patches/1070-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/paper-server/patches/features/0037-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -1,13 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf Date: Thu, 2 Jul 2020 12:02:43 -0700 Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f82dbbefb 100644 +index e4869774b2a8096467e5913d73af5bde93dbcccf..e3c855b9335f3d86ba933e7acdd3fa2981919c99 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -562,7 +562,7 @@ public class ServerGamePacketListenerImpl +@@ -561,7 +561,7 @@ public class ServerGamePacketListenerImpl return; } @@ -16,7 +18,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f d3 = d - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above d4 = d1 - this.vehicleLastGoodY; // Paper - diff on change, used for checking large move vectors above d5 = d2 - this.vehicleLastGoodZ; // Paper - diff on change, used for checking large move vectors above -@@ -572,6 +572,7 @@ public class ServerGamePacketListenerImpl +@@ -571,6 +571,7 @@ public class ServerGamePacketListenerImpl } rootVehicle.move(MoverType.PLAYER, new Vec3(d3, d4, d5)); @@ -24,7 +26,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f d3 = d - rootVehicle.getX(); d4 = d1 - rootVehicle.getY(); if (d4 > -0.5 || d4 < 0.5) { -@@ -582,14 +583,22 @@ public class ServerGamePacketListenerImpl +@@ -581,14 +582,22 @@ public class ServerGamePacketListenerImpl d7 = d3 * d3 + d4 * d4 + d5 * d5; boolean flag2 = false; if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot @@ -50,7 +52,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f rootVehicle.absMoveTo(x, y, z, f, f1); this.player.absMoveTo(x, y, z, this.player.getYRot(), this.player.getXRot()); // CraftBukkit this.send(ClientboundMoveVehiclePacket.fromEntity(rootVehicle)); -@@ -667,9 +676,32 @@ public class ServerGamePacketListenerImpl +@@ -666,9 +675,32 @@ public class ServerGamePacketListenerImpl } private boolean noBlocksAround(Entity entity) { @@ -86,7 +88,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f } @Override -@@ -1361,7 +1393,7 @@ public class ServerGamePacketListenerImpl +@@ -1360,7 +1392,7 @@ public class ServerGamePacketListenerImpl } } @@ -95,7 +97,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f d3 = d - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d4 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above d5 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above -@@ -1400,6 +1432,7 @@ public class ServerGamePacketListenerImpl +@@ -1399,6 +1431,7 @@ public class ServerGamePacketListenerImpl boolean flag1 = this.player.verticalCollisionBelow; this.player.move(MoverType.PLAYER, new Vec3(d3, d4, d5)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move @@ -103,7 +105,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f // Paper start - prevent position desync if (this.awaitingPositionFromClient != null) { return; // ... thanks Mojang for letting move calls teleport across dimensions. -@@ -1431,7 +1464,17 @@ public class ServerGamePacketListenerImpl +@@ -1430,7 +1463,17 @@ public class ServerGamePacketListenerImpl } // Paper start - Add fail move event @@ -122,7 +124,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f if (teleportBack) { io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.CLIPPED_INTO_BLOCK, toX, toY, toZ, toYaw, toPitch, false); -@@ -1567,7 +1610,7 @@ public class ServerGamePacketListenerImpl +@@ -1566,7 +1609,7 @@ public class ServerGamePacketListenerImpl private boolean updateAwaitingTeleport() { if (this.awaitingPositionFromClient != null) { @@ -131,7 +133,7 @@ index 083585a6ab84394a2bc2de6f317c69c7b596e917..b7365e8b410a9e37257cf0a4e79a6f4f this.awaitingTeleportTime = this.tickCount; this.teleport( this.awaitingPositionFromClient.x, -@@ -1586,6 +1629,33 @@ public class ServerGamePacketListenerImpl +@@ -1585,6 +1628,33 @@ public class ServerGamePacketListenerImpl } }