diff --git a/patches/server/0006-MC-Utils.patch b/patches/server/0006-MC-Utils.patch index b64475fe72..9cc9b4c714 100644 --- a/patches/server/0006-MC-Utils.patch +++ b/patches/server/0006-MC-Utils.patch @@ -3079,7 +3079,7 @@ index e9d2034f0753670c2ce69cc93c7e98e89af65c87..2b62f4664f439808661d559dc99762bf @Override diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401efca995293 100644 +index 9591f50922343283597bad6d9ac17c175d8ae230..48c876381d75c66f24d59bd2c415dd7de293afee 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -44,6 +44,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -3090,7 +3090,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef public class ServerChunkCache extends ChunkSource { -@@ -66,6 +67,158 @@ public class ServerChunkCache extends ChunkSource { +@@ -66,6 +67,156 @@ public class ServerChunkCache extends ChunkSource { @Nullable @VisibleForDebug private NaturalSpawner.SpawnState lastSpawnState; @@ -3227,9 +3227,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef + + try { + if (onLoad != null) { -+ chunkMap.callbackExecutor.execute(() -> { -+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback. -+ }); ++ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback. + } + } catch (Throwable thr) { + if (thr instanceof ThreadDeath) { @@ -3249,7 +3247,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, boolean flag, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier supplier) { this.level = world; -@@ -127,6 +280,49 @@ public class ServerChunkCache extends ChunkSource { +@@ -127,6 +278,49 @@ public class ServerChunkCache extends ChunkSource { this.lastChunk[0] = chunk; } @@ -3299,7 +3297,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef @Nullable @Override public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) { -@@ -453,7 +649,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -453,7 +647,7 @@ public class ServerChunkCache extends ChunkSource { } this.level.getProfiler().popPush("broadcast"); diff --git a/patches/server/0009-Timings-v2.patch b/patches/server/0009-Timings-v2.patch index f2c25d1411..e52e71ce1a 100644 --- a/patches/server/0009-Timings-v2.patch +++ b/patches/server/0009-Timings-v2.patch @@ -1135,10 +1135,10 @@ index 2b62f4664f439808661d559dc99762bfbac09b16..4788946d7fb25c1b0f26e6a038924c4a public void broadcast(Entity entity, Packet packet) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947ba2c285ae 100644 +index 48c876381d75c66f24d59bd2c415dd7de293afee..e11b4be6e6990101ce77b6349ab8c70453e835a5 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -348,13 +348,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -346,13 +346,15 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -1156,7 +1156,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -554,7 +556,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -552,7 +554,9 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -1166,7 +1166,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b } @Override -@@ -592,7 +596,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -590,7 +594,9 @@ public class ServerChunkCache extends ChunkSource { this.runDistanceManagerUpdates(); this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.getProfiler().popPush("chunks"); @@ -1176,7 +1176,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b this.level.timings.doChunkUnload.startTiming(); // Spigot this.level.getProfiler().popPush("unload"); this.chunkMap.tick(booleansupplier); -@@ -616,14 +622,17 @@ public class ServerChunkCache extends ChunkSource { +@@ -614,14 +620,17 @@ public class ServerChunkCache extends ChunkSource { boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit this.level.getProfiler().push("naturalSpawnCount"); @@ -1194,7 +1194,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b list.forEach((playerchunk) -> { Optional optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); -@@ -637,15 +646,18 @@ public class ServerChunkCache extends ChunkSource { +@@ -635,15 +644,18 @@ public class ServerChunkCache extends ChunkSource { NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2); } @@ -1215,7 +1215,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b } this.level.getProfiler().popPush("broadcast"); -@@ -653,15 +665,20 @@ public class ServerChunkCache extends ChunkSource { +@@ -651,15 +663,20 @@ public class ServerChunkCache extends ChunkSource { Optional optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error Objects.requireNonNull(playerchunk); diff --git a/patches/server/0173-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0173-PlayerNaturallySpawnCreaturesEvent.patch index 8659753d45..9eacc012cb 100644 --- a/patches/server/0173-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0173-PlayerNaturallySpawnCreaturesEvent.patch @@ -36,10 +36,10 @@ index 5ce8ac377b0d2b05dd90baa67f420945cc419609..919a489a5c7b338659c62ae67fc0a6ce }); } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index c5bffd1b40ca9ae3c973044c1ad4947ba2c285ae..918555ba0af8a779ad55c7cf73f615eb804d00d9 100644 +index e11b4be6e6990101ce77b6349ab8c70453e835a5..a778eff06a24a665874a315704f00dc5996420c9 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -632,6 +632,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -630,6 +630,15 @@ public class ServerChunkCache extends ChunkSource { List list = Lists.newArrayList(this.chunkMap.getChunks()); Collections.shuffle(list); @@ -56,7 +56,7 @@ index c5bffd1b40ca9ae3c973044c1ad4947ba2c285ae..918555ba0af8a779ad55c7cf73f615eb list.forEach((playerchunk) -> { Optional optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 823fc38b5bbf5eac2d2e7cc48c4b0557d252f960..fb42d7e3a1a23c02e8fd2cc04e6986ead581018c 100644 +index 9761078ba0c984eec303e96d1ee64fbce659075c..ca9662d92db176270ec5490ecc51208b666bc594 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch b/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch index 1db909c795..2fe19391b9 100644 --- a/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch +++ b/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch @@ -2344,7 +2344,7 @@ index 24f72050229031898fd9da585ad2ceec835f83f9..2b235508ffd01de14714de1a31c2139e ChunkHolder.FullChunkStatus playerchunk_state1 = ChunkHolder.getFullChunkStatus(this.ticketLevel); // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa1a240c62 100644 +index db4dac607cf24d3d2cd407255c60678ae4be1a1b..ed208c058f5e22111284ffa6985b223565c83f67 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -408,6 +408,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -2418,7 +2418,7 @@ index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa + } + + com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.level, chunkPos.x, chunkPos.z, -+ poiData, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); ++ poiData, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY); + + if (!chunk.isUnsaved()) { + return; @@ -2439,7 +2439,7 @@ index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa + asyncSaveData = ChunkSerializer.getAsyncSaveData(this.level, chunk); + } + -+ this.level.asyncChunkTaskManager.scheduleChunkSave(chunkPos.x, chunkPos.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY, ++ this.level.asyncChunkTaskManager.scheduleChunkSave(chunkPos.x, chunkPos.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY, + asyncSaveData, chunk); + + chunk.setUnsaved(false); @@ -2623,10 +2623,10 @@ index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa return this.poiManager; } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1cac53072 100644 +index a778eff06a24a665874a315704f00dc5996420c9..13313635e994f848edbe3e3fe607a21f8baa1790 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -322,10 +322,128 @@ public class ServerChunkCache extends ChunkSource { +@@ -320,10 +320,128 @@ public class ServerChunkCache extends ChunkSource { return ret; } // Paper end @@ -2755,7 +2755,7 @@ index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1 if (Thread.currentThread() != this.mainThread) { return (ChunkAccess) CompletableFuture.supplyAsync(() -> { return this.getChunk(x, z, leastStatus, create); -@@ -348,13 +466,18 @@ public class ServerChunkCache extends ChunkSource { +@@ -346,13 +464,18 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -2775,7 +2775,7 @@ index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1 this.level.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -441,6 +564,11 @@ public class ServerChunkCache extends ChunkSource { +@@ -439,6 +562,11 @@ public class ServerChunkCache extends ChunkSource { } private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { @@ -2787,7 +2787,7 @@ index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1 ChunkPos chunkcoordintpair = new ChunkPos(i, j); long k = chunkcoordintpair.toLong(); int l = 33 + ChunkStatus.getDistance(chunkstatus); -@@ -838,11 +966,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -836,11 +964,12 @@ public class ServerChunkCache extends ChunkSource { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task public boolean pollTask() { try { @@ -2925,7 +2925,7 @@ index 265d147de39e306fac27913b2dc3899e82c63796..912171f8b3280a6c45311104216e04d6 StringReader stringreader = new StringReader(packet.getCommand()); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 3ca8b13744b406c3e563747f0cb69647c94103df..6c3455823f996e0421975b7f4a00f4e333e9f514 100644 +index 3ca8b13744b406c3e563747f0cb69647c94103df..7b1d2748328ffc1447bcacd1316f2c6fdbaf92b0 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -37,9 +37,11 @@ public class PoiManager extends SectionStorage { @@ -2954,7 +2954,7 @@ index 3ca8b13744b406c3e563747f0cb69647c94103df..6c3455823f996e0421975b7f4a00f4e3 + data = this.getData(chunkcoordintpair); + } + com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, -+ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); ++ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY); + } + // Paper end this.distanceTracker.runAllUpdates(); diff --git a/patches/server/0336-Fix-World-isChunkGenerated-calls.patch b/patches/server/0336-Fix-World-isChunkGenerated-calls.patch index 1107c074b6..9ffa6f50a4 100644 --- a/patches/server/0336-Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/0336-Fix-World-isChunkGenerated-calls.patch @@ -32,7 +32,7 @@ index 7af33e8c470e499b7ec47467cce7df699c96873a..2720f4a51ffc8c9748932be55cebd507 public CompletableFuture> getFutureIfPresentUnchecked(ChunkStatus leastStatus) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6d024db8bfbd5139d4c94be3d3a48cfa1a240c62..6f5e1f7c23b19257c89b7c5a992ad76623bf4006 100644 +index ed208c058f5e22111284ffa6985b223565c83f67..10a4939b1169dfc3012a66d7af2f4a36616e5fb9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -84,6 +84,7 @@ import net.minecraft.world.level.chunk.ProtoChunk; @@ -108,10 +108,10 @@ index 6d024db8bfbd5139d4c94be3d3a48cfa1a240c62..6f5e1f7c23b19257c89b7c5a992ad766 // Spigot start return this.isOutsideOfRange(chunkPos, false); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index c0bde909755190603e9b4946fe924ba1cac53072..6dc28903dfefd6b454252f70763ce2b93773b75e 100644 +index 13313635e994f848edbe3e3fe607a21f8baa1790..d5ec4a19869e04877869e3bb53c98a7e5943c931 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -323,6 +323,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -321,6 +321,7 @@ public class ServerChunkCache extends ChunkSource { } // Paper end // Paper start - async chunk io diff --git a/patches/server/0372-implement-optional-per-player-mob-spawns.patch b/patches/server/0372-implement-optional-per-player-mob-spawns.patch index 37be063482..d65990f364 100644 --- a/patches/server/0372-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0372-implement-optional-per-player-mob-spawns.patch @@ -25,7 +25,7 @@ index fe79c0add4f7cb18d487c5bb9415c40c5b551ea2..8d9ddad1879e7616d980ca70de8aecac poiUnload = Timings.ofSafe(name + "Chunk unload - POI"); chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk"); diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 31f192773fe5159ed2109f0d367e6b7287ffd186..f2e4939c8144b9bc7441130302ab3e2358c42063 100644 +index 4e7fbe5367c6cf91d54545e7829ec74e9accba8a..7dc740d392becc622e98a5a83be332adf6fcc4e8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -574,5 +574,10 @@ public class PaperWorldConfig { @@ -545,7 +545,7 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c7d708cc5c20d46ed085f1f1db7666246614a57d..b2d88e0423d93fdb45dc8ca7d53c98069ade749e 100644 +index a10f33a301e40484c7e253c6235c93c54918bf6c..5a8b919cd3a2aa3c12ae16cf970f7ce36cdeb4aa 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -145,6 +145,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -591,10 +591,10 @@ index c7d708cc5c20d46ed085f1f1db7666246614a57d..b2d88e0423d93fdb45dc8ca7d53c9806 double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 6dc28903dfefd6b454252f70763ce2b93773b75e..01bcd74b846773f3922e0e77e46ecda3b19cd0be 100644 +index d5ec4a19869e04877869e3bb53c98a7e5943c931..8763b20019ad0d3beae3825d126c4ccab1e1252d 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -753,7 +753,22 @@ public class ServerChunkCache extends ChunkSource { +@@ -751,7 +751,22 @@ public class ServerChunkCache extends ChunkSource { this.level.getProfiler().push("naturalSpawnCount"); this.level.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.distanceManager.getNaturalSpawnChunkCount(); @@ -619,7 +619,7 @@ index 6dc28903dfefd6b454252f70763ce2b93773b75e..01bcd74b846773f3922e0e77e46ecda3 this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 34c7c414cd3f92395a701f0f494ebab82c7b67b3..fd0734cc9a7b1d918f635048878227f8b18944e1 100644 +index d234f08782b1a0c50714b8911d048699dc7741d5..d581945ff25f8a7a5e00599e9a939f2c0728b601 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -224,6 +224,11 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0375-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/patches/server/0375-Optimise-getChunkAt-calls-for-loaded-chunks.patch index acafe7e3ae..b40945557e 100644 --- a/patches/server/0375-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/patches/server/0375-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 01bcd74b846773f3922e0e77e46ecda3b19cd0be..7d4efbf0a705bea7e088a9991341e3abfd1b1727 100644 +index 8763b20019ad0d3beae3825d126c4ccab1e1252d..072ef1efde7bc9dd9343310996339be9c5f70f6b 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -450,6 +450,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -448,6 +448,12 @@ public class ServerChunkCache extends ChunkSource { return this.getChunk(x, z, leastStatus, create); }, this.mainThreadProcessor).join(); } else { @@ -23,7 +23,7 @@ index 01bcd74b846773f3922e0e77e46ecda3b19cd0be..7d4efbf0a705bea7e088a9991341e3ab ProfilerFiller gameprofilerfiller = this.level.getProfiler(); gameprofilerfiller.incrementCounter("getChunk"); -@@ -501,39 +507,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -499,39 +505,7 @@ public class ServerChunkCache extends ChunkSource { if (Thread.currentThread() != this.mainThread) { return null; } else { diff --git a/patches/server/0376-Add-debug-for-sync-chunk-loads.patch b/patches/server/0376-Add-debug-for-sync-chunk-loads.patch index 1d84f0d3eb..0acf59d5bd 100644 --- a/patches/server/0376-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0376-Add-debug-for-sync-chunk-loads.patch @@ -13,7 +13,7 @@ chunks, however it must be enabled by setting the startup flag /paper syncloadinfo clear diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index c6254f39f98b821f75a21c0ecea457f73247385f..30452d2cef4d296513d582f65264ae58ad7609fc 100644 +index 3091c100eaf5a86ba270ef0d96de1852a2a0ac9e..51e469146f0712a509071c8438ff6b69f961f945 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -1,11 +1,17 @@ @@ -305,10 +305,10 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 7d4efbf0a705bea7e088a9991341e3abfd1b1727..5891d79abc5dc0b8ab85cc40819249f399fd1251 100644 +index 072ef1efde7bc9dd9343310996339be9c5f70f6b..19544c9e6393cba361c9cf00d5767a06686426bf 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -482,6 +482,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -480,6 +480,7 @@ public class ServerChunkCache extends ChunkSource { this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1); // Paper end @@ -317,7 +317,7 @@ index 7d4efbf0a705bea7e088a9991341e3abfd1b1727..5891d79abc5dc0b8ab85cc40819249f3 chunkproviderserver_a.managedBlock(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fac80bdbf0fa68cd8e63130a6a9de3b60a44583e..00a064305dd8c671566dc32b8cd85f593ad139a3 100644 +index afb62f6d7d0c4dc80e9ceea6c6fe420f551b40b6..54008a97cc88ac431c3517c19160903408ee9255 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -276,6 +276,12 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch b/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch index a078a59e1b..7c89517669 100644 --- a/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch +++ b/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch @@ -926,10 +926,10 @@ index 1dd1b9afaee38fdc994ad0a069bd63b02eedf55c..bbb94e8a5e3585701849e025b534a69a }); // Paper end diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 5891d79abc5dc0b8ab85cc40819249f399fd1251..6f33d4f4ca86bfcad907b451a56e71de0d4585d5 100644 +index 19544c9e6393cba361c9cf00d5767a06686426bf..12bf78c993d2360c37b143b51c425fc5fdf33647 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -219,6 +219,18 @@ public class ServerChunkCache extends ChunkSource { +@@ -217,6 +217,18 @@ public class ServerChunkCache extends ChunkSource { }, this.mainThreadProcessor); } // Paper end diff --git a/patches/server/0396-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/patches/server/0396-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 3ddff39d3e..73fb032aa6 100644 --- a/patches/server/0396-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/patches/server/0396-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -70,7 +70,7 @@ index 4bc418f45c6f16a9a1c78b6688625268870a96ad..2d5b8e35d52b0dfd075af81a3a936d8a List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 2b291296821dc6d6a8437bd977eeba517cdb5003..962028a58ee54b99be20905c1fd16cfe15c82175 100644 +index 22517debf77123b2d02f2127eba4b3700040c97d..5e828201871086994f7037a50a0d12aecb0c0ece 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -112,9 +112,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -233,10 +233,10 @@ index 2b291296821dc6d6a8437bd977eeba517cdb5003..962028a58ee54b99be20905c1fd16cfe while (objectbidirectionaliterator.hasNext()) { Entry entry = (Entry) objectbidirectionaliterator.next(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 6f33d4f4ca86bfcad907b451a56e71de0d4585d5..228ff4b52a017e8af987f60d84b7906c9be098f0 100644 +index 12bf78c993d2360c37b143b51c425fc5fdf33647..4efefcea2dcf895c4847269bc258cc338f21f230 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -760,7 +760,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -758,7 +758,7 @@ public class ServerChunkCache extends ChunkSource { this.lastSpawnState = spawnercreature_d; this.level.getProfiler().pop(); diff --git a/patches/server/0397-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/patches/server/0397-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index 6551716f63..9b2295e1b2 100644 --- a/patches/server/0397-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/patches/server/0397-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -147,10 +147,10 @@ index ce5cb696dfa2ff9a07ab9e7547ba54920e58f53a..3c299bae9095ddc3732f1817c2d52f8d // Spigot Start CrashReport crashreport; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f31ac1be2 100644 +index 4efefcea2dcf895c4847269bc258cc338f21f230..0765eefbba823570149f076a0d4d6aba1aa4e863 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -709,6 +709,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -707,6 +707,7 @@ public class ServerChunkCache extends ChunkSource { this.level.getProfiler().push("purge"); this.level.timings.doChunkMap.startTiming(); // Spigot this.distanceManager.purgeStaleTickets(); @@ -158,7 +158,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f this.runDistanceManagerUpdates(); this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.getProfiler().popPush("chunks"); -@@ -718,6 +719,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -716,6 +717,7 @@ public class ServerChunkCache extends ChunkSource { this.level.timings.doChunkUnload.startTiming(); // Spigot this.level.getProfiler().popPush("unload"); this.chunkMap.tick(booleansupplier); @@ -166,7 +166,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f this.level.timings.doChunkUnload.stopTiming(); // Spigot this.level.getProfiler().pop(); this.clearCache(); -@@ -773,6 +775,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -771,6 +773,7 @@ public class ServerChunkCache extends ChunkSource { }; // Paper end this.level.timings.chunkTicks.startTiming(); // Paper @@ -174,7 +174,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f list.forEach((playerchunk) -> { Optional optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); -@@ -784,6 +787,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -782,6 +785,7 @@ public class ServerChunkCache extends ChunkSource { chunk.setInhabitedTime(chunk.getInhabitedTime() + j); if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2); @@ -182,7 +182,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f } // this.level.timings.doTickTiles.startTiming(); // Spigot // Paper -@@ -801,7 +805,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -799,7 +803,7 @@ public class ServerChunkCache extends ChunkSource { } this.level.getProfiler().popPush("broadcast"); @@ -191,7 +191,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f Optional optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error Objects.requireNonNull(playerchunk); -@@ -965,6 +969,41 @@ public class ServerChunkCache extends ChunkSource { +@@ -963,6 +967,41 @@ public class ServerChunkCache extends ChunkSource { super.doRunTask(task); } diff --git a/patches/server/0414-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0414-Fix-Chunk-Post-Processing-deadlock-risk.patch index 8d65eeaef8..5e95be778a 100644 --- a/patches/server/0414-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/0414-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,7 +25,7 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6d810cdb538d078dbf7ccd2ef84a4be27eb1f3e7..aa9846c7d6b8499e01bf0ffeece6a940e0879328 100644 +index b5459099b368ff6c8e62d254196350c2189e52a9..e7b29f632ee7a2fa77a191b25256134dae620739 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -195,6 +195,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -46,10 +46,10 @@ index 6d810cdb538d078dbf7ccd2ef84a4be27eb1f3e7..aa9846c7d6b8499e01bf0ffeece6a940 completablefuture1.thenAcceptAsync((either) -> { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index c9e4802251dd1582e467112d45a3bd5f31ac1be2..a50ad7a3268ea87be36f9718b1030d5ff56628b2 100644 +index 0765eefbba823570149f076a0d4d6aba1aa4e863..5009a782d80d5c358acb5a412d63a567fd7db3ab 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1016,6 +1016,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1014,6 +1014,7 @@ public class ServerChunkCache extends ChunkSource { return super.pollTask() || execChunkTask; // Paper } } finally { diff --git a/patches/server/0421-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch b/patches/server/0421-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch deleted file mode 100644 index 81d461f58d..0000000000 --- a/patches/server/0421-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 21 Apr 2020 03:51:53 -0400 -Subject: [PATCH] Allow multiple callbacks to schedule for Callback Executor - -ChunkMapDistance polls multiple entries for pendingChunkUpdates - -Each of these have the potential to move a chunk in and out of -"Loaded" state, which will result in multiple callbacks being -needed within a single tick of ChunkMapDistance - -Use an ArrayDeque to store this Queue - -We make sure to also implement a pattern that is recursion safe too. - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 2b4c35d9bd186fd7c3650a7ad791cd67fb64e635..e7c78106aa34d948a77cf72d5716e17d10beae72 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -178,17 +178,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - public final CallbackExecutor callbackExecutor = new CallbackExecutor(); - public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { - -- private final java.util.Queue queue = new java.util.ArrayDeque<>(); -+ // Paper start - replace impl with recursive safe multi entry queue -+ // it's possible to schedule multiple tasks currently, so it's vital we change this impl -+ // If we recurse into the executor again, we will append to another queue, ensuring task order consistency -+ private java.util.Queue queue = new java.util.ArrayDeque<>(); // Paper - remove final - - @Override - public void execute(Runnable runnable) { -+ if (this.queue == null) { -+ this.queue = new java.util.ArrayDeque<>(); -+ } - this.queue.add(runnable); - } - - @Override - public void run() { -+ if (this.queue == null) { -+ return; -+ } -+ java.util.Queue queue = this.queue; -+ this.queue = null; -+ // Paper end - Runnable task; -- while ((task = this.queue.poll()) != null) { -+ while ((task = queue.poll()) != null) { // Paper - task.run(); - } - } diff --git a/patches/server/0422-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0421-Don-t-fire-BlockFade-on-worldgen-threads.patch similarity index 100% rename from patches/server/0422-Don-t-fire-BlockFade-on-worldgen-threads.patch rename to patches/server/0421-Don-t-fire-BlockFade-on-worldgen-threads.patch diff --git a/patches/server/0423-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0422-Add-phantom-creative-and-insomniac-controls.patch similarity index 97% rename from patches/server/0423-Add-phantom-creative-and-insomniac-controls.patch rename to patches/server/0422-Add-phantom-creative-and-insomniac-controls.patch index 4826e0a4ef..7f0b9aa901 100644 --- a/patches/server/0423-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0422-Add-phantom-creative-and-insomniac-controls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add phantom creative and insomniac controls diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 2d038185846ae34bc301ab93d881022a05ee458b..1460cd36e8d38c1c4318adf818b87961bfe07aec 100644 +index 3eed64b9562257b7a9fdfd51137a9ddf2cc0a84a..91b5267dcb24646c29ea1ff0b50f3b369f984244 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -513,6 +513,13 @@ public class PaperWorldConfig { diff --git a/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0423-Fix-numerous-item-duplication-issues-and-teleport-is.patch similarity index 100% rename from patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch rename to patches/server/0423-Fix-numerous-item-duplication-issues-and-teleport-is.patch diff --git a/patches/server/0425-Implement-Brigadier-Mojang-API.patch b/patches/server/0424-Implement-Brigadier-Mojang-API.patch similarity index 99% rename from patches/server/0425-Implement-Brigadier-Mojang-API.patch rename to patches/server/0424-Implement-Brigadier-Mojang-API.patch index 2c3a091c0d..0e5a87be1f 100644 --- a/patches/server/0425-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0424-Implement-Brigadier-Mojang-API.patch @@ -10,7 +10,7 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/build.gradle.kts b/build.gradle.kts -index 76a8db5ff623b0a3b83a0861f642da67ad2be3aa..2c0b95f3ed2c4f8ba84885ff922fc29a8fb9fe99 100644 +index 5543c8e30c707d7cee5fd0579dd3d3dd7c26a13e..eea412347cef390555166a988058ae877afdfa4a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,7 @@ repositories { diff --git a/patches/server/0426-Villager-Restocks-API.patch b/patches/server/0425-Villager-Restocks-API.patch similarity index 91% rename from patches/server/0426-Villager-Restocks-API.patch rename to patches/server/0425-Villager-Restocks-API.patch index 0a120deee1..405b36f5d2 100644 --- a/patches/server/0426-Villager-Restocks-API.patch +++ b/patches/server/0425-Villager-Restocks-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Villager Restocks API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index a5faa655cb0169ca5088bcc39e7b988135d150d6..0e247979b5ced02c1de422547fc8ebf7067006ee 100644 +index 18fbf866fd7a6de2ed037b8d9c53e25d180be98b..83b7b136794ad855eb0faf839edfcf4a024b2c2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -83,6 +83,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { diff --git a/patches/server/0427-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0426-Validate-PickItem-Packet-and-kick-for-invalid.patch similarity index 100% rename from patches/server/0427-Validate-PickItem-Packet-and-kick-for-invalid.patch rename to patches/server/0426-Validate-PickItem-Packet-and-kick-for-invalid.patch diff --git a/patches/server/0428-Expose-game-version.patch b/patches/server/0427-Expose-game-version.patch similarity index 100% rename from patches/server/0428-Expose-game-version.patch rename to patches/server/0427-Expose-game-version.patch diff --git a/patches/server/0429-Optimize-Voxel-Shape-Merging.patch b/patches/server/0428-Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/server/0429-Optimize-Voxel-Shape-Merging.patch rename to patches/server/0428-Optimize-Voxel-Shape-Merging.patch diff --git a/patches/server/0430-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0429-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 93% rename from patches/server/0430-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/0429-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 0ce2653d49..e0a1bf15fe 100644 --- a/patches/server/0430-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0429-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index dfff422b6f957c65224b269fd57b1e25733a403e..87674042ea6ebf17d9f6f5f0839ae4bd3de07932 100644 +index 1d63b1da588ef8930133d4cf7ca541fe4d753a4b..c687df04b3543df763a4d5225342357355fab7ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -28,6 +28,7 @@ public class Main { diff --git a/patches/server/0431-Implement-Mob-Goal-API.patch b/patches/server/0430-Implement-Mob-Goal-API.patch similarity index 99% rename from patches/server/0431-Implement-Mob-Goal-API.patch rename to patches/server/0430-Implement-Mob-Goal-API.patch index d9a39f4cb1..ddc324d02a 100644 --- a/patches/server/0431-Implement-Mob-Goal-API.patch +++ b/patches/server/0430-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index caea57d19dfd6f44536329d8a283c75c87a49d9d..31a6e07981f20fc0cedbca24cf65807e50ab8142 100644 +index eea412347cef390555166a988058ae877afdfa4a..81d507895572e9c0ec3c87d3745f95067922093a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -48,6 +48,7 @@ dependencies { diff --git a/patches/server/0432-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0431-Use-distance-map-to-optimise-entity-tracker.patch similarity index 96% rename from patches/server/0432-Use-distance-map-to-optimise-entity-tracker.patch rename to patches/server/0431-Use-distance-map-to-optimise-entity-tracker.patch index 4366c81031..0e2715c902 100644 --- a/patches/server/0432-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0431-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74829cbc4e 100644 +index 2b4c35d9bd186fd7c3650a7ad791cd67fb64e635..514d859ab0fbd25e2217c27dfbbdba1f688848c1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -63,6 +63,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; @@ -17,7 +17,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.util.CsvOutput; -@@ -226,11 +227,33 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -214,11 +215,33 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceTickMap; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceNoTickMap; // Paper end - no-tick view distance @@ -51,7 +51,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 // Paper start - no-tick view distance int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); -@@ -247,7 +270,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -235,7 +258,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -64,7 +64,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 // Paper start - no-tick view distance this.playerViewDistanceBroadcastMap.remove(player); this.playerViewDistanceTickMap.remove(player); -@@ -259,6 +286,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -247,6 +274,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -79,7 +79,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 // Paper start - no-tick view distance int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); -@@ -312,6 +347,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -300,6 +335,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world); this.setViewDistance(viewDistance); this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper @@ -125,7 +125,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 // Paper start - no-tick view distance this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance); this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, -@@ -1465,17 +1539,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1453,17 +1527,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void move(ServerPlayer player) { @@ -144,7 +144,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 int i = SectionPos.blockToSectionCoord(player.getBlockX()); int j = SectionPos.blockToSectionCoord(player.getBlockZ()); -@@ -1630,7 +1694,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1618,7 +1682,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); @@ -153,7 +153,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -1674,7 +1738,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1662,7 +1726,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = null; // Paper - We're no longer tracked } @@ -191,7 +191,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 List list = Lists.newArrayList(); List list1 = this.level.players(); -@@ -1783,23 +1877,31 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -1771,23 +1865,31 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); @@ -235,7 +235,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 Iterator iterator; Entity entity1; -@@ -1882,6 +1984,42 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -1870,6 +1972,42 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially this.lastSectionPos = SectionPos.of(entity); } @@ -278,7 +278,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74 public boolean equals(Object object) { return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; } -@@ -1967,7 +2105,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -1955,7 +2093,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially int j = entity.getType().clientTrackingRange() * 16; j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper diff --git a/patches/server/0433-Optimize-isOutsideRange-to-use-distance-maps.patch b/patches/server/0432-Optimize-isOutsideRange-to-use-distance-maps.patch similarity index 96% rename from patches/server/0433-Optimize-isOutsideRange-to-use-distance-maps.patch rename to patches/server/0432-Optimize-isOutsideRange-to-use-distance-maps.patch index c9f6ad406e..5f76e69dfc 100644 --- a/patches/server/0433-Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/patches/server/0432-Optimize-isOutsideRange-to-use-distance-maps.patch @@ -37,10 +37,10 @@ index bbb94e8a5e3585701849e025b534a69a6e67949f..7223c6daf6f0eb959a5cab701096324a // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b838c5ca09d 100644 +index 04ece67574bb95f575edc6f5337a3492e7260102..1e944b2fdfd382bfcc7f94f9a8daf1782931110b 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -241,6 +241,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -229,6 +229,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return MinecraftServer.getServer().getScaledTrackingDistance(vanilla); } // Paper end - use distance map to optimise tracker @@ -58,7 +58,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 void addPlayerToDistanceMaps(ServerPlayer player) { int chunkX = MCUtil.getChunkCoordinate(player.getX()); -@@ -254,6 +265,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -242,6 +253,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); } // Paper end - use distance map to optimise entity tracker @@ -71,7 +71,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 // Paper start - no-tick view distance int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); -@@ -275,6 +292,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -263,6 +280,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerEntityTrackerTrackMaps[i].remove(player); } // Paper end - use distance map to optimise tracker @@ -82,7 +82,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 // Paper start - no-tick view distance this.playerViewDistanceBroadcastMap.remove(player); this.playerViewDistanceTickMap.remove(player); -@@ -294,6 +315,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -282,6 +303,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); } // Paper end - use distance map to optimise entity tracker @@ -92,7 +92,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 // Paper start - no-tick view distance int effectiveTickViewDistance = this.getEffectiveViewDistance(); int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance); -@@ -342,7 +366,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -330,7 +354,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false); this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false);// Paper this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false)); @@ -101,7 +101,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 this.overworldDataStorage = persistentStateManagerFactory; this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world); this.setViewDistance(viewDistance); -@@ -386,6 +410,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -374,6 +398,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); } // Paper end - use distance map to optimise entity tracker @@ -140,7 +140,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 // Paper start - no-tick view distance this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance); this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, -@@ -655,6 +711,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -643,6 +699,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { if (holder != null) { holder.setTicketLevel(level); @@ -148,7 +148,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83 } if (holder != null) { -@@ -1475,29 +1532,50 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1463,29 +1520,50 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return this.isOutsideOfRange(chunkPos, false); } @@ -291,10 +291,10 @@ index b49d380ef088aed3204ec71abc437c348ef004fa..577b391dcba1db712c1e2c83296e1c87 public String getDebugStatus() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d28bf44eca 100644 +index 5009a782d80d5c358acb5a412d63a567fd7db3ab..d02eaf281b752f5b1442d06471b80ce28361f31a 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -735,6 +735,37 @@ public class ServerChunkCache extends ChunkSource { +@@ -733,6 +733,37 @@ public class ServerChunkCache extends ChunkSource { boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit if (!flag) { @@ -332,7 +332,7 @@ index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d2 this.level.getProfiler().push("pollingChunks"); int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit -@@ -765,15 +796,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -763,15 +794,7 @@ public class ServerChunkCache extends ChunkSource { List list = Lists.newArrayList(this.chunkMap.visibleChunkMap.values()); // Paper Collections.shuffle(list); @@ -349,7 +349,7 @@ index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d2 this.level.timings.chunkTicks.startTiming(); // Paper final int[] chunksTicked = {0}; // Paper list.forEach((playerchunk) -> { -@@ -783,9 +806,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -781,9 +804,9 @@ public class ServerChunkCache extends ChunkSource { LevelChunk chunk = (LevelChunk) optional.get(); ChunkPos chunkcoordintpair = chunk.getPos(); @@ -362,7 +362,7 @@ index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d2 if (chunksTicked[0]++ % 10 == 0) this.level.getServer().midTickLoadChunks(); // Paper } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7424def8aa625d1a11c3fdc4f6f4128e579c108b..89fcf88f35a071db1704c026a99625c84daf2f28 100644 +index 30f8f4a8314c849a66143a545c1af3440965c6aa..cf09bd17b9d2be04f79edef6debdd815b5f7f86c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -250,6 +250,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0434-Add-villager-reputation-API.patch b/patches/server/0433-Add-villager-reputation-API.patch similarity index 100% rename from patches/server/0434-Add-villager-reputation-API.patch rename to patches/server/0433-Add-villager-reputation-API.patch diff --git a/patches/server/0435-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 94% rename from patches/server/0435-Option-for-maximum-exp-value-when-merging-orbs.patch rename to patches/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch index 415e3f3377..6a8dac61d3 100644 --- a/patches/server/0435-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/patches/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 1460cd36e8d38c1c4318adf818b87961bfe07aec..b6742a4ef1a798e60289586f5cccf6886afa360a 100644 +index 91b5267dcb24646c29ea1ff0b50f3b369f984244..beaf99e1e6fb9f850f4119017a4dfc50fa374ace 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -356,6 +356,12 @@ public class PaperWorldConfig { @@ -22,7 +22,7 @@ index 1460cd36e8d38c1c4318adf818b87961bfe07aec..b6742a4ef1a798e60289586f5cccf688 private void squidMaxSpawnHeight() { squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 771632c9bc5c352e894dc6cb99fd73bc07c3a9e7..07a51f0ee7aa94c707debffbb7ae3532c94df966 100644 +index d49627866c9151ffe4be3eef3d944f0a7b3e8ffe..6c17e7696d39f49aa6dde4f8cc352eb1ac78373b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -625,16 +625,30 @@ public class CraftEventFactory { diff --git a/patches/server/0436-ExperienceOrbMergeEvent.patch b/patches/server/0435-ExperienceOrbMergeEvent.patch similarity index 94% rename from patches/server/0436-ExperienceOrbMergeEvent.patch rename to patches/server/0435-ExperienceOrbMergeEvent.patch index b3f0b90da8..4278e908aa 100644 --- a/patches/server/0436-ExperienceOrbMergeEvent.patch +++ b/patches/server/0435-ExperienceOrbMergeEvent.patch @@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 07a51f0ee7aa94c707debffbb7ae3532c94df966..be7a9b0d8f65c884c0ff183041c20b7a99c30e2a 100644 +index 6c17e7696d39f49aa6dde4f8cc352eb1ac78373b..d5588bca58d999b7242041127fac3809aa9e2ddd 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -635,7 +635,7 @@ public class CraftEventFactory { diff --git a/patches/server/0437-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0436-Fix-PotionEffect-ignores-icon-flag.patch similarity index 100% rename from patches/server/0437-Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/0436-Fix-PotionEffect-ignores-icon-flag.patch diff --git a/patches/server/0438-Optimize-brigadier-child-sorting-performance.patch b/patches/server/0437-Optimize-brigadier-child-sorting-performance.patch similarity index 100% rename from patches/server/0438-Optimize-brigadier-child-sorting-performance.patch rename to patches/server/0437-Optimize-brigadier-child-sorting-performance.patch diff --git a/patches/server/0439-Potential-bed-API.patch b/patches/server/0438-Potential-bed-API.patch similarity index 100% rename from patches/server/0439-Potential-bed-API.patch rename to patches/server/0438-Potential-bed-API.patch diff --git a/patches/server/0440-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0439-Wait-for-Async-Tasks-during-shutdown.patch similarity index 100% rename from patches/server/0440-Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/0439-Wait-for-Async-Tasks-during-shutdown.patch diff --git a/patches/server/0441-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/patches/server/0440-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch similarity index 100% rename from patches/server/0441-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch rename to patches/server/0440-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch diff --git a/patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0441-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch similarity index 99% rename from patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch rename to patches/server/0441-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 8c5fbe63c3..774e632c66 100644 --- a/patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/0441-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -56,7 +56,7 @@ index a861b4b55862b1c5583101fe7f28a3a43c547468..1575fb0bbad6e11f25fb9ce51fd1f15a this.level.getProfiler().push("explosion_blocks"); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9cf64082555d848e4149f9a982dd770db9defa3c..36fd88239da908c2685a853ec28c0f3db691fad0 100644 +index f7fc4a9d3c0132df6024b33e4f893d3b7ebc6ec3..970a67d82219fa642080c78a814c12ca8d9a5ee9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -425,6 +425,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0443-Reduce-MutableInt-allocations-from-light-engine.patch b/patches/server/0442-Reduce-MutableInt-allocations-from-light-engine.patch similarity index 100% rename from patches/server/0443-Reduce-MutableInt-allocations-from-light-engine.patch rename to patches/server/0442-Reduce-MutableInt-allocations-from-light-engine.patch diff --git a/patches/server/0444-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch similarity index 96% rename from patches/server/0444-Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename to patches/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 964a4afc5c..c9d927c17e 100644 --- a/patches/server/0444-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1b2e7af2824cecc5010f2beefa4f5b838c5ca09d..a1529fef41543486d29271b1de62a6246d07d384 100644 +index fd79caa3fd62eb6ef09b1eb63cb569560cd7b9a9..6fdbd1396265d0671bf888e88f516b1c9453a0d4 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -2147,9 +2147,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -2135,9 +2135,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { diff --git a/patches/server/0445-Ensure-safe-gateway-teleport.patch b/patches/server/0444-Ensure-safe-gateway-teleport.patch similarity index 100% rename from patches/server/0445-Ensure-safe-gateway-teleport.patch rename to patches/server/0444-Ensure-safe-gateway-teleport.patch diff --git a/patches/server/0446-Add-option-for-console-having-all-permissions.patch b/patches/server/0445-Add-option-for-console-having-all-permissions.patch similarity index 100% rename from patches/server/0446-Add-option-for-console-having-all-permissions.patch rename to patches/server/0445-Add-option-for-console-having-all-permissions.patch diff --git a/patches/server/0447-Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch similarity index 97% rename from patches/server/0447-Optimize-ServerLevels-chunk-level-checking-methods.patch rename to patches/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch index ac3423453b..7b161ef494 100644 --- a/patches/server/0447-Optimize-ServerLevels-chunk-level-checking-methods.patch +++ b/patches/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch @@ -8,7 +8,7 @@ so inline where possible, and avoid the abstraction of the Either class. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index bfc855adc411269b63b44157266d6ef7945aa7e0..6fc4b479dcb40b7f6f018731956bc003e95ea05b 100644 +index 021915680f6aa054585527dc0caf18b65795a1b7..e3b9f7b92e4f3e8b64e2b13bdf2b3fcee12c7cda 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2034,15 +2034,18 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0448-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/patches/server/0447-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch similarity index 100% rename from patches/server/0448-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch rename to patches/server/0447-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch diff --git a/patches/server/0449-Optimize-sending-packets-to-nearby-locations-sounds-.patch b/patches/server/0448-Optimize-sending-packets-to-nearby-locations-sounds-.patch similarity index 100% rename from patches/server/0449-Optimize-sending-packets-to-nearby-locations-sounds-.patch rename to patches/server/0448-Optimize-sending-packets-to-nearby-locations-sounds-.patch diff --git a/patches/server/0450-Fix-villager-trading-demand-MC-163962.patch b/patches/server/0449-Fix-villager-trading-demand-MC-163962.patch similarity index 100% rename from patches/server/0450-Fix-villager-trading-demand-MC-163962.patch rename to patches/server/0449-Fix-villager-trading-demand-MC-163962.patch diff --git a/patches/server/0451-Maps-shouldn-t-load-chunks.patch b/patches/server/0450-Maps-shouldn-t-load-chunks.patch similarity index 100% rename from patches/server/0451-Maps-shouldn-t-load-chunks.patch rename to patches/server/0450-Maps-shouldn-t-load-chunks.patch diff --git a/patches/server/0452-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0451-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch similarity index 100% rename from patches/server/0452-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename to patches/server/0451-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch diff --git a/patches/server/0453-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/patches/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch similarity index 98% rename from patches/server/0453-Delay-Chunk-Unloads-based-on-Player-Movement.patch rename to patches/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch index 8f35a6e0f8..c73894a9fe 100644 --- a/patches/server/0453-Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/patches/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -17,7 +17,7 @@ This allows servers with smaller worlds who do less long distance exploring to s wasting cpu cycles on saving/unloading/reloading chunks repeatedly. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b6742a4ef1a798e60289586f5cccf6886afa360a..9e5810eb0085ad956f0bd1cd69fa88909d9d638a 100644 +index beaf99e1e6fb9f850f4119017a4dfc50fa374ace..e1f6190a8ea8606404060b3d2ebc5ceea6665a6e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -531,6 +531,15 @@ public class PaperWorldConfig { diff --git a/patches/server/0454-Optimize-Bit-Operations-by-inlining.patch b/patches/server/0453-Optimize-Bit-Operations-by-inlining.patch similarity index 100% rename from patches/server/0454-Optimize-Bit-Operations-by-inlining.patch rename to patches/server/0453-Optimize-Bit-Operations-by-inlining.patch diff --git a/patches/server/0455-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/0454-Add-Plugin-Tickets-to-API-Chunk-Methods.patch similarity index 100% rename from patches/server/0455-Add-Plugin-Tickets-to-API-Chunk-Methods.patch rename to patches/server/0454-Add-Plugin-Tickets-to-API-Chunk-Methods.patch diff --git a/patches/server/0456-incremental-chunk-saving.patch b/patches/server/0455-incremental-chunk-saving.patch similarity index 97% rename from patches/server/0456-incremental-chunk-saving.patch rename to patches/server/0455-incremental-chunk-saving.patch index 4e3c2137fc..1a8dd091eb 100644 --- a/patches/server/0456-incremental-chunk-saving.patch +++ b/patches/server/0455-incremental-chunk-saving.patch @@ -139,7 +139,7 @@ index 7223c6daf6f0eb959a5cab701096324a34b9c88a..8245e07f6ecfd9dd997c8525b52c6ead for (int i = 0; i < this.futures.length(); ++i) { CompletableFuture> completablefuture = (CompletableFuture) this.futures.get(i); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bfc34ce890 100644 +index 58a05168e88272fd4d54c9c7855c41063c53cf8c..12f9f512dc8b9e094dab2caec7b6ddaf2a378ee9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -97,6 +97,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -150,7 +150,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -750,6 +751,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -738,6 +739,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -215,7 +215,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf protected void saveAllChunks(boolean flush) { Long2ObjectLinkedOpenHashMap visibleChunks = this.getVisibleChunks(); // Paper remove clone of visible Chunks unless saving off main thread (watchdog kill) if (flush) { -@@ -888,6 +947,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -876,6 +935,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider asyncSaveData, chunk); chunk.setUnsaved(false); @@ -223,7 +223,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf } // Paper end -@@ -919,6 +979,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -907,6 +967,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.level.unload(chunk); } @@ -231,7 +231,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); this.lightEngine.tryScheduleUpdate(); -@@ -1272,6 +1333,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1260,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!chunk.isUnsaved()) { return false; } else { @@ -240,10 +240,10 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf ChunkPos chunkcoordintpair = chunk.getPos(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 7d8db5bc79fbff0832b87f4004f919d28bf44eca..ffe700489cb2d507421abfb48939808de0adc8be 100644 +index d02eaf281b752f5b1442d06471b80ce28361f31a..6d947343b6ff2f86a23ea669e371d5ecd9e903c0 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -677,6 +677,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -675,6 +675,15 @@ public class ServerChunkCache extends ChunkSource { } // Paper - Timings } diff --git a/patches/server/0457-Fix-missing-chunks-due-to-integer-overflow.patch b/patches/server/0456-Fix-missing-chunks-due-to-integer-overflow.patch similarity index 100% rename from patches/server/0457-Fix-missing-chunks-due-to-integer-overflow.patch rename to patches/server/0456-Fix-missing-chunks-due-to-integer-overflow.patch diff --git a/patches/server/0458-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/patches/server/0457-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch similarity index 100% rename from patches/server/0458-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch rename to patches/server/0457-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch diff --git a/patches/server/0459-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0458-Fix-piston-physics-inconsistency-MC-188840.patch similarity index 98% rename from patches/server/0459-Fix-piston-physics-inconsistency-MC-188840.patch rename to patches/server/0458-Fix-piston-physics-inconsistency-MC-188840.patch index 86294530f4..5a28411a9e 100644 --- a/patches/server/0459-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0458-Fix-piston-physics-inconsistency-MC-188840.patch @@ -81,7 +81,7 @@ index 4eac07022a7d896ee8921afa6d35cba7f0c89941..dd50a29d47a62df8cdfd69358218d155 } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index f18b20f94b4d2d7f07a70414834b3b284f65da78..7b987071405229678f10a75e49786f5055026521 100644 +index 54020a3f2b18c4f42008f5d5f4541ef1a1efbcd7..be4360cc580e3b92b76cdcf54265d5ac25d3d59b 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -285,7 +285,7 @@ public class PistonMovingBlockEntity extends BlockEntity { diff --git a/patches/server/0460-Fix-sand-duping.patch b/patches/server/0459-Fix-sand-duping.patch similarity index 100% rename from patches/server/0460-Fix-sand-duping.patch rename to patches/server/0459-Fix-sand-duping.patch diff --git a/patches/server/0461-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0460-Prevent-position-desync-in-playerconnection-causing-.patch similarity index 100% rename from patches/server/0461-Prevent-position-desync-in-playerconnection-causing-.patch rename to patches/server/0460-Prevent-position-desync-in-playerconnection-causing-.patch diff --git a/patches/server/0462-Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/0461-Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/server/0462-Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/0461-Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/server/0463-Expose-Arrow-getItemStack.patch b/patches/server/0462-Expose-Arrow-getItemStack.patch similarity index 100% rename from patches/server/0463-Expose-Arrow-getItemStack.patch rename to patches/server/0462-Expose-Arrow-getItemStack.patch diff --git a/patches/server/0464-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/0463-Add-and-implement-PlayerRecipeBookClickEvent.patch similarity index 100% rename from patches/server/0464-Add-and-implement-PlayerRecipeBookClickEvent.patch rename to patches/server/0463-Add-and-implement-PlayerRecipeBookClickEvent.patch diff --git a/patches/server/0465-Hide-sync-chunk-writes-behind-flag.patch b/patches/server/0464-Hide-sync-chunk-writes-behind-flag.patch similarity index 100% rename from patches/server/0465-Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/0464-Hide-sync-chunk-writes-behind-flag.patch diff --git a/patches/server/0466-Add-permission-for-command-blocks.patch b/patches/server/0465-Add-permission-for-command-blocks.patch similarity index 100% rename from patches/server/0466-Add-permission-for-command-blocks.patch rename to patches/server/0465-Add-permission-for-command-blocks.patch diff --git a/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0466-Ensure-Entity-AABB-s-are-never-invalid.patch similarity index 100% rename from patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch rename to patches/server/0466-Ensure-Entity-AABB-s-are-never-invalid.patch diff --git a/patches/server/0468-Optimize-WorldBorder-collision-checks-and-air.patch b/patches/server/0467-Optimize-WorldBorder-collision-checks-and-air.patch similarity index 100% rename from patches/server/0468-Optimize-WorldBorder-collision-checks-and-air.patch rename to patches/server/0467-Optimize-WorldBorder-collision-checks-and-air.patch diff --git a/patches/server/0469-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0468-Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 100% rename from patches/server/0469-Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/0468-Fix-Per-World-Difficulty-Remembering-Difficulty.patch diff --git a/patches/server/0470-Paper-dumpitem-command.patch b/patches/server/0469-Paper-dumpitem-command.patch similarity index 100% rename from patches/server/0470-Paper-dumpitem-command.patch rename to patches/server/0469-Paper-dumpitem-command.patch diff --git a/patches/server/0471-Don-t-allow-null-UUID-s-for-chat.patch b/patches/server/0470-Don-t-allow-null-UUID-s-for-chat.patch similarity index 100% rename from patches/server/0471-Don-t-allow-null-UUID-s-for-chat.patch rename to patches/server/0470-Don-t-allow-null-UUID-s-for-chat.patch diff --git a/patches/server/0472-Improve-Legacy-Component-serialization-size.patch b/patches/server/0471-Improve-Legacy-Component-serialization-size.patch similarity index 100% rename from patches/server/0472-Improve-Legacy-Component-serialization-size.patch rename to patches/server/0471-Improve-Legacy-Component-serialization-size.patch diff --git a/patches/server/0473-Stop-copy-on-write-operations-for-updating-light-dat.patch b/patches/server/0472-Stop-copy-on-write-operations-for-updating-light-dat.patch similarity index 100% rename from patches/server/0473-Stop-copy-on-write-operations-for-updating-light-dat.patch rename to patches/server/0472-Stop-copy-on-write-operations-for-updating-light-dat.patch diff --git a/patches/server/0474-Support-old-UUID-format-for-NBT.patch b/patches/server/0473-Support-old-UUID-format-for-NBT.patch similarity index 100% rename from patches/server/0474-Support-old-UUID-format-for-NBT.patch rename to patches/server/0473-Support-old-UUID-format-for-NBT.patch diff --git a/patches/server/0475-Clean-up-duplicated-GameProfile-Properties.patch b/patches/server/0474-Clean-up-duplicated-GameProfile-Properties.patch similarity index 100% rename from patches/server/0475-Clean-up-duplicated-GameProfile-Properties.patch rename to patches/server/0474-Clean-up-duplicated-GameProfile-Properties.patch diff --git a/patches/server/0476-Convert-legacy-attributes-in-Item-Meta.patch b/patches/server/0475-Convert-legacy-attributes-in-Item-Meta.patch similarity index 100% rename from patches/server/0476-Convert-legacy-attributes-in-Item-Meta.patch rename to patches/server/0475-Convert-legacy-attributes-in-Item-Meta.patch diff --git a/patches/server/0477-Remove-some-streams-from-structures.patch b/patches/server/0476-Remove-some-streams-from-structures.patch similarity index 100% rename from patches/server/0477-Remove-some-streams-from-structures.patch rename to patches/server/0476-Remove-some-streams-from-structures.patch diff --git a/patches/server/0478-Remove-streams-from-classes-related-villager-gossip.patch b/patches/server/0477-Remove-streams-from-classes-related-villager-gossip.patch similarity index 100% rename from patches/server/0478-Remove-streams-from-classes-related-villager-gossip.patch rename to patches/server/0477-Remove-streams-from-classes-related-villager-gossip.patch diff --git a/patches/server/0479-Optimize-NibbleArray-to-use-pooled-buffers.patch b/patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch similarity index 100% rename from patches/server/0479-Optimize-NibbleArray-to-use-pooled-buffers.patch rename to patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch diff --git a/patches/server/0480-Support-components-in-ItemMeta.patch b/patches/server/0479-Support-components-in-ItemMeta.patch similarity index 100% rename from patches/server/0480-Support-components-in-ItemMeta.patch rename to patches/server/0479-Support-components-in-ItemMeta.patch diff --git a/patches/server/0481-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/patches/server/0480-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch similarity index 100% rename from patches/server/0481-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch rename to patches/server/0480-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch diff --git a/patches/server/0482-Add-entity-liquid-API.patch b/patches/server/0481-Add-entity-liquid-API.patch similarity index 100% rename from patches/server/0482-Add-entity-liquid-API.patch rename to patches/server/0481-Add-entity-liquid-API.patch diff --git a/patches/server/0483-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0482-Update-itemstack-legacy-name-and-lore.patch similarity index 100% rename from patches/server/0483-Update-itemstack-legacy-name-and-lore.patch rename to patches/server/0482-Update-itemstack-legacy-name-and-lore.patch diff --git a/patches/server/0484-Spawn-player-in-correct-world-on-login.patch b/patches/server/0483-Spawn-player-in-correct-world-on-login.patch similarity index 100% rename from patches/server/0484-Spawn-player-in-correct-world-on-login.patch rename to patches/server/0483-Spawn-player-in-correct-world-on-login.patch diff --git a/patches/server/0485-Add-PrepareResultEvent.patch b/patches/server/0484-Add-PrepareResultEvent.patch similarity index 100% rename from patches/server/0485-Add-PrepareResultEvent.patch rename to patches/server/0484-Add-PrepareResultEvent.patch diff --git a/patches/server/0486-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/0485-Allow-delegation-to-vanilla-chunk-gen.patch similarity index 100% rename from patches/server/0486-Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/server/0485-Allow-delegation-to-vanilla-chunk-gen.patch diff --git a/patches/server/0487-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0486-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 90% rename from patches/server/0487-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/0486-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 5c54983d8c..ada62c011d 100644 --- a/patches/server/0487-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0486-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b6a36706846a3106f7e747ce761aa2064a934d05..8a0722455bf303f50b2955b53f9d7284a20f672e 100644 +index 44df201abb930b455d9de8f36260ec5e4f20f5c2..0c7ed53964675c81185644549898369cdda80377 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3359,7 +3359,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/removed/1.17/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch similarity index 84% rename from patches/removed/1.17/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch rename to patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 307bdb6dd5..b188f587d4 100644 --- a/patches/removed/1.17/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -80,7 +80,7 @@ index 2d5b8e35d52b0dfd075af81a3a936d8a21053b31..9ddedd310eb0323a5a09f51a61bfb7b3 chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey)); chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4c099af87 100644 +index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..a0334dde56829fd895323f4cab2ab55d5d5ecf30 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -60,7 +60,7 @@ public class ChunkHolder { @@ -235,21 +235,61 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4 // Paper start - optimise isOutsideOfRange // cached here to avoid a map lookup com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet playersInMobSpawnRange; -@@ -485,7 +614,7 @@ public class ChunkHolder { - // CraftBukkit start +@@ -470,12 +599,25 @@ public class ChunkHolder { + }); + } + ++ // Paper start ++ private boolean loadCallbackScheduled = false; ++ private boolean unloadCallbackScheduled = false; ++ static void ensureTickThread(final String reason) { ++ // TODO REMOVE ++ if (!org.bukkit.Bukkit.isPrimaryThread()) { ++ MinecraftServer.LOGGER.fatal("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); ++ throw new IllegalStateException(reason); ++ } ++ } ++ // Paper end ++ + private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) { + this.pendingFullStateConfirmation.cancel(false); + playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); + } + + protected void updateFutures(ChunkMap chunkStorage, Executor executor) { ++ ensureTickThread("Async ticket level update"); // Paper + ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel); + ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel); + boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE; +@@ -486,9 +628,22 @@ public class ChunkHolder { // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins. if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { -- this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> { -+ this.getStatusFutureUncheckedMain(ChunkStatus.FULL).thenAccept((either) -> { // Paper - ensure main + this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> { ++ ensureTickThread("Async full status chunk future completion"); // Paper LevelChunk chunk = (LevelChunk)either.left().orElse(null); - if (chunk != null) { +- if (chunk != null) { ++ if (chunk != null && chunk.wasLoadCallbackInvoked() && ChunkHolder.this.ticketLevel > 33) { // Paper - only invoke unload if load was called ++ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded... ++ if (ChunkHolder.this.unloadCallbackScheduled) { ++ return; ++ } ++ ChunkHolder.this.unloadCallbackScheduled = true; ++ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded... chunkStorage.callbackExecutor.execute(() -> { -@@ -544,13 +673,14 @@ public class ChunkHolder { - this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this); ++ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded... ++ ChunkHolder.this.unloadCallbackScheduled = false; ++ if (ChunkHolder.this.ticketLevel <= 33) { ++ return; ++ } ++ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded... + // Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick + // lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag. + // These actions may however happen deferred, so we manually set the needsSaving flag already here. +@@ -545,12 +700,14 @@ public class ChunkHolder { this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER); // Paper start - cache ticking ready status -- this.fullChunkFuture.thenAccept(either -> { -+ ensureMain(this.fullChunkFuture).thenAccept(either -> { // Paper - ensure main + this.fullChunkFuture.thenAccept(either -> { ++ ensureTickThread("Async full chunk future completion"); // Paper final Optional left = either.left(); if (left.isPresent() && ChunkHolder.this.fullChunkCreateCount == expectCreateCount) { // note: Here is a very good place to add callbacks to logic waiting on this. @@ -260,25 +300,23 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4 } }); this.updateChunkToSave(this.fullChunkFuture, "full"); -@@ -574,7 +704,7 @@ public class ChunkHolder { - this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); +@@ -575,6 +732,7 @@ public class ChunkHolder { this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING); // Paper start - cache ticking ready status -- this.tickingChunkFuture.thenAccept(either -> { -+ ensureMain(this.tickingChunkFuture).thenAccept(either -> { // Paper - ensure main + this.tickingChunkFuture.thenAccept(either -> { ++ ensureTickThread("Async full chunk future completion"); // Paper either.ifLeft(chunk -> { // note: Here is a very good place to add callbacks to logic waiting on this. ChunkHolder.this.isTickingReady = true; -@@ -606,7 +736,7 @@ public class ChunkHolder { - this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos); +@@ -607,6 +765,7 @@ public class ChunkHolder { this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING); // Paper start - cache ticking ready status -- this.entityTickingChunkFuture.thenAccept(either -> { -+ ensureMain(this.entityTickingChunkFuture).thenAccept(either -> { // Paper ensureMain + this.entityTickingChunkFuture.thenAccept(either -> { ++ ensureTickThread("Async full chunk future completion"); // Paper either.ifLeft(chunk -> { ChunkHolder.this.isEntityTickingReady = true; }); -@@ -624,12 +754,30 @@ public class ChunkHolder { +@@ -624,16 +783,42 @@ public class ChunkHolder { this.demoteFullChunk(chunkStorage, playerchunk_state1); } @@ -306,13 +344,26 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4 // CraftBukkit start // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins. if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { -- this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> { -+ this.getStatusFutureUncheckedMain(ChunkStatus.FULL).thenAccept((either) -> { // Paper - ensure main + this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> { ++ ensureTickThread("Async full status chunk future completion"); // Paper LevelChunk chunk = (LevelChunk)either.left().orElse(null); - if (chunk != null) { +- if (chunk != null) { ++ if (chunk != null && ChunkHolder.this.oldTicketLevel <= 33 && !chunk.wasLoadCallbackInvoked()) { // Paper - ensure ticket level is set to loaded before calling, as now this can complete with ticket level > 33 ++ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded... ++ if (ChunkHolder.this.loadCallbackScheduled) { ++ return; ++ } ++ ChunkHolder.this.loadCallbackScheduled = true; ++ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded... chunkStorage.callbackExecutor.execute(() -> { +- chunk.loadCallback(); ++ ChunkHolder.this.loadCallbackScheduled = false; // Paper - only schedule once, now the future is no longer completed as RIGHT if unloaded... ++ if (ChunkHolder.this.oldTicketLevel <= 33) chunk.loadCallback(); // Paper " + }); + } + }).exceptionally((throwable) -> { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa5f523b68 100644 +index 12f9f512dc8b9e094dab2caec7b6ddaf2a378ee9..5b1b91ab4d351f47a05a73cf65539b0bc92df13b 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -323,23 +374,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa public final ChunkGenerator generator; public final Supplier overworldDataStorage; private final PoiManager poiManager; -@@ -187,6 +188,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - - @Override - public void execute(Runnable runnable) { -+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute"); - if (this.queue == null) { - this.queue = new java.util.ArrayDeque<>(); - } -@@ -195,6 +197,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - - @Override - public void run() { -+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor run"); - if (this.queue == null) { - return; - } -@@ -353,6 +356,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -341,6 +342,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.level = world; this.generator = chunkGenerator; this.mainThreadExecutor = mainThreadExecutor; @@ -355,7 +390,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa ProcessorMailbox threadedmailbox = ProcessorMailbox.create(executor, "worldgen"); Objects.requireNonNull(mainThreadExecutor); -@@ -448,6 +460,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -436,6 +446,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet newState) -> { @@ -363,7 +398,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa if (newState.size() != 1) { return; } -@@ -466,7 +479,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -454,7 +465,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } ChunkPos chunkPos = new ChunkPos(rangeX, rangeZ); ChunkMap.this.level.getChunkSource().removeTicketAtLevel(TicketType.PLAYER, chunkPos, 31, chunkPos); // entity ticking level, TODO check on update @@ -379,7 +414,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa this.playerViewDistanceNoTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); this.playerViewDistanceBroadcastMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, -@@ -484,6 +504,116 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -472,6 +490,116 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - no-tick view distance } @@ -496,7 +531,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa // Paper start public void updatePlayerMobTypeMap(Entity entity) { if (!this.level.paperConfig.perPlayerMobSpawns) { -@@ -642,6 +772,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -630,6 +758,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List>> list = Lists.newArrayList(); int j = centerChunk.x; int k = centerChunk.z; @@ -504,7 +539,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa for (int l = -margin; l <= margin; ++l) { for (int i1 = -margin; i1 <= margin; ++i1) { -@@ -660,6 +791,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -648,6 +777,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1); CompletableFuture> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this); @@ -519,7 +554,36 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa list.add(completablefuture); } -@@ -1103,14 +1242,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1016,11 +1153,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + if (requiredStatus == ChunkStatus.EMPTY) { + return this.scheduleChunkLoad(chunkcoordintpair); + } else { ++ // Paper start - revert 1.17 chunk system changes ++ CompletableFuture> future = holder.getOrScheduleFuture(requiredStatus.getParent(), this); ++ return future.thenComposeAsync((either) -> { ++ Optional optional = either.left(); ++ if (!optional.isPresent()) { ++ return CompletableFuture.completedFuture(either); ++ } ++ // Paper end - revert 1.17 chunk system changes + if (requiredStatus == ChunkStatus.LIGHT) { + this.distanceManager.addTicket(TicketType.LIGHT, chunkcoordintpair, 33 + ChunkStatus.getDistance(ChunkStatus.LIGHT), chunkcoordintpair); + } + +- Optional optional = ((Either) holder.getOrScheduleFuture(requiredStatus.getParent(), this).getNow(ChunkHolder.UNLOADED_CHUNK)).left(); ++ // Paper - revert 1.17 chunk system changes + + if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) { + CompletableFuture> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (ichunkaccess) -> { +@@ -1032,6 +1177,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } else { + return this.scheduleChunkGeneration(holder, requiredStatus); + } ++ }, this.mainThreadExecutor).thenComposeAsync(CompletableFuture::completedFuture, this.mainThreadExecutor); // Paper - revert 1.17 chunk system changes + } + } + +@@ -1091,14 +1237,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; CompletableFuture chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z); @@ -549,7 +613,19 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa return ret; // Paper end } -@@ -1242,7 +1391,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1147,7 +1303,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.releaseLightTicket(chunkcoordintpair); + return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); + }); +- }, executor); ++ }, executor).thenComposeAsync((either) -> { // Paper start - force competion on the main thread ++ return CompletableFuture.completedFuture(either); ++ }, this.mainThreadExecutor); // use the main executor, we want to ensure only one chunk callback can be completed per runnable execute ++ // Paper end - force competion on the main thread + } + + protected void releaseLightTicket(ChunkPos pos) { +@@ -1230,7 +1389,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider long i = playerchunk.getPos().toLong(); Objects.requireNonNull(playerchunk); @@ -941,10 +1017,10 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a } } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e588f22bf2 100644 +index 6d947343b6ff2f86a23ea669e371d5ecd9e903c0..d6f0c82b503a0fa73f6589fc4c331d27fbe27638 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -451,6 +451,26 @@ public class ServerChunkCache extends ChunkSource { +@@ -449,6 +449,26 @@ public class ServerChunkCache extends ChunkSource { public void removeTicketAtLevel(TicketType ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) { this.distanceManager.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); } @@ -971,7 +1047,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5 // Paper end - async chunk io @Nullable -@@ -491,6 +511,8 @@ public class ServerChunkCache extends ChunkSource { +@@ -489,6 +509,8 @@ public class ServerChunkCache extends ChunkSource { Objects.requireNonNull(completablefuture); if (!completablefuture.isDone()) { // Paper // Paper start - async chunk io/loading @@ -980,7 +1056,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5 this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1); // Paper end -@@ -499,6 +521,8 @@ public class ServerChunkCache extends ChunkSource { +@@ -497,6 +519,8 @@ public class ServerChunkCache extends ChunkSource { chunkproviderserver_a.managedBlock(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug this.level.timings.syncChunkLoad.stopTiming(); // Paper @@ -989,7 +1065,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5 } // Paper ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; -@@ -572,10 +596,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -570,10 +594,12 @@ public class ServerChunkCache extends ChunkSource { if (flag && !currentlyUnloading) { // CraftBukkit end this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); @@ -1002,7 +1078,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5 this.runDistanceManagerUpdates(); playerchunk = this.getVisibleChunkIfPresent(k); gameprofilerfiller.pop(); -@@ -584,8 +610,13 @@ public class ServerChunkCache extends ChunkSource { +@@ -582,8 +608,13 @@ public class ServerChunkCache extends ChunkSource { } } } @@ -1018,7 +1094,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5 } private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) { -@@ -637,6 +668,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -635,6 +666,7 @@ public class ServerChunkCache extends ChunkSource { } public boolean runDistanceManagerUpdates() { @@ -1113,10 +1189,18 @@ index ae3465cd5be426f3bddc3552b6aad6cad8c8ee25..91df850e66aa14b13a679357e02e2f74 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e0c9857a922d8a3f421d7df0f056b82c4775390e..4918f89401cdf6a85d8b71f3e3a6608239a388bd 100644 +index e0c9857a922d8a3f421d7df0f056b82c4775390e..fefd3e4b7d9b2ec77dd2bc26298c3732d651df32 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -286,8 +286,8 @@ public abstract class PlayerList { +@@ -175,6 +175,7 @@ public abstract class PlayerList { + } + + public void placeNewPlayer(Connection connection, ServerPlayer player) { ++ player.isRealPlayer = true; // Paper - Chunk priority + ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper + if (prev != null) { + disconnectPendingPlayer(prev); +@@ -286,8 +287,8 @@ public abstract class PlayerList { net.minecraft.server.level.ChunkMap playerChunkMap = worldserver1.getChunkSource().chunkMap; net.minecraft.server.level.DistanceManager distanceManager = playerChunkMap.distanceManager; distanceManager.addTicketAtLevel(net.minecraft.server.level.TicketType.LOGIN, pos, 31, pos.toLong()); @@ -1127,14 +1211,6 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..4918f89401cdf6a85d8b71f3e3a66082 net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong()); if (updatingChunk != null) { return updatingChunk.getEntityTickingChunkFuture(); -@@ -705,6 +705,7 @@ public abstract class PlayerList { - SocketAddress socketaddress = loginlistener.connection.getRemoteAddress(); - - ServerPlayer entity = new ServerPlayer(this.server, this.server.getLevel(Level.OVERWORLD), gameprofile); -+ entity.isRealPlayer = true; // Paper - Chunk priority - Player player = entity.getBukkitEntity(); - PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.getRawAddress()).getAddress()); - @@ -893,6 +894,7 @@ public abstract class PlayerList { // CraftBukkit end @@ -1144,7 +1220,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..4918f89401cdf6a85d8b71f3e3a66082 entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3e951522169fcb071cc578e8bd9a78baa10f4e4d..cc4b48f6c62aaccddaf81576865b56f8ece4d040 100644 +index 73fc8ebd2ec207db2efc545f6bb304d53880b78f..e1b6a390105232500d7146cc456bf30912934904 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -223,7 +223,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -1156,11 +1232,40 @@ index 3e951522169fcb071cc578e8bd9a78baa10f4e4d..cc4b48f6c62aaccddaf81576865b56f8 private float xRot; public float yRotO; public float xRotO; +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e..d580f0375cce5e995c024f1b0cd4843b5718121c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -192,7 +192,7 @@ public class LevelChunk implements ChunkAccess { + return NEIGHBOUR_CACHE_RADIUS; + } + +- boolean loadedTicketLevel; ++ boolean loadedTicketLevel; public final boolean wasLoadCallbackInvoked() { return this.loadedTicketLevel; } // Paper - public accessor + private long neighbourChunksLoadedBitset; + private final LevelChunk[] loadedNeighbourChunks = new LevelChunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)]; + +@@ -794,6 +794,7 @@ public class LevelChunk implements ChunkAccess { + + // CraftBukkit start + public void loadCallback() { ++ if (this.loadedTicketLevel) { LOGGER.error("Double calling chunk load!", new Throwable()); } // Paper + // Paper start - neighbour cache + int chunkX = this.chunkPos.x; + int chunkZ = this.chunkPos.z; +@@ -848,6 +849,7 @@ public class LevelChunk implements ChunkAccess { + } + + public void unloadCallback() { ++ if (!this.loadedTicketLevel) { LOGGER.error("Double calling chunk unload!", new Throwable()); } // Paper + org.bukkit.Server server = this.level.getCraftServer(); + org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved()); + server.getPluginManager().callEvent(unloadEvent); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 32c24f9e37262f2a854556787f61cd7b7336da11..08b4589c3b565db70e89aea0715e53c7c0529460 100644 +index 496bb91da1138fb6a4e004da1eab43e588c82592..ff1cb5f679f57988eb30b77fbcc5de2699a90dca 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2604,6 +2604,12 @@ public class CraftWorld implements World { +@@ -1912,6 +1912,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { return future; } diff --git a/patches/server/0488-Improve-Chunk-Status-Transition-Speed.patch b/patches/server/0488-Improve-Chunk-Status-Transition-Speed.patch index abfc15f9ce..f83c01190e 100644 --- a/patches/server/0488-Improve-Chunk-Status-Transition-Speed.patch +++ b/patches/server/0488-Improve-Chunk-Status-Transition-Speed.patch @@ -36,10 +36,10 @@ scenario / path: Previously would have hopped to SERVER around 12+ times there extra. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..52ae149d22e8b0f3c2321f383351a4244c517b5e 100644 +index a0334dde56829fd895323f4cab2ab55d5d5ecf30..81696d822c00e506ba2128590e95341994ff93f6 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -113,6 +113,20 @@ public class ChunkHolder { +@@ -242,6 +242,13 @@ public class ChunkHolder { // Paper end - optimise isOutsideOfRange long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave @@ -49,22 +49,15 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..52ae149d22e8b0f3c2321f383351a424 + ChunkAccess chunk = getAvailableChunkNow(); + return chunk != null && (status == null || chunk.getStatus().isOrAfter(getNextStatus(status))); + } -+ // Yanked from chunk priotisation patch - remove? -+ public static ChunkStatus getNextStatus(ChunkStatus status) { -+ if (status == ChunkStatus.FULL) { -+ return status; -+ } -+ return CHUNK_STATUSES.get(status.getIndex() + 1); -+ } + // Paper end public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f518fc7a39a807bff2e141fd238ab1bfc34ce890..cd76029f2dc3ecfa52bae127ae261a028fa8839a 100644 +index 5b1b91ab4d351f47a05a73cf65539b0bc92df13b..d470fdcbc79c4a491e9a078930b54e8d8949d68c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -702,7 +702,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -827,7 +827,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return either.mapLeft((list) -> { return (LevelChunk) list.get(list.size() / 2); }); @@ -73,7 +66,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..cd76029f2dc3ecfa52bae127ae261a02 } @Nullable -@@ -1133,6 +1133,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1277,6 +1277,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return "chunkGenerate " + requiredStatus.getName(); }); Executor executor = (runnable) -> { diff --git a/patches/server/0493-Move-range-check-for-block-placing-up.patch b/patches/server/0493-Move-range-check-for-block-placing-up.patch index 2d81d6d87d..3539918f55 100644 --- a/patches/server/0493-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0493-Move-range-check-for-block-placing-up.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ae3465cd5be426f3bddc3552b6aad6cad8c8ee25..e307f8695643360289b998a8d2ad244d966f1180 100644 +index 91df850e66aa14b13a679357e02e2f74dc653628..03ad0c0365f85a1536fb35bfdf08d6d44240df80 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1672,17 +1672,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1673,17 +1673,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser BlockPos blockposition = movingobjectpositionblock.getBlockPos(); Direction enumdirection = movingobjectpositionblock.getDirection(); diff --git a/patches/server/0494-Optimize-Light-Engine.patch b/patches/server/0494-Optimize-Light-Engine.patch index 1f38689fc3..b905a4adae 100644 --- a/patches/server/0494-Optimize-Light-Engine.patch +++ b/patches/server/0494-Optimize-Light-Engine.patch @@ -25,19 +25,19 @@ Massive update to light to improve performance and chunk loading/generation. 8) Fix NPE risk that crashes server in getting nibble data diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 52ae149d22e8b0f3c2321f383351a4244c517b5e..03f0a745283012f08919f8e786d402ca01c15f00 100644 +index 81696d822c00e506ba2128590e95341994ff93f6..c6c4894427e5e98dccc1506d9d20157e1acbbd21 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -640,6 +640,7 @@ public class ChunkHolder { - - this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel); +@@ -810,6 +810,7 @@ public class ChunkHolder { + } + // Paper end this.oldTicketLevel = this.ticketLevel; + //chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper // Restore this in chunk priority later? // CraftBukkit start // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins. if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c26097761e 100644 +index d470fdcbc79c4a491e9a078930b54e8d8949d68c..1c662deee2a3184c7612cf7de5f798753fbd7381 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -97,6 +97,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -48,7 +48,7 @@ index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c2 import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; -@@ -335,6 +336,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -324,6 +325,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end @@ -56,7 +56,7 @@ index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c2 public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync); //this.visibleChunks = this.updatingChunks.clone(); // Paper - no more cloning -@@ -360,7 +362,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -358,7 +360,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.progressListener = worldGenerationProgressListener; this.chunkStatusListener = chunkStatusChangeListener; @@ -73,7 +73,7 @@ index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c2 this.queueSorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(threadedmailbox, mailbox, threadedmailbox1), executor, Integer.MAX_VALUE); this.worldgenMailbox = this.queueSorter.getProcessor(threadedmailbox, false); -@@ -742,6 +752,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -867,6 +877,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Override public void close() throws IOException { try { @@ -126,10 +126,10 @@ index d3d6651eb51c852ed1d1eeb5689569d5308b246d..c2d36600a0081c78425868154bdcf7f4 m = Long.MAX_VALUE; } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index ffe700489cb2d507421abfb48939808de0adc8be..5a2b3c150ceaaae651c3ec6aeff3bb894dd5f94d 100644 +index d6f0c82b503a0fa73f6589fc4c331d27fbe27638..db6a0246e83045015fc41f27e0aec0e07d1fb568 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1044,7 +1044,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1074,7 +1074,7 @@ public class ServerChunkCache extends ChunkSource { if (ServerChunkCache.this.runDistanceManagerUpdates()) { return true; } else { @@ -139,7 +139,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..5a2b3c150ceaaae651c3ec6aeff3bb89 } } finally { diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303dc73d98ad 100644 +index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..833b6b2193cf08e123aabb344f2283730aed1bcd 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -1,6 +1,7 @@ @@ -158,7 +158,7 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d import net.minecraft.world.level.chunk.DataLayer; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.LightChunkGetter; -@@ -26,15 +28,149 @@ import org.apache.logging.log4j.Logger; +@@ -26,15 +28,140 @@ import org.apache.logging.log4j.Logger; public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable { private static final Logger LOGGER = LogManager.getLogger(); private final ProcessorMailbox taskMailbox; @@ -167,15 +167,6 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d + // Paper start + private static final int MAX_PRIORITIES = ChunkMap.MAX_CHUNK_DISTANCE + 2; + -+ private boolean isChunkLightStatus(long pair) { -+ ChunkHolder playerChunk = playerChunkMap.getVisibleChunkIfPresent(pair); -+ if (playerChunk == null) { -+ return false; -+ } -+ ChunkStatus status = ChunkHolder.getStatus(playerChunk.getTicketLevel()); -+ return status != null && status.isOrAfter(ChunkStatus.LIGHT); -+ } -+ + static class ChunkLightQueue { + public boolean shouldFastUpdate; + java.util.ArrayDeque pre = new java.util.ArrayDeque(); @@ -311,7 +302,7 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d this.sorterMailbox = executor; this.taskMailbox = processor; } -@@ -120,13 +256,9 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -120,13 +247,9 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } private void addTask(int x, int z, IntSupplier completedLevelSupplier, ThreadedLevelLightEngine.TaskType stage, Runnable task) { @@ -328,7 +319,7 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d } @Override -@@ -142,8 +274,19 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -142,8 +265,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl public CompletableFuture lightChunk(ChunkAccess chunk, boolean excludeBlocks) { ChunkPos chunkPos = chunk.getPos(); @@ -341,16 +332,11 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d + IntSupplier prioritySupplier = playerChunkMap.getChunkQueueLevel(pair); + boolean[] skippedPre = {false}; + this.queue.addChunk(pair, prioritySupplier, Util.name(() -> { -+ if (!isChunkLightStatus(pair)) { -+ future.complete(chunk); -+ skippedPre[0] = true; -+ return; -+ } + // Paper end LevelChunkSection[] levelChunkSections = chunk.getSections(); for(int i = 0; i < chunk.getSectionsCount(); ++i) { -@@ -163,51 +306,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -163,51 +292,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl }, () -> { return "lightChunk " + chunkPos + " " + excludeBlocks; diff --git a/patches/server/0495-Fix-SPIGOT-5989.patch b/patches/server/0495-Fix-SPIGOT-5989.patch index ffb76ae31a..f2057aefc6 100644 --- a/patches/server/0495-Fix-SPIGOT-5989.patch +++ b/patches/server/0495-Fix-SPIGOT-5989.patch @@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is still at a respawn anchor. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773bf23b64ae 100644 +index 4918f89401cdf6a85d8b71f3e3a6608239a388bd..83df832b1fe5be1c1114ce3ae10c1985bf564a0c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -79,6 +79,7 @@ import net.minecraft.world.level.GameRules; @@ -21,7 +21,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.BorderChangeListener; import net.minecraft.world.level.border.WorldBorder; -@@ -829,6 +830,7 @@ public abstract class PlayerList { +@@ -830,6 +831,7 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; boolean isRespawn = false; @@ -29,7 +29,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b // Paper end // CraftBukkit start - fire PlayerRespawnEvent -@@ -839,7 +841,7 @@ public abstract class PlayerList { +@@ -840,7 +842,7 @@ public abstract class PlayerList { Optional optional; if (blockposition != null) { @@ -38,7 +38,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b } else { optional = Optional.empty(); } -@@ -882,7 +884,12 @@ public abstract class PlayerList { +@@ -883,7 +885,12 @@ public abstract class PlayerList { } // Spigot End @@ -52,7 +52,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b if (!flag) entityplayer.reset(); // SPIGOT-4785 isRespawn = true; // Paper } else { -@@ -919,8 +926,12 @@ public abstract class PlayerList { +@@ -921,8 +928,12 @@ public abstract class PlayerList { } // entityplayer1.syncInventory(); entityplayer1.setHealth(entityplayer1.getHealth()); diff --git a/patches/server/0499-Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/patches/server/0499-Add-missing-strikeLighting-call-to-World-spigot-stri.patch index 814e628101..9737676ef9 100644 --- a/patches/server/0499-Add-missing-strikeLighting-call-to-World-spigot-stri.patch +++ b/patches/server/0499-Add-missing-strikeLighting-call-to-World-spigot-stri.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 496bb91da1138fb6a4e004da1eab43e588c82592..f45e92fd85bdb99e072d95ee76ef926bda99f733 100644 +index ff1cb5f679f57988eb30b77fbcc5de2699a90dca..ffb512ac2e2f827cf4079e9b24dd88e363eb95ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1977,6 +1977,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1983,6 +1983,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() ); lightning.visualOnly = true; lightning.isSilent = isSilent; diff --git a/patches/server/0500-Incremental-player-saving.patch b/patches/server/0500-Incremental-player-saving.patch index cff8769910..ed99352548 100644 --- a/patches/server/0500-Incremental-player-saving.patch +++ b/patches/server/0500-Incremental-player-saving.patch @@ -55,7 +55,7 @@ index 01394284fca2f56c1808e75f70a64c4cc2a196ea..de2c21486f07bc2dbbaa9598354cd4ed } // Paper start for (ServerLevel level : this.getAllLevels()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index cf09bd17b9d2be04f79edef6debdd815b5f7f86c..7c05dd7489e686af3ce9c0d63cff30827467c263 100644 +index 6cf83d9b1e43ade17cb67843dbdc11937eda1e08..f3e4b9f302fbc4b615a5e735d5aab0f403e16903 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -175,6 +175,7 @@ public class ServerPlayer extends Player { @@ -67,10 +67,10 @@ index cf09bd17b9d2be04f79edef6debdd815b5f7f86c..7c05dd7489e686af3ce9c0d63cff3082 private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 82a646365b5b0619825995c722cf773bf23b64ae..e990c9d936b9b2b510dd9c7f5a507b4ba9e79965 100644 +index 476a3a317779fdecbced48caa85f6835c54eb018..9a73364f4d56f3a7cecb27bc8034166b8f5731b9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -569,6 +569,7 @@ public abstract class PlayerList { +@@ -570,6 +570,7 @@ public abstract class PlayerList { protected void save(ServerPlayer player) { if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug) @@ -78,7 +78,7 @@ index 82a646365b5b0619825995c722cf773bf23b64ae..e990c9d936b9b2b510dd9c7f5a507b4b this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1206,10 +1207,21 @@ public abstract class PlayerList { +@@ -1208,10 +1209,21 @@ public abstract class PlayerList { } public void saveAll() { diff --git a/patches/server/0505-Brand-support.patch b/patches/server/0505-Brand-support.patch index 5b420b881d..cc13c5df2e 100644 --- a/patches/server/0505-Brand-support.patch +++ b/patches/server/0505-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e2f890479 100644 +index 03ad0c0365f85a1536fb35bfdf08d6d44240df80..27fc9ec7183b100dcfc755d41b3348ccc04c705b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; @@ -33,7 +33,7 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.server = server; this.connection = connection; -@@ -2980,6 +2984,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2981,6 +2985,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); @@ -42,7 +42,7 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3007,6 +3013,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3008,6 +3014,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser try { byte[] data = new byte[packet.data.readableBytes()]; packet.data.readBytes(data); @@ -58,7 +58,7 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -@@ -3016,6 +3031,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3017,6 +3032,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } @@ -72,10 +72,10 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a3951039eeb1f5d3529213ca02d11c97d499be38..e87a08d93abd507785ac5c79f97c02236aa6f43d 100644 +index 9ce4ebc9a0ddeefdc9fb3a7bd91be77aeb075011..7257c8fedb6937d925dea592a69fd56ddd05c50d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2431,6 +2431,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2441,6 +2441,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; diff --git a/patches/server/0506-Add-setMaxPlayers-API.patch b/patches/server/0506-Add-setMaxPlayers-API.patch index e8124fb470..1113c80416 100644 --- a/patches/server/0506-Add-setMaxPlayers-API.patch +++ b/patches/server/0506-Add-setMaxPlayers-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e990c9d936b9b2b510dd9c7f5a507b4ba9e79965..518c93b7aa7a77c19d0256f3d9c24e3b21ac44de 100644 +index 13f1b62e6f3adce54f82d6d131dd60976dc6f548..f2b139d565662fca1bbad46e50b5ccb0d08c4e37 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -145,7 +145,7 @@ public abstract class PlayerList { diff --git a/patches/server/0509-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0509-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 3efd75cf92..27e11fa2ef 100644 --- a/patches/server/0509-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0509-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -17,7 +17,7 @@ index 2653a55d3c947577ea153f3060d9b98acdf31c07..7d97ca9449b123a82b41937353d8fd0b // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f45e92fd85bdb99e072d95ee76ef926bda99f733..a6d04ddfc49eab2cabeab1af95635139a2cfdecd 100644 +index ffb512ac2e2f827cf4079e9b24dd88e363eb95ee..b363af7a8ca8a3bbfd562095ac0f72acdb7dc192 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -246,11 +246,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0510-Add-moon-phase-API.patch b/patches/server/0510-Add-moon-phase-API.patch index 7eda41c206..0e298a446c 100644 --- a/patches/server/0510-Add-moon-phase-API.patch +++ b/patches/server/0510-Add-moon-phase-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a6d04ddfc49eab2cabeab1af95635139a2cfdecd..2ed3f753fe2e353815cc3201d2dc363639ca85f1 100644 +index b363af7a8ca8a3bbfd562095ac0f72acdb7dc192..abab9734f77014ed2627337656ebbb2f3c018e55 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -184,6 +184,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0513-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0513-Add-zombie-targets-turtle-egg-config.patch index 9b04c2858a..0b5bb1ac74 100644 --- a/patches/server/0513-Add-zombie-targets-turtle-egg-config.patch +++ b/patches/server/0513-Add-zombie-targets-turtle-egg-config.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add zombie targets turtle egg config diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 77e90a6b7d29ad989fd961e00a6fd97c7e5ec4fe..2252b9f36ea22a655592c6f176d18b70b7440e4e 100644 +index acb4fe32835bca485cfb2ec509370c9f596d6a0f..7df8648240d43d01bcc2eb1f05f3dab2dc174f38 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -38,6 +38,11 @@ public class PaperWorldConfig { diff --git a/patches/server/0515-Optimize-redstone-algorithm.patch b/patches/server/0515-Optimize-redstone-algorithm.patch index 5cf1627b1d..53e8067c29 100644 --- a/patches/server/0515-Optimize-redstone-algorithm.patch +++ b/patches/server/0515-Optimize-redstone-algorithm.patch @@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee Just added Bukkit's event system and took a few liberties with dead code and comment misspellings. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 2252b9f36ea22a655592c6f176d18b70b7440e4e..8504f4dcfca35c8fe8e266af59762edde76bec77 100644 +index 7df8648240d43d01bcc2eb1f05f3dab2dc174f38..f35bf9e1515d55143a1604e0aa7ec0b810a1a4c5 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -43,6 +43,16 @@ public class PaperWorldConfig { diff --git a/patches/server/0523-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0523-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 94255b1f63..ab666ae912 100644 --- a/patches/server/0523-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0523-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -9,7 +9,7 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b7454592b9cee09f41631db6664cb18e2f890479..b45f79e83fc033424472b4044ab15a8c93cb0aec 100644 +index 27fc9ec7183b100dcfc755d41b3348ccc04c705b..a6a14c6d3eb6d77997e1763e2dd451e0718511ea 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -681,7 +681,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -27,11 +27,11 @@ index b7454592b9cee09f41631db6664cb18e2f890479..b45f79e83fc033424472b4044ab15a8c this.awaitingTeleportTime = this.tickCount; - this.player.absMoveTo(d0, d1, d2, f, f1); + this.player.moveTo(d0, d1, d2, f, f1); // Paper - use proper setPositionRotation for teleportation + this.player.forceCheckHighPriority(); // Paper this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag)); } - diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 73fc8ebd2ec207db2efc545f6bb304d53880b78f..bf1f22ee4e2a38b0fe2430dbeb20ae9f544ea423 100644 +index e1b6a390105232500d7146cc456bf30912934904..993a7000595181a83754f192a53ec2bfe1a2eddc 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -152,6 +152,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0526-Extend-block-drop-capture-to-capture-all-items-added.patch b/patches/server/0526-Extend-block-drop-capture-to-capture-all-items-added.patch index a3ff76f2ca..574aba2542 100644 --- a/patches/server/0526-Extend-block-drop-capture-to-capture-all-items-added.patch +++ b/patches/server/0526-Extend-block-drop-capture-to-capture-all-items-added.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e60d2ef3482c002b082ee84f34b9e681447fa09e..01abe5e21639b990e5ae6d2021cd86149ddf93e5 100644 +index 7d97ca9449b123a82b41937353d8fd0b2c98ea4e..9c2d43c95f2f4bab0c8bbae7390500aa676ce4da 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1166,6 +1166,13 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0527-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/patches/server/0527-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index afe39860e8..dfe38d995f 100644 --- a/patches/server/0527-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/patches/server/0527-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 72dd0141cb360c346690ecdb1e14d2c94ae6de90..ed9588e4f0e9da2c6bdf2b34357d8de46131f84c 100644 +index 6333a310fe32c631be95889f7438414d4a2c03bd..2e983077143a0a7ce6857d5796c9e4f7a4629caf 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -257,6 +257,7 @@ public class ChunkHolder { +@@ -379,6 +379,7 @@ public class ChunkHolder { } public void blockChanged(BlockPos pos) { diff --git a/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 65dfec3a4e..056b456084 100644 --- a/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bf1f22ee4e2a38b0fe2430dbeb20ae9f544ea423..eab21c1a6fb0b0a5d3ecbf6cf580a8fa9d0c6b4b 100644 +index 993a7000595181a83754f192a53ec2bfe1a2eddc..77de5d23e508998045fe13680cdf1f032d6f4336 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3935,4 +3935,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0530-Entity-isTicking.patch b/patches/server/0530-Entity-isTicking.patch index 277dd3c853..a5a96e6cda 100644 --- a/patches/server/0530-Entity-isTicking.patch +++ b/patches/server/0530-Entity-isTicking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index eab21c1a6fb0b0a5d3ecbf6cf580a8fa9d0c6b4b..65f26b0d3fa43a09a9d20052f01aadc78206370b 100644 +index 77de5d23e508998045fe13680cdf1f032d6f4336..ae2937e6b6b0ac150f6f608459d2b75a05e16c36 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey; diff --git a/patches/server/0534-Fix-for-large-move-vectors-crashing-server.patch b/patches/server/0534-Fix-for-large-move-vectors-crashing-server.patch index f0e9347acc..dcfd6189ba 100644 --- a/patches/server/0534-Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/0534-Fix-for-large-move-vectors-crashing-server.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix for large move vectors crashing server Check movement distance also based on current position. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5e90c722405f9e00bfaf9e2fed523552d9755c8d..4c958e44f2e4627d848cef197167b7f8b0f5e965 100644 +index a6a14c6d3eb6d77997e1763e2dd451e0718511ea..eb723a356217d21352b82485050d316291e669ca 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -506,19 +506,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -506,20 +506,31 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) { ServerLevel worldserver = this.player.getLevel(); @@ -32,16 +32,37 @@ index 5e90c722405f9e00bfaf9e2fed523552d9755c8d..4c958e44f2e4627d848cef197167b7f8 double d8 = d5 - this.vehicleFirstGoodZ; double d9 = entity.getDeltaMovement().lengthSqr(); - double d10 = d6 * d6 + d7 * d7 + d8 * d8; +- + // Paper start - fix large move vectors killing the server + double currDeltaX = toX - fromX; + double currDeltaY = toY - fromY; + double currDeltaZ = toZ - fromZ; + double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1); + // Paper end - fix large move vectors killing the server - ++ ++ // Paper start - fix large move vectors killing the server ++ double otherFieldX = d3 - this.vehicleLastGoodX; ++ double otherFieldY = d4 - this.vehicleLastGoodY - 1.0E-6D; ++ double otherFieldZ = d5 - this.vehicleLastGoodZ; ++ d10 = Math.max(d10, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1); ++ // Paper end - fix large move vectors killing the server // CraftBukkit start - handle custom speeds and skipped ticks -@@ -1232,14 +1237,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick; +@@ -562,9 +573,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + + boolean flag = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D)); + +- d6 = d3 - this.vehicleLastGoodX; +- d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; +- d8 = d5 - this.vehicleLastGoodZ; ++ d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above ++ d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above ++ d8 = d5 - this.vehicleLastGoodZ; // Paper - diff on change, used for checking large move vectors above + entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); + double d11 = d7; + +@@ -1232,14 +1243,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser float prevPitch = this.player.getXRot(); // CraftBukkit end double d3 = this.player.getX(); final double toX = d3; // Paper - OBFHELPER @@ -59,7 +80,26 @@ index 5e90c722405f9e00bfaf9e2fed523552d9755c8d..4c958e44f2e4627d848cef197167b7f8 + double currDeltaY = toY - prevY; + double currDeltaZ = toZ - prevZ; + double d11 = Math.max(d7 * d7 + d8 * d8 + d9 * d9, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1); ++ // Paper end - fix large move vectors killing the server ++ // Paper start - fix large move vectors killing the server ++ double otherFieldX = d0 - this.lastGoodX; ++ double otherFieldY = d1 - this.lastGoodY; ++ double otherFieldZ = d2 - this.lastGoodZ; ++ d11 = Math.max(d11, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1); + // Paper end - fix large move vectors killing the server if (this.player.isSleeping()) { if (d11 > 1.0D) { +@@ -1291,9 +1313,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + + AABB axisalignedbb = this.player.getBoundingBox(); + +- d7 = d0 - this.lastGoodX; +- d8 = d1 - this.lastGoodY; +- d9 = d2 - this.lastGoodZ; ++ d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above ++ d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above ++ d9 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above + boolean flag = d8 > 0.0D; + + if (this.player.isOnGround() && !packet.isOnGround() && flag) { diff --git a/patches/server/0538-Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/0538-Retain-block-place-order-when-capturing-blockstates.patch index e954cde84c..b4791d891f 100644 --- a/patches/server/0538-Retain-block-place-order-when-capturing-blockstates.patch +++ b/patches/server/0538-Retain-block-place-order-when-capturing-blockstates.patch @@ -10,7 +10,7 @@ In general, look at making this logic more robust (i.e properly handling cases where a captured entry is overriden) - but for now this will do. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 36fd88239da908c2685a853ec28c0f3db691fad0..e095f699a1e79e89fa87cb1d7096316450274495 100644 +index 970a67d82219fa642080c78a814c12ca8d9a5ee9..f56b2f3a0b390d960224a4090267d1295d573bd0 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -148,7 +148,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0541-Player-elytra-boost-API.patch b/patches/server/0541-Player-elytra-boost-API.patch index db349af942..7e21328374 100644 --- a/patches/server/0541-Player-elytra-boost-API.patch +++ b/patches/server/0541-Player-elytra-boost-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player elytra boost API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e87a08d93abd507785ac5c79f97c02236aa6f43d..65f44c7747eea49fffff678fcbfdc32195a4db5d 100644 +index 7257c8fedb6937d925dea592a69fd56ddd05c50d..2b24575e19cd1b24c259711bfd4e6cae6492f927 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -539,6 +539,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0546-Toggle-for-removing-existing-dragon.patch b/patches/server/0546-Toggle-for-removing-existing-dragon.patch index 1fa87eac57..29b9bffa4a 100644 --- a/patches/server/0546-Toggle-for-removing-existing-dragon.patch +++ b/patches/server/0546-Toggle-for-removing-existing-dragon.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Toggle for removing existing dragon diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8504f4dcfca35c8fe8e266af59762edde76bec77..a03b835320bb99c38ec5f23f0c23284c08bd4171 100644 +index f35bf9e1515d55143a1604e0aa7ec0b810a1a4c5..b7bfeb493008cd7a190fbce84b6162b0fd8b2cb3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -53,6 +53,14 @@ public class PaperWorldConfig { diff --git a/patches/server/0551-Add-API-for-quit-reason.patch b/patches/server/0551-Add-API-for-quit-reason.patch index 723e808eaf..4423eaac75 100644 --- a/patches/server/0551-Add-API-for-quit-reason.patch +++ b/patches/server/0551-Add-API-for-quit-reason.patch @@ -25,10 +25,10 @@ index 7f6405ac44fef423dc8b21f3dbeaae26a1005077..bdd4f4db9849d9107b5c62d5e83b1277 Connection.LOGGER.debug("Failed to sent packet", throwable); ConnectionProtocol enumprotocol = this.getCurrentProtocol(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7c05dd7489e686af3ce9c0d63cff30827467c263..0e08ae0414fc5f19aecccef559976bf56216841e 100644 +index f3e4b9f302fbc4b615a5e735d5aab0f403e16903..84ef1c60223d421cf515c07342d2296e477dd4b7 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -254,6 +254,7 @@ public class ServerPlayer extends Player { +@@ -262,6 +262,7 @@ public class ServerPlayer extends Player { public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper boolean needsChunkCenterUpdate; // Paper - no-tick view distance @@ -37,7 +37,7 @@ index 7c05dd7489e686af3ce9c0d63cff30827467c263..0e08ae0414fc5f19aecccef559976bf5 public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4c958e44f2e4627d848cef197167b7f8b0f5e965..dee3c1d24a1b4a67c79d13106fdab54200023cb9 100644 +index eb723a356217d21352b82485050d316291e669ca..e30e02d64f49bc086ac978abbc18e5050135d0c9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -443,6 +443,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -49,10 +49,10 @@ index 4c958e44f2e4627d848cef197167b7f8b0f5e965..dee3c1d24a1b4a67c79d13106fdab542 this.connection.disconnect(ichatbasecomponent); }); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 518c93b7aa7a77c19d0256f3d9c24e3b21ac44de..5188f62a581276847695cc457f6fe86d47ec2af5 100644 +index 4d1d5dacb175e7059a6af036432ef891bcf77970..76e21498b6cfd1c9a601a55e1483eb8dfd892c2e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -596,7 +596,7 @@ public abstract class PlayerList { +@@ -597,7 +597,7 @@ public abstract class PlayerList { entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } diff --git a/patches/server/0552-Seed-based-feature-search.patch b/patches/server/0552-Seed-based-feature-search.patch index f19b098e07..984f3572ce 100644 --- a/patches/server/0552-Seed-based-feature-search.patch +++ b/patches/server/0552-Seed-based-feature-search.patch @@ -21,7 +21,7 @@ changes but this should usually not happen. A config option to disable this completely is added though in case that should ever be necessary. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a03b835320bb99c38ec5f23f0c23284c08bd4171..45e65d1c56b693d8f7c5c12da7774849c737aa96 100644 +index b7bfeb493008cd7a190fbce84b6162b0fd8b2cb3..0ff2483a8df93cf0e52f98cad86492524fc4a325 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -376,6 +376,14 @@ public class PaperWorldConfig { diff --git a/patches/server/0553-Add-Wandering-Trader-spawn-rate-config-options.patch b/patches/server/0553-Add-Wandering-Trader-spawn-rate-config-options.patch index 30ecfe5e37..55bb8fd880 100644 --- a/patches/server/0553-Add-Wandering-Trader-spawn-rate-config-options.patch +++ b/patches/server/0553-Add-Wandering-Trader-spawn-rate-config-options.patch @@ -11,7 +11,7 @@ in IWorldServerData are removed as they were only used in certain places, with h values used in other places. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 45e65d1c56b693d8f7c5c12da7774849c737aa96..935bb237f8ecd63ca4cec64a7c7a341c9d3358e5 100644 +index 0ff2483a8df93cf0e52f98cad86492524fc4a325..79229cb327e931443d23255720cb4d0716831c69 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -61,6 +61,19 @@ public class PaperWorldConfig { diff --git a/patches/server/0555-Expose-world-spawn-angle.patch b/patches/server/0555-Expose-world-spawn-angle.patch index a7a684d167..343089e6b4 100644 --- a/patches/server/0555-Expose-world-spawn-angle.patch +++ b/patches/server/0555-Expose-world-spawn-angle.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose world spawn angle diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5188f62a581276847695cc457f6fe86d47ec2af5..523a6163c9ac3eadebdd185d291aad21c33caae8 100644 +index b9f6f8441cafeb3e64ce7943bfd1e92fe983a5c5..f8b917b2d1a1744f7a6c3b9cf60be41764ed2815 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -873,7 +873,7 @@ public abstract class PlayerList { +@@ -874,7 +874,7 @@ public abstract class PlayerList { if (location == null) { worldserver1 = this.server.getLevel(Level.OVERWORLD); blockposition = entityplayer1.getSpawnPoint(worldserver1); @@ -18,7 +18,7 @@ index 5188f62a581276847695cc457f6fe86d47ec2af5..523a6163c9ac3eadebdd185d291aad21 Player respawnPlayer = entityplayer1.getBukkitEntity(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 2ed3f753fe2e353815cc3201d2dc363639ca85f1..d556da8c2703746d8eff95b57fc41f9e6c21863d 100644 +index abab9734f77014ed2627337656ebbb2f3c018e55..b62824784b79d1bdd692631915d37134d94fea75 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -237,7 +237,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0557-Fix-Player-spawnParticle-x-y-z-precision-loss.patch b/patches/server/0557-Fix-Player-spawnParticle-x-y-z-precision-loss.patch index b8fffe3983..3a6360408d 100644 --- a/patches/server/0557-Fix-Player-spawnParticle-x-y-z-precision-loss.patch +++ b/patches/server/0557-Fix-Player-spawnParticle-x-y-z-precision-loss.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 65f44c7747eea49fffff678fcbfdc32195a4db5d..ca479c2de83b94e30f62cfaf573e108452908930 100644 +index 2b24575e19cd1b24c259711bfd4e6cae6492f927..77a74b47ffe9c9d02daae74a770427ec1da450a8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2057,7 +2057,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2067,7 +2067,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (data != null && !particle.getDataType().isInstance(data)) { throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass()); } diff --git a/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch index 6cc4f01429..fff33114c3 100644 --- a/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch @@ -21,7 +21,7 @@ index 79229cb327e931443d23255720cb4d0716831c69..eb8d3d911f3fc5b6fc6ac892a95ae12e private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 65f26b0d3fa43a09a9d20052f01aadc78206370b..5ff6afc2a5fbf9f2bec34621d63a400e2acc1d63 100644 +index ae2937e6b6b0ac150f6f608459d2b75a05e16c36..3e52bdd450c5af9a455b627dc8997cbcc7dd1f59 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1726,6 +1726,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch index 64a41e202a..2a4b801e67 100644 --- a/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch +++ b/patches/server/0565-Fix-curing-zombie-villager-discount-exploit.patch @@ -8,7 +8,7 @@ and curing a villager on repeat by simply resetting the relevant part of the reputation when it is cured. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 208690ceca2485b54acde5123ba494d71367791b..561976466cae6e4df63433c4631c516c32a80bca 100644 +index eb8d3d911f3fc5b6fc6ac892a95ae12e58d0540d..5a0291f0d3ac4ec8c64527ab6bbcce8378d63217 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -79,6 +79,11 @@ public class PaperWorldConfig { diff --git a/patches/server/0566-Limit-recipe-packets.patch b/patches/server/0566-Limit-recipe-packets.patch index 5027566153..54e4eb6fb9 100644 --- a/patches/server/0566-Limit-recipe-packets.patch +++ b/patches/server/0566-Limit-recipe-packets.patch @@ -23,7 +23,7 @@ index 22027cdebcde2157b119f37cb1471f7a69c2a31a..ec8afe1bb9881c87c4ee0f15dcfcb4b8 public static boolean velocityOnlineMode; public static byte[] velocitySecretKey; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f0196b37e8c533416400562a37575333f113ec78..a0bdc4745a6ca46965070c62b672200ba142585f 100644 +index e30e02d64f49bc086ac978abbc18e5050135d0c9..f7af847e826058cb533fc5f507efaa87cb10b562 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -231,6 +231,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -42,7 +42,7 @@ index f0196b37e8c533416400562a37575333f113ec78..a0bdc4745a6ca46965070c62b672200b /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -2779,6 +2781,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2792,6 +2794,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0568-MC-4-Fix-item-position-desync.patch b/patches/server/0568-MC-4-Fix-item-position-desync.patch index dd897574ac..93ed080ca7 100644 --- a/patches/server/0568-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0568-MC-4-Fix-item-position-desync.patch @@ -41,7 +41,7 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9 public Vec3 updateEntityPosition(Vec3 orig) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5ff6afc2a5fbf9f2bec34621d63a400e2acc1d63..f0ca8889d9e020dd0c20ff35acadeeac35a0957e 100644 +index 3e52bdd450c5af9a455b627dc8997cbcc7dd1f59..2528e08aea13a8486c552a938d93aa0429692f14 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3762,6 +3762,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0569-Player-Chunk-Load-Unload-Events.patch b/patches/server/0569-Player-Chunk-Load-Unload-Events.patch index 52e35a2283..a41df32b60 100644 --- a/patches/server/0569-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0569-Player-Chunk-Load-Unload-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player Chunk Load/Unload Events diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0e08ae0414fc5f19aecccef559976bf56216841e..192cc28464aaa88a8f03dad0e4da7ef7948e83ce 100644 +index 84ef1c60223d421cf515c07342d2296e477dd4b7..82b4805b417b130be3ce9ab6ed886c85e811ba98 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2072,11 +2072,21 @@ public class ServerPlayer extends Player { +@@ -2096,11 +2096,21 @@ public class ServerPlayer extends Player { public void trackChunk(ChunkPos chunkPos, Packet chunkDataPacket, Packet lightUpdatePacket) { this.connection.send(lightUpdatePacket); this.connection.send(chunkDataPacket); diff --git a/patches/server/0580-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0580-Allow-disabling-mob-spawner-spawn-egg-transformation.patch index 24cf96703e..200d784935 100644 --- a/patches/server/0580-Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/patches/server/0580-Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 561976466cae6e4df63433c4631c516c32a80bca..0079b4423c022a68aa9bee5b81910714ef3d1cd8 100644 +index 5a0291f0d3ac4ec8c64527ab6bbcce8378d63217..8a0e584d4ec2dd1ff2f1cc3aa5f928b765ed7129 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -84,6 +84,11 @@ public class PaperWorldConfig { diff --git a/patches/server/0583-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0583-Fix-interact-event-not-being-called-in-adventure.patch index e0a9b0afe8..9cfe84c8f1 100644 --- a/patches/server/0583-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0583-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a0bdc4745a6ca46965070c62b672200ba142585f..33ea50e1c8b2141a2c08dd18e708b7100885b569 100644 +index f7af847e826058cb533fc5f507efaa87cb10b562..dc810551c25a481a491101d4e1e4c84563c2e9fc 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1712,7 +1712,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1725,7 +1725,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); @@ -18,7 +18,7 @@ index a0bdc4745a6ca46965070c62b672200ba142585f..33ea50e1c8b2141a2c08dd18e708b710 this.player.swing(enumhand, true); } } -@@ -2184,7 +2184,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2197,7 +2197,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player)); diff --git a/patches/server/0585-Fix-nerfed-slime-when-splitting.patch b/patches/server/0585-Fix-nerfed-slime-when-splitting.patch index 644a72d961..6481fd3b48 100644 --- a/patches/server/0585-Fix-nerfed-slime-when-splitting.patch +++ b/patches/server/0585-Fix-nerfed-slime-when-splitting.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix nerfed slime when splitting diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index 6ac78ec82b6176771ab024e0c928b0881f67ca05..e1a593b464c35f68b22e84a09f99ee72af73da32 100644 +index 28e03ed12848cba961aaae1b04b25b1e724a728b..bb6cc0e05ebc5d39968fd2b923ba1cb540720a15 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java @@ -241,6 +241,7 @@ public class Slime extends Mob implements Enemy { diff --git a/patches/server/0588-Added-WorldGameRuleChangeEvent.patch b/patches/server/0588-Added-WorldGameRuleChangeEvent.patch index aecdd554b6..8015aa316a 100644 --- a/patches/server/0588-Added-WorldGameRuleChangeEvent.patch +++ b/patches/server/0588-Added-WorldGameRuleChangeEvent.patch @@ -64,7 +64,7 @@ index 888d812118c15c212284687ae5842a94f5715d52..e7ca5d6fb8922e7e8065864f736b0605 public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d556da8c2703746d8eff95b57fc41f9e6c21863d..636e63cf27a685710fd9915372b33f1c76f5b59c 100644 +index b62824784b79d1bdd692631915d37134d94fea75..bd20d47be4a7d554d46ce0a463e52b5c72908e2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1717,8 +1717,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0590-Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/0590-Added-world-settings-for-mobs-picking-up-loot.patch index 5edc776340..14653293b0 100644 --- a/patches/server/0590-Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/0590-Added-world-settings-for-mobs-picking-up-loot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added world settings for mobs picking up loot diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0079b4423c022a68aa9bee5b81910714ef3d1cd8..8d7acac29d5a8586f449e32f51c1213545e4d366 100644 +index 8a0e584d4ec2dd1ff2f1cc3aa5f928b765ed7129..638313799b59766c8d18faa9b45c1139c027baec 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -430,6 +430,14 @@ public class PaperWorldConfig { diff --git a/patches/server/0594-Configurable-door-breaking-difficulty.patch b/patches/server/0594-Configurable-door-breaking-difficulty.patch index a7744d8e92..583422361f 100644 --- a/patches/server/0594-Configurable-door-breaking-difficulty.patch +++ b/patches/server/0594-Configurable-door-breaking-difficulty.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable door breaking difficulty diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8d7acac29d5a8586f449e32f51c1213545e4d366..4227e7fc46e22265316b42bbdb166d60e5aed94e 100644 +index 638313799b59766c8d18faa9b45c1139c027baec..33709724481370b51de930e7bb2e7b1a329c5e6b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -2,7 +2,10 @@ package com.destroystokyo.paper; diff --git a/patches/server/0597-Remove-stale-POIs.patch b/patches/server/0597-Remove-stale-POIs.patch index 86f64409f7..28b6b2a2a6 100644 --- a/patches/server/0597-Remove-stale-POIs.patch +++ b/patches/server/0597-Remove-stale-POIs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stale POIs diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 01abe5e21639b990e5ae6d2021cd86149ddf93e5..4223d4610b4fec588980dba2ea5ec4f04c45d945 100644 +index 9c2d43c95f2f4bab0c8bbae7390500aa676ce4da..0acbd21f755ba805fd0aba68219e9c3849799375 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1703,6 +1703,11 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0598-Fix-villager-boat-exploit.patch b/patches/server/0598-Fix-villager-boat-exploit.patch index 5965e48dd8..9bad49e1ee 100644 --- a/patches/server/0598-Fix-villager-boat-exploit.patch +++ b/patches/server/0598-Fix-villager-boat-exploit.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix villager boat exploit diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 523a6163c9ac3eadebdd185d291aad21c33caae8..6c167952102548c5f766eaa8e022e213cc20bd74 100644 +index 3e7c9716b6d05859e7d63d9c7b9616f80ae8e51a..6f6b0460516da49fa0d0b5dd0dcd554bb03b9fe3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -621,6 +621,15 @@ public abstract class PlayerList { +@@ -622,6 +622,15 @@ public abstract class PlayerList { PlayerList.LOGGER.debug("Removing player mount"); entityplayer.stopRiding(); entity.getPassengersAndSelf().forEach((entity1) -> { diff --git a/patches/server/0599-Add-sendOpLevel-API.patch b/patches/server/0599-Add-sendOpLevel-API.patch index 26a2d303f2..58b666bf94 100644 --- a/patches/server/0599-Add-sendOpLevel-API.patch +++ b/patches/server/0599-Add-sendOpLevel-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6c167952102548c5f766eaa8e022e213cc20bd74..6c85c186124f33a6a8a596610b17f205bb31f8dd 100644 +index 6ac6d05390359bd858673c4941e7d90f4cf98a02..0e0d0445480862d1e6aded499e906370c24c5680 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1121,6 +1121,11 @@ public abstract class PlayerList { +@@ -1123,6 +1123,11 @@ public abstract class PlayerList { } private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) { @@ -20,7 +20,7 @@ index 6c167952102548c5f766eaa8e022e213cc20bd74..6c85c186124f33a6a8a596610b17f205 if (player.connection != null) { byte b0; -@@ -1135,8 +1140,10 @@ public abstract class PlayerList { +@@ -1137,8 +1142,10 @@ public abstract class PlayerList { player.connection.send(new ClientboundEntityEventPacket(player, b0)); } @@ -32,7 +32,7 @@ index 6c167952102548c5f766eaa8e022e213cc20bd74..6c85c186124f33a6a8a596610b17f205 // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ca479c2de83b94e30f62cfaf573e108452908930..db6c515b1d47d9432145c519fc9863bc7a0cc1b0 100644 +index 77a74b47ffe9c9d02daae74a770427ec1da450a8..7194729b60240bead26ba22962f4389f24751046 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -553,6 +553,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0600-Add-StructureLocateEvent.patch b/patches/server/0600-Add-StructureLocateEvent.patch index ac481396b9..a1608b7b39 100644 --- a/patches/server/0600-Add-StructureLocateEvent.patch +++ b/patches/server/0600-Add-StructureLocateEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add StructureLocateEvent diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 57ee9023c265504e07647cd9dd8997600c84594f..4a40fa5f7c71481ef0b275955bbd81a737889781 100644 +index 6fbfe7a61df0efd4d85a00f02096410a1d29e62f..f19f0fe89196d0939d16c22dd57585a50b19a15e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -2,6 +2,7 @@ package net.minecraft.world.level.chunk; diff --git a/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch index 2364782eff..b6745ca88c 100644 --- a/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch @@ -28,7 +28,7 @@ index 33709724481370b51de930e7bb2e7b1a329c5e6b..c3e7a26bc6f6206dc2513dd5d937b059 public int wanderingTraderSpawnDayTicks = 24000; public int wanderingTraderSpawnChanceFailureIncrement = 25; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f0ca8889d9e020dd0c20ff35acadeeac35a0957e..cf22785bfd4e5bb212f6fe601d38aba982fb8d4e 100644 +index 2528e08aea13a8486c552a938d93aa0429692f14..e48d2dd51c1304aec33ad6cebec3f24c2dfee35f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1609,6 +1609,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0605-Configurable-max-leash-distance.patch b/patches/server/0605-Configurable-max-leash-distance.patch index bbc48021c8..42b2129ed8 100644 --- a/patches/server/0605-Configurable-max-leash-distance.patch +++ b/patches/server/0605-Configurable-max-leash-distance.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable max leash distance diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3d16e4a6bf842a209c760fd89f8edf995cabce7d..70815cb7393008f8b02e83e68fe27bb5202d00f6 100644 +index c3e7a26bc6f6206dc2513dd5d937b05951ab5c7a..6e15242476e07bb7e2d1b60ff9497687b2d78826 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -263,6 +263,12 @@ public class PaperWorldConfig { diff --git a/patches/server/0610-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0610-Add-toggle-for-always-placing-the-dragon-egg.patch index 3d18fad468..b9ce7071fe 100644 --- a/patches/server/0610-Add-toggle-for-always-placing-the-dragon-egg.patch +++ b/patches/server/0610-Add-toggle-for-always-placing-the-dragon-egg.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add toggle for always placing the dragon egg diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 70815cb7393008f8b02e83e68fe27bb5202d00f6..7fc5bf095afa6d5881285b89091d2ff48ffb69f0 100644 +index 6e15242476e07bb7e2d1b60ff9497687b2d78826..c079675b79817108947113d543d4dbd966f32ec7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -754,5 +754,10 @@ public class PaperWorldConfig { diff --git a/patches/server/0613-Skip-distance-map-update-when-spawning-disabled.patch b/patches/server/0613-Skip-distance-map-update-when-spawning-disabled.patch index 876a9da85b..20a4e9fc1e 100644 --- a/patches/server/0613-Skip-distance-map-update-when-spawning-disabled.patch +++ b/patches/server/0613-Skip-distance-map-update-when-spawning-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 5a2b3c150ceaaae651c3ec6aeff3bb894dd5f94d..266a3267833c86a99b01e0d490c992270f00ea1e 100644 +index db6a0246e83045015fc41f27e0aec0e07d1fb568..58061491be6713a21e3f9e67a0b1ac0ecceb24d6 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -784,7 +784,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -814,7 +814,7 @@ public class ServerChunkCache extends ChunkSource { int l = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - per player mob spawning NaturalSpawner.SpawnState spawnercreature_d; // moved down diff --git a/patches/server/0614-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0614-Reset-shield-blocking-on-dimension-change.patch index f64d694847..28c8cdec51 100644 --- a/patches/server/0614-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0614-Reset-shield-blocking-on-dimension-change.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 192cc28464aaa88a8f03dad0e4da7ef7948e83ce..54066aa8f14bc19935070593b344368a7d6faa70 100644 +index 82b4805b417b130be3ce9ab6ed886c85e811ba98..460f8ce00894065a15d931906c8a05ca990d6e15 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1120,6 +1120,11 @@ public class ServerPlayer extends Player { +@@ -1144,6 +1144,11 @@ public class ServerPlayer extends Player { this.level.getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end } diff --git a/patches/server/0617-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0617-added-option-to-disable-pathfinding-updates-on-block.patch index 003ed0775f..94abc6973e 100644 --- a/patches/server/0617-added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/0617-added-option-to-disable-pathfinding-updates-on-block.patch @@ -5,7 +5,7 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7fc5bf095afa6d5881285b89091d2ff48ffb69f0..0eba516110b82d917c3374a9fe5bbf337b83fad6 100644 +index c079675b79817108947113d543d4dbd966f32ec7..00d2959f0acda36020b553797cff113597772b0b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -759,5 +759,10 @@ public class PaperWorldConfig { @@ -20,7 +20,7 @@ index 7fc5bf095afa6d5881285b89091d2ff48ffb69f0..0eba516110b82d917c3374a9fe5bbf33 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fd2b301bda95438bc7e48173bbe74aec49595156..192b9483a0b6d9129afc3a28fe69eb254a0fdf4c 100644 +index 5157d5f1d04d68446cd91507a314d727cce70c79..bec580b4523bdd1982e6668481e6cb9d2beb7137 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1300,6 +1300,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0625-Add-support-for-hex-color-codes-in-console.patch b/patches/server/0625-Add-support-for-hex-color-codes-in-console.patch index 420ce8e5e6..c5f63cd550 100644 --- a/patches/server/0625-Add-support-for-hex-color-codes-in-console.patch +++ b/patches/server/0625-Add-support-for-hex-color-codes-in-console.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add support for hex color codes in console Converts upstream's hex color code legacy format into actual hex color codes in the console. diff --git a/build.gradle.kts b/build.gradle.kts -index 31a6e07981f20fc0cedbca24cf65807e50ab8142..c95e5f2fee54be09b16c26daffdfcfda877ec203 100644 +index 81d507895572e9c0ec3c87d3745f95067922093a..5ee1e44647cfd7dff08ba7ce17d4b04246b7ab57 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,6 +28,7 @@ dependencies { diff --git a/patches/server/0626-Expose-Tracked-Players.patch b/patches/server/0626-Expose-Tracked-Players.patch index 9e70588214..f5d5bb097d 100644 --- a/patches/server/0626-Expose-Tracked-Players.patch +++ b/patches/server/0626-Expose-Tracked-Players.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose Tracked Players diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 30e042a37692053d8333191487ec48eeb8c6b502..4a75642cfdf5a6eda43baa76f6a2e2a543e301ce 100644 +index 7194729b60240bead26ba22962f4389f24751046..dfbe64980060e661ae8e049604b8e90a8e13dcae 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2350,6 +2350,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2360,6 +2360,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end diff --git a/patches/server/0628-MC-29274-Fix-Wither-hostility-towards-players.patch b/patches/server/0628-MC-29274-Fix-Wither-hostility-towards-players.patch index e7acd8735b..e2ec62f95e 100644 --- a/patches/server/0628-MC-29274-Fix-Wither-hostility-towards-players.patch +++ b/patches/server/0628-MC-29274-Fix-Wither-hostility-towards-players.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC-29274: Fix Wither hostility towards players diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0eba516110b82d917c3374a9fe5bbf337b83fad6..20eb4aea24cc6699747b18b2c00e5b01dafb47c6 100644 +index 00d2959f0acda36020b553797cff113597772b0b..33cfe85f86feeda2420a1612f37e58daffb90474 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -764,5 +764,11 @@ public class PaperWorldConfig { diff --git a/patches/server/0632-fix-converting-txt-to-json-file.patch b/patches/server/0632-fix-converting-txt-to-json-file.patch index 5b1eb9d3f2..4aee6511f0 100644 --- a/patches/server/0632-fix-converting-txt-to-json-file.patch +++ b/patches/server/0632-fix-converting-txt-to-json-file.patch @@ -48,7 +48,7 @@ index 0a930147663850dc2ea7ffe9ced5611d5bab7c6d..41d1816543d0b98bd6a3ff5600cdd262 if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { return false; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9a7b635e2a962f4e1ae689ec7a3bc471d9d940cc..b26f03e163cbff2466f1ed0efd22c8e6059b7b00 100644 +index 4662c7461a9d9a7f7989003ec00d4bd97a549bde..cad35d9c45513b7db7714b7dd294cf0445b4908c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -174,6 +174,7 @@ public abstract class PlayerList { @@ -58,4 +58,4 @@ index 9a7b635e2a962f4e1ae689ec7a3bc471d9d940cc..b26f03e163cbff2466f1ed0efd22c8e6 + abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor public void placeNewPlayer(Connection connection, ServerPlayer player) { - ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper + player.isRealPlayer = true; // Paper - Chunk priority diff --git a/patches/server/0638-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0638-Allow-using-signs-inside-spawn-protection.patch index 78f5798bd1..f8460b0968 100644 --- a/patches/server/0638-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0638-Allow-using-signs-inside-spawn-protection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow using signs inside spawn protection diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 20eb4aea24cc6699747b18b2c00e5b01dafb47c6..acd61a9033fdfb91e29a5fa6a10b8983ed94baa5 100644 +index 33cfe85f86feeda2420a1612f37e58daffb90474..8047470af6f3a9842ab78c46b8e27a4fa9c961fc 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -770,5 +770,10 @@ public class PaperWorldConfig { @@ -20,10 +20,10 @@ index 20eb4aea24cc6699747b18b2c00e5b01dafb47c6..acd61a9033fdfb91e29a5fa6a10b8983 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 33ea50e1c8b2141a2c08dd18e708b7100885b569..a5502d3c6e0837e8d775cdf829be5795f2b578ae 100644 +index dc810551c25a481a491101d4e1e4c84563c2e9fc..9451283c228637e56426e883f9e0aa5392e64dab 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1701,7 +1701,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1714,7 +1714,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser int i = this.player.level.getMaxBuildHeight(); if (blockposition.getY() < i) { diff --git a/patches/server/0639-Implement-Keyed-on-World.patch b/patches/server/0639-Implement-Keyed-on-World.patch index a25a9daee6..ad3a185bb7 100644 --- a/patches/server/0639-Implement-Keyed-on-World.patch +++ b/patches/server/0639-Implement-Keyed-on-World.patch @@ -34,10 +34,10 @@ index 3cd1877e1e61ca00851098e99e4f1bf375bc79e4..eae363f7ea979782d2c3c787706dd889 // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 636e63cf27a685710fd9915372b33f1c76f5b59c..cc4bad211bac6c5aac2bd45db2e17d0dfa02363f 100644 +index bd20d47be4a7d554d46ce0a463e52b5c72908e2f..516fb86346898b467d803b3d49d89b0c99952f77 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1934,6 +1934,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1940,6 +1940,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); }, net.minecraft.server.MinecraftServer.getServer()); } diff --git a/patches/server/0644-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0644-Drop-carried-item-when-player-has-disconnected.patch index 0be4115a1a..aab90fb874 100644 --- a/patches/server/0644-Drop-carried-item-when-player-has-disconnected.patch +++ b/patches/server/0644-Drop-carried-item-when-player-has-disconnected.patch @@ -7,10 +7,10 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro Closes #5036 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b26f03e163cbff2466f1ed0efd22c8e6059b7b00..c0b4b4827c03a466752db32734a60813ec98c863 100644 +index cad35d9c45513b7db7714b7dd294cf0445b4908c..30471bf7b19335dd85b11ca5e8303784f7905a8c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -614,6 +614,14 @@ public abstract class PlayerList { +@@ -615,6 +615,14 @@ public abstract class PlayerList { } // Paper end diff --git a/patches/server/0646-Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/0646-Don-t-ignore-result-of-PlayerEditBookEvent.patch index bc4e82dfff..2d6fdc3bed 100644 --- a/patches/server/0646-Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/0646-Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7ca3799e80391e2247f8935028ebebd249dfbd92..8535edf593ff8e155c977adae56f38d16369defd 100644 +index 9451283c228637e56426e883f9e0aa5392e64dab..3fc7b714ded94dbc36488f1c8365a97235c9684c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1171,7 +1171,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1177,7 +1177,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } itemstack.addTagElement("pages", (Tag) nbttaglist); diff --git a/patches/server/0647-Entity-load-save-limit-per-chunk.patch b/patches/server/0647-Entity-load-save-limit-per-chunk.patch index 7ef152b1d2..287fc65020 100644 --- a/patches/server/0647-Entity-load-save-limit-per-chunk.patch +++ b/patches/server/0647-Entity-load-save-limit-per-chunk.patch @@ -9,7 +9,7 @@ defaults are only included for certain entites, this allows setting limits for any entity type. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index acd61a9033fdfb91e29a5fa6a10b8983ed94baa5..3e9f288ee310c7c79664e69b99698fdd179ae77f 100644 +index 8047470af6f3a9842ab78c46b8e27a4fa9c961fc..d4bbb93c09d2183e5eb12d6629ed109bd2f43d76 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,9 +1,12 @@ diff --git a/patches/server/0650-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/server/0650-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch index b630d04aae..64ba11d37b 100644 --- a/patches/server/0650-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch +++ b/patches/server/0650-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow for Component suggestion tooltips in diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8535edf593ff8e155c977adae56f38d16369defd..686bf9a2711956c86e3fb1d761cb1554b1ac7e26 100644 +index 3fc7b714ded94dbc36488f1c8365a97235c9684c..01cf3449072a243e6acf64b268c64016115178f1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -757,12 +757,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -763,12 +763,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - async tab completion com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; @@ -24,7 +24,7 @@ index 8535edf593ff8e155c977adae56f38d16369defd..686bf9a2711956c86e3fb1d761cb1554 // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server if (!event.isHandled()) { if (!event.isCancelled()) { -@@ -781,10 +780,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -787,10 +786,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser }); } } else if (!completions.isEmpty()) { diff --git a/patches/server/0652-Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/0652-Fix-PlayerItemConsumeEvent-cancelling-properly.patch index ccf7400a8b..fb34ee30c1 100644 --- a/patches/server/0652-Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/0652-Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -9,7 +9,7 @@ till their item is switched. This patch clears the active item when the event is cancelled diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f0a2e27c21b0fd9df236a0a145c7cbf37661fa7d..deade89dbbd1d4e548be7be1a46e36b7a9eff809 100644 +index 25aa83e2d63edffa4a30c2563341ee4d82e4f3bd..6539cd1a63f2d987bda2b91555b94df896089d1f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3702,6 +3702,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0661-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0661-fix-PlayerItemHeldEvent-firing-twice.patch index 9e48702b7e..f52faac36f 100644 --- a/patches/server/0661-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0661-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index db00b33efed96a15fe6201903d35c61c077846de..6c3f5562d1de24a296f4e60172c12109bc1c9bae 100644 +index 01cf3449072a243e6acf64b268c64016115178f1..31ce3cdfa40b0abd2ba85a100cc7def5b0f9c65e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1905,6 +1905,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1918,6 +1918,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { diff --git a/patches/server/0663-More-World-API.patch b/patches/server/0663-More-World-API.patch index c67f416587..440ed6e909 100644 --- a/patches/server/0663-More-World-API.patch +++ b/patches/server/0663-More-World-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index cc4bad211bac6c5aac2bd45db2e17d0dfa02363f..42da5247ccda7c87cb1a29d19a26b1195a903a02 100644 +index 516fb86346898b467d803b3d49d89b0c99952f77..57822369c6b432edd39a811c0492c02ba1b30458 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1886,6 +1886,65 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0666-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch b/patches/server/0666-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch index 8f6b76c72c..04e914b79f 100644 --- a/patches/server/0666-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch +++ b/patches/server/0666-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c0b4b4827c03a466752db32734a60813ec98c863..29aab99e686702eba9885b440d5755a4e59116f6 100644 +index c4f54f57a4dc34d9c7253cc13cc57a24cb131677..2d9de1295093f46ae86346d13e7011a5a7e94fa4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -848,6 +848,7 @@ public abstract class PlayerList { +@@ -849,6 +849,7 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; @@ -17,7 +17,7 @@ index c0b4b4827c03a466752db32734a60813ec98c863..29aab99e686702eba9885b440d5755a4 boolean isRespawn = false; boolean isLocAltered = false; // Paper - Fix SPIGOT-5989 // Paper end -@@ -868,6 +869,7 @@ public abstract class PlayerList { +@@ -869,6 +870,7 @@ public abstract class PlayerList { if (optional.isPresent()) { BlockState iblockdata = worldserver1.getBlockState(blockposition); boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR); @@ -25,7 +25,7 @@ index c0b4b4827c03a466752db32734a60813ec98c863..29aab99e686702eba9885b440d5755a4 Vec3 vec3d = (Vec3) optional.get(); float f1; -@@ -895,7 +897,7 @@ public abstract class PlayerList { +@@ -896,7 +898,7 @@ public abstract class PlayerList { } Player respawnPlayer = entityplayer1.getBukkitEntity(); diff --git a/patches/server/0668-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0668-add-RespawnFlags-to-PlayerRespawnEvent.patch index 6a70b89b7d..be945dd193 100644 --- a/patches/server/0668-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0668-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6c3f5562d1de24a296f4e60172c12109bc1c9bae..06b46cb1182ef65fab3e330be9c8685f2bf37a37 100644 +index 31ce3cdfa40b0abd2ba85a100cc7def5b0f9c65e..cfcffcb5c61a8a549c9a33367d2d5c4e0cd9e9ea 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2439,7 +2439,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2452,7 +2452,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; @@ -18,10 +18,10 @@ index 6c3f5562d1de24a296f4e60172c12109bc1c9bae..06b46cb1182ef65fab3e330be9c8685f } else { if (this.player.getHealth() > 0.0F) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 29aab99e686702eba9885b440d5755a4e59116f6..a708080ef25bc9596fc8f2b997b534dc5787d495 100644 +index ddd5f1187183f397c4ddf1fb8f9eaac72b7fd2f9..2ddd973d955d170fd04a56ee5ae95fba29016793 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -807,6 +807,12 @@ public abstract class PlayerList { +@@ -808,6 +808,12 @@ public abstract class PlayerList { } public ServerPlayer moveToWorld(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation) { @@ -34,7 +34,7 @@ index 29aab99e686702eba9885b440d5755a4e59116f6..a708080ef25bc9596fc8f2b997b534dc entityplayer.stopRiding(); // CraftBukkit this.players.remove(entityplayer); this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot -@@ -897,7 +903,7 @@ public abstract class PlayerList { +@@ -898,7 +904,7 @@ public abstract class PlayerList { } Player respawnPlayer = entityplayer1.getBukkitEntity(); diff --git a/patches/server/0676-call-PortalCreateEvent-players-and-end-platform.patch b/patches/server/0676-call-PortalCreateEvent-players-and-end-platform.patch index e7f8b164d9..e01948e59b 100644 --- a/patches/server/0676-call-PortalCreateEvent-players-and-end-platform.patch +++ b/patches/server/0676-call-PortalCreateEvent-players-and-end-platform.patch @@ -5,10 +5,10 @@ Subject: [PATCH] call PortalCreateEvent players and end platform diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 54066aa8f14bc19935070593b344368a7d6faa70..b74fc226bf299e274dcf7a0e5002fea1d9886c24 100644 +index 460f8ce00894065a15d931906c8a05ca990d6e15..8f3ba87bc8d12bd344d81672b5dd96efc27e9e5d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1147,15 +1147,21 @@ public class ServerPlayer extends Player { +@@ -1171,15 +1171,21 @@ public class ServerPlayer extends Player { private void createEndPlatform(ServerLevel world, BlockPos centerPos) { BlockPos.MutableBlockPos blockposition_mutableblockposition = centerPos.mutable(); diff --git a/patches/server/0681-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0681-additions-to-PlayerGameModeChangeEvent.patch index 8beaf231b1..5f7ae7a64a 100644 --- a/patches/server/0681-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0681-additions-to-PlayerGameModeChangeEvent.patch @@ -45,10 +45,10 @@ index d75f78d2e3fb1376e8f6a8668c98a04a693c99e1..79f6089b934124c3309c6bee2e48b36b } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b74fc226bf299e274dcf7a0e5002fea1d9886c24..e426942d85cfff429e9dd3bb8f9ef6dc88524778 100644 +index 8f3ba87bc8d12bd344d81672b5dd96efc27e9e5d..0406d7fc88a0d42f0085d6736f54ff699f11e99d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1768,8 +1768,15 @@ public class ServerPlayer extends Player { +@@ -1792,8 +1792,15 @@ public class ServerPlayer extends Player { } public boolean setGameMode(GameType gameMode) { @@ -66,7 +66,7 @@ index b74fc226bf299e274dcf7a0e5002fea1d9886c24..e426942d85cfff429e9dd3bb8f9ef6dc } else { this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); if (gameMode == GameType.SPECTATOR) { -@@ -1781,7 +1788,7 @@ public class ServerPlayer extends Player { +@@ -1805,7 +1812,7 @@ public class ServerPlayer extends Player { this.onUpdateAbilities(); this.updateEffectVisibility(); @@ -75,7 +75,7 @@ index b74fc226bf299e274dcf7a0e5002fea1d9886c24..e426942d85cfff429e9dd3bb8f9ef6dc } } -@@ -2163,6 +2170,16 @@ public class ServerPlayer extends Player { +@@ -2187,6 +2194,16 @@ public class ServerPlayer extends Player { } public void loadGameTypes(@Nullable CompoundTag nbt) { @@ -126,10 +126,10 @@ index 5ef649dec31ba6d6b74a7bd757727ffd2a79d71e..1c83fbc96a074c85a3e349e936ff1f31 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 06b46cb1182ef65fab3e330be9c8685f2bf37a37..6cb46508513a5ccf60dba357ff1a2911dd5e1f64 100644 +index cfcffcb5c61a8a549c9a33367d2d5c4e0cd9e9ea..2be99856c6c734eea9096427a99df2ab70bdbba3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2448,7 +2448,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2461,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player = this.server.getPlayerList().respawn(this.player, false); if (this.server.isHardcore()) { @@ -139,10 +139,10 @@ index 06b46cb1182ef65fab3e330be9c8685f2bf37a37..6cb46508513a5ccf60dba357ff1a2911 } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4a75642cfdf5a6eda43baa76f6a2e2a543e301ce..1f631bdf64795913b0f6e5c1c4c8522f71b40dd1 100644 +index dfbe64980060e661ae8e049604b8e90a8e13dcae..a1b9601729fef9ddb277cddc9576d29756bdf251 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1245,7 +1245,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1255,7 +1255,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { throw new IllegalArgumentException("Mode cannot be null"); } diff --git a/patches/server/0691-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0691-Add-cause-to-Weather-ThunderChangeEvents.patch index 3f07d5fa51..7d93639d9c 100644 --- a/patches/server/0691-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0691-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -104,7 +104,7 @@ index cd840dc4a8ca432868fb3e9c912ea928e5303e0d..4d0af984490b556a9911c3b8fdca1e16 if (weather.isCancelled()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 48052de8a7a495743845f1610ed00cafb535bb89..696019dad030d6168a8794d5c5f21f94e58d9082 100644 +index 57822369c6b432edd39a811c0492c02ba1b30458..a8523488ec7dfe8fd2a625ca11dcb1b99619b66f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1179,7 +1179,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0695-Add-PlayerKickEvent-causes.patch b/patches/server/0695-Add-PlayerKickEvent-causes.patch index 1ac7ea4e81..81d22eba76 100644 --- a/patches/server/0695-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0695-Add-PlayerKickEvent-causes.patch @@ -57,7 +57,7 @@ index 708ac03d5a849bf09c49547306e4a8c5a5ef8d91..5a8df368a4a25839cd4ac9be6972da2e } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597caaa8ff0 100644 +index 2be99856c6c734eea9096427a99df2ab70bdbba3..7e2a329894b710cb9a400695f361fd9dafbab3d9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -140,7 +140,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } else { Entity entity = this.player.getRootVehicle(); -@@ -738,13 +746,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -744,13 +752,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable @@ -156,7 +156,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } // Paper end -@@ -896,7 +904,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -902,7 +910,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -165,7 +165,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -1055,7 +1063,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1061,7 +1069,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); @@ -174,7 +174,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } byteTotal += byteLength; -@@ -1078,14 +1086,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1084,14 +1092,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -191,7 +191,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1209,7 +1217,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1215,7 +1223,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { @@ -200,7 +200,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } else { ServerLevel worldserver = this.player.getLevel(); -@@ -1619,7 +1627,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1632,7 +1640,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -209,7 +209,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } } -@@ -1817,7 +1825,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1830,7 +1838,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); @@ -218,7 +218,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } // Paper start PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; -@@ -1922,7 +1930,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1935,7 +1943,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -227,7 +227,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } } -@@ -1938,7 +1946,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1951,7 +1959,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -236,7 +236,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } } -@@ -2011,7 +2019,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2024,7 +2032,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Waitable waitable = new Waitable() { @Override protected Object evaluate() { @@ -245,7 +245,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return null; } }; -@@ -2026,7 +2034,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2039,7 +2047,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser throw new RuntimeException(e); } } else { @@ -254,7 +254,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } // CraftBukkit end } -@@ -2299,7 +2307,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2312,7 +2320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -263,7 +263,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } // Spigot End -@@ -2390,7 +2398,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2403,7 +2411,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // CraftBukkit end } else { @@ -272,7 +272,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -2790,7 +2798,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2803,7 +2811,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { @@ -281,7 +281,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 return; } } -@@ -2978,7 +2986,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2991,7 +2999,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } else if (!this.isSingleplayerOwner()) { // Paper start - This needs to be handled on the main thread for plugins server.submit(() -> { @@ -290,7 +290,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 }); // Paper end } -@@ -3024,7 +3032,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3037,7 +3045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -299,7 +299,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3034,7 +3042,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3047,7 +3055,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -308,7 +308,7 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } } else { try { -@@ -3052,7 +3060,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3065,7 +3073,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); @@ -318,10 +318,10 @@ index 6cb46508513a5ccf60dba357ff1a2911dd5e1f64..b54f151cb3001ab2070f51ea3c20a597 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ca80f9654eff2ab8caec089acb739e60efb66ec3..37929258810a70f65219d46457965fa333486e41 100644 +index 2ddd973d955d170fd04a56ee5ae95fba29016793..f68fc7fcebe250a40905b52f6ec29ee6d094aad5 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -716,7 +716,7 @@ public abstract class PlayerList { +@@ -717,7 +717,7 @@ public abstract class PlayerList { while (iterator.hasNext()) { entityplayer = (ServerPlayer) iterator.next(); this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved @@ -330,7 +330,7 @@ index ca80f9654eff2ab8caec089acb739e60efb66ec3..37929258810a70f65219d46457965fa3 } // Instead of kicking then returning, we need to store the kick reason -@@ -1366,8 +1366,8 @@ public abstract class PlayerList { +@@ -1368,8 +1368,8 @@ public abstract class PlayerList { // Paper end // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -342,7 +342,7 @@ index ca80f9654eff2ab8caec089acb739e60efb66ec3..37929258810a70f65219d46457965fa3 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 373f84ca07dead7f23b8fcc6476473cfa9164197..87529b945211067c0b280e2381284066f2925de6 100644 +index a1b9601729fef9ddb277cddc9576d29756bdf251..23c52c2cfe760cdaa13178214ee00e8caa9552f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -499,16 +499,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0702-Fix-dangerous-end-portal-logic.patch b/patches/server/0702-Fix-dangerous-end-portal-logic.patch index 705caee4aa..f0dc5f42ac 100644 --- a/patches/server/0702-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0702-Fix-dangerous-end-portal-logic.patch @@ -11,7 +11,7 @@ Move the tick logic into the post tick, where portaling was designed to happen in the first place. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cf22785bfd4e5bb212f6fe601d38aba982fb8d4e..225a277e5f327b974ae932ab55117aeb9a230a0d 100644 +index e48d2dd51c1304aec33ad6cebec3f24c2dfee35f..b21c0c583abe9f7be5f01fc4d16029be03a5779e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -363,6 +363,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0705-Line-Of-Sight-Changes.patch b/patches/server/0705-Line-Of-Sight-Changes.patch index a891a71271..3c1c24bc44 100644 --- a/patches/server/0705-Line-Of-Sight-Changes.patch +++ b/patches/server/0705-Line-Of-Sight-Changes.patch @@ -19,7 +19,7 @@ index 6539cd1a63f2d987bda2b91555b94df896089d1f..429c229d7c88060c76b143ff4aa1bea8 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 696019dad030d6168a8794d5c5f21f94e58d9082..6f0334f5162087eff0c64c9bdd47ff6b34a481b7 100644 +index a8523488ec7dfe8fd2a625ca11dcb1b99619b66f..72750570065753df1515f7c99124b5e4e97bee64 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -189,6 +189,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0706-add-per-world-spawn-limits.patch b/patches/server/0706-add-per-world-spawn-limits.patch index f9a2915b63..78ec2969d4 100644 --- a/patches/server/0706-add-per-world-spawn-limits.patch +++ b/patches/server/0706-add-per-world-spawn-limits.patch @@ -30,7 +30,7 @@ index d8c45d689aeb1c5193d71b8f9b7ea85ae78a4206..dbace53ecb13cf372c8ad0dce2af7dcf private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 6f0334f5162087eff0c64c9bdd47ff6b34a481b7..9d7fc426710183f12f5a8606bef459040d4b33bc 100644 +index 72750570065753df1515f7c99124b5e4e97bee64..1c319b83652d8959d858545a7755d377c4ffd402 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -211,6 +211,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0710-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0710-Fix-PlayerDropItemEvent-using-wrong-item.patch index a2ca778049..32e0e834e8 100644 --- a/patches/server/0710-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0710-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e426942d85cfff429e9dd3bb8f9ef6dc88524778..30b430e9c0fe9782a94ac93c02ea28095e762dc7 100644 +index 0406d7fc88a0d42f0085d6736f54ff699f11e99d..0b648abb4e7a116912b327641a810b4ec574baff 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2139,7 +2139,7 @@ public class ServerPlayer extends Player { +@@ -2163,7 +2163,7 @@ public class ServerPlayer extends Player { if (retainOwnership) { if (!itemstack1.isEmpty()) { diff --git a/patches/server/0713-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0713-Ensure-disconnect-for-book-edit-is-called-on-main.patch index e2f4efdfac..242501b211 100644 --- a/patches/server/0713-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0713-Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b54f151cb3001ab2070f51ea3c20a597caaa8ff0..ffe9486b6634149532ee802e17683eda302041b3 100644 +index 7e2a329894b710cb9a400695f361fd9dafbab3d9..8121ed5ceb7bc6bb2d6dfdfa08d7b157e4a85b19 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1093,7 +1093,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1099,7 +1099,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper end // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { diff --git a/patches/server/0717-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0717-Use-getChunkIfLoadedImmediately-in-places.patch index f2eaa82a5d..48f27ddcb2 100644 --- a/patches/server/0717-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0717-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9da2c0e52618afbfcaf5f7851fa0a5f85f0a12f3..baa25df9f446c8edea9666983425df31c32a13ff 100644 +index 7321e33cbc7d8e92ce4954eb1db8e7d5646d559b..f1b9affe2e971203f9a72d3abbf902559e0b04e5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -202,7 +202,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -21,10 +21,10 @@ index 9da2c0e52618afbfcaf5f7851fa0a5f85f0a12f3..baa25df9f446c8edea9666983425df31 // Paper start - Asynchronous IO diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ffe9486b6634149532ee802e17683eda302041b3..d3cbcaaecd4fd33bbda8115a9fa7ff7fb743fd6b 100644 +index 8121ed5ceb7bc6bb2d6dfdfa08d7b157e4a85b19..65f9af14140041a309a035180667b87c3bd4a930 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1298,7 +1298,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1310,7 +1310,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser speed = this.player.getAbilities().walkingSpeed * 10f; } // Paper start - Prevent moving into unloaded chunks @@ -34,7 +34,7 @@ index ffe9486b6634149532ee802e17683eda302041b3..d3cbcaaecd4fd33bbda8115a9fa7ff7f return; } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b85d0222bb151ff3c7377e444a431212e262c95f..474078b68f1bf22037495f42bae59b790fd8cb46 100644 +index b527a32b3aac3888ac42463e658160491f0005cc..a7485746417e0dddb392c89a5a1d467c0bc83fbe 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -192,6 +192,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0719-Adds-PlayerArmSwingEvent.patch b/patches/server/0719-Adds-PlayerArmSwingEvent.patch index 032c2074d9..d365cf398a 100644 --- a/patches/server/0719-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0719-Adds-PlayerArmSwingEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d3cbcaaecd4fd33bbda8115a9fa7ff7fb743fd6b..5fe5a9cf5d39ab0cce0b427385016496f858dfbd 100644 +index 65f9af14140041a309a035180667b87c3bd4a930..7cffd6c32c91fbcdb62a31bb408e7a25c5194f69 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2203,7 +2203,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2216,7 +2216,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Arm swing animation diff --git a/patches/server/0720-Fixes-kick-event-leave-message-not-being-sent.patch b/patches/server/0720-Fixes-kick-event-leave-message-not-being-sent.patch index be28e1a420..3c415d69f6 100644 --- a/patches/server/0720-Fixes-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0720-Fixes-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5fe5a9cf5d39ab0cce0b427385016496f858dfbd..4bc7ad298f899b093ebe84bee276bdac5b7d5a76 100644 +index 7cffd6c32c91fbcdb62a31bb408e7a25c5194f69..aa66f019024564108570ac72b60c86a755a16c41 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -457,7 +457,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -17,7 +17,7 @@ index 5fe5a9cf5d39ab0cce0b427385016496f858dfbd..4bc7ad298f899b093ebe84bee276bdac this.connection.setReadOnly(); MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; -@@ -1850,6 +1850,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1863,6 +1863,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void onDisconnect(Component reason) { @@ -29,7 +29,7 @@ index 5fe5a9cf5d39ab0cce0b427385016496f858dfbd..4bc7ad298f899b093ebe84bee276bdac // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { return; -@@ -1866,7 +1871,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1879,7 +1884,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.disconnect(); // Paper start - Adventure @@ -39,10 +39,10 @@ index 5fe5a9cf5d39ab0cce0b427385016496f858dfbd..4bc7ad298f899b093ebe84bee276bdac this.server.getPlayerList().broadcastMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM, Util.NIL_UUID); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 37929258810a70f65219d46457965fa333486e41..2163cd133dd37d8aafb46765927bbfac6c40a809 100644 +index f68fc7fcebe250a40905b52f6ec29ee6d094aad5..eaae43ffe4701c10133ad4fd2256b22b565e6f51 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -587,6 +587,11 @@ public abstract class PlayerList { +@@ -588,6 +588,11 @@ public abstract class PlayerList { } public net.kyori.adventure.text.Component disconnect(ServerPlayer entityplayer) { // Paper - return Component @@ -54,7 +54,7 @@ index 37929258810a70f65219d46457965fa333486e41..2163cd133dd37d8aafb46765927bbfac ServerLevel worldserver = entityplayer.getLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); -@@ -597,7 +602,7 @@ public abstract class PlayerList { +@@ -598,7 +603,7 @@ public abstract class PlayerList { entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } diff --git a/patches/server/0724-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0724-Don-t-apply-cramming-damage-to-players.patch index c78196dcf0..d0319d2aa7 100644 --- a/patches/server/0724-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0724-Don-t-apply-cramming-damage-to-players.patch @@ -26,10 +26,10 @@ index 899fbd4e60ccab353e6e2b2ae2ddbe94f43255d0..6ad258d211277e671b0b15f06bcc6067 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 30b430e9c0fe9782a94ac93c02ea28095e762dc7..be4105a85100757231c6bc94a0b0684e68110754 100644 +index 0b648abb4e7a116912b327641a810b4ec574baff..1f5dfc88e6e9674f7c557848fa1d1a3a2800ddb5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1397,7 +1397,7 @@ public class ServerPlayer extends Player { +@@ -1421,7 +1421,7 @@ public class ServerPlayer extends Player { @Override public boolean isInvulnerableTo(DamageSource damageSource) { diff --git a/patches/server/0733-Prevent-AFK-kick-while-watching-end-credits.patch b/patches/server/0733-Prevent-AFK-kick-while-watching-end-credits.patch index b09b7f0537..158e650685 100644 --- a/patches/server/0733-Prevent-AFK-kick-while-watching-end-credits.patch +++ b/patches/server/0733-Prevent-AFK-kick-while-watching-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent AFK kick while watching end credits. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4bc7ad298f899b093ebe84bee276bdac5b7d5a76..62f2a09adefc6a90089bf5edd19b7e69a78e696e 100644 +index 064aecb28f05fcf572ee7d29f611a31cc7b6e49a..ad1a9c6c354d40d5fa589666b1b00792d9cd6161 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -389,7 +389,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0735-Add-PlayerSetSpawnEvent.patch b/patches/server/0735-Add-PlayerSetSpawnEvent.patch index 931c6026c4..e51242a58e 100644 --- a/patches/server/0735-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0735-Add-PlayerSetSpawnEvent.patch @@ -18,10 +18,10 @@ index e95f2222814e104bf9194a96385737dffe2cb2b5..249ab7357aa19d87179fa4c3ae89d9d3 String string = resourceKey.location().toString(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index be4105a85100757231c6bc94a0b0684e68110754..065589d43d411d1bde9f91594bfe7cdc6ff210a0 100644 +index 1f5dfc88e6e9674f7c557848fa1d1a3a2800ddb5..8e1478593fcf79ee7a25d666503736cbe707a52c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1238,7 +1238,7 @@ public class ServerPlayer extends Player { +@@ -1262,7 +1262,7 @@ public class ServerPlayer extends Player { } else if (this.bedBlocked(blockposition, enumdirection)) { return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { @@ -30,7 +30,7 @@ index be4105a85100757231c6bc94a0b0684e68110754..065589d43d411d1bde9f91594bfe7cdc if (this.level.isDay()) { return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { -@@ -2066,12 +2066,33 @@ public class ServerPlayer extends Player { +@@ -2090,12 +2090,33 @@ public class ServerPlayer extends Player { return this.respawnForced; } @@ -67,10 +67,10 @@ index be4105a85100757231c6bc94a0b0684e68110754..065589d43d411d1bde9f91594bfe7cdc this.respawnPosition = pos; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2163cd133dd37d8aafb46765927bbfac6c40a809..6d057d6969cd1abff3da5967b9db5a830209b206 100644 +index d02667f8623022fae4ad468718504c1c04023034..8ec582cc5c33396fa336a9cc6494f3aacd3b4339 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -892,7 +892,7 @@ public abstract class PlayerList { +@@ -893,7 +893,7 @@ public abstract class PlayerList { f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D); } @@ -93,10 +93,10 @@ index af4eb4a8814491afef449a2874521636957d7557..0a5d563700c9f806139001181f01fa9d return InteractionResult.SUCCESS; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 87529b945211067c0b280e2381284066f2925de6..2eb934cc29f9dc42036f465ed6a6dbf2e5baadef 100644 +index 23c52c2cfe760cdaa13178214ee00e8caa9552f9..abf1bd1d3f29e998f08ff86395c3f16d27a5b7d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1065,9 +1065,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1075,9 +1075,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setBedSpawnLocation(Location location, boolean override) { if (location == null) { diff --git a/patches/server/0740-Optimize-indirect-passenger-iteration.patch b/patches/server/0740-Optimize-indirect-passenger-iteration.patch index b791bea914..02ae958641 100644 --- a/patches/server/0740-Optimize-indirect-passenger-iteration.patch +++ b/patches/server/0740-Optimize-indirect-passenger-iteration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize indirect passenger iteration diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 225a277e5f327b974ae932ab55117aeb9a230a0d..b129e8a46d1ad2a13f63c841e6edfb61638fc5e2 100644 +index b21c0c583abe9f7be5f01fc4d16029be03a5779e..97f4cb48879af136470214d94d37d386d13aee8d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3478,26 +3478,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0745-ChunkMap.mainInvokingExecutor.patch b/patches/server/0745-ChunkMap.mainInvokingExecutor.patch deleted file mode 100644 index 12cef167f4..0000000000 --- a/patches/server/0745-ChunkMap.mainInvokingExecutor.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sat, 14 Aug 2021 14:49:45 +0100 -Subject: [PATCH] ChunkMap.mainInvokingExecutor - -This is a temp patch, this should maybe be moved to a more generic map or potentially wrapped into mcutil for the sake of this being such a generic concept -anyways - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c42f564ecac75f7947c580e7514795c26097761e..70891232460665ff0d1f80ff09e3773753168d4a 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -150,6 +150,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - public final ServerLevel level; - private final ThreadedLevelLightEngine lightEngine; - private final BlockableEventLoop mainThreadExecutor; -+ final java.util.concurrent.Executor mainInvokingExecutor; // Paper // Paper - Move to MCUtil? - public final ChunkGenerator generator; - public final Supplier overworldDataStorage; - private final PoiManager poiManager; -@@ -355,6 +356,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.level = world; - this.generator = chunkGenerator; - this.mainThreadExecutor = mainThreadExecutor; -+ // Paper start -+ this.mainInvokingExecutor = (run) -> { -+ if (MCUtil.isMainThread()) { -+ run.run(); -+ } else { -+ mainThreadExecutor.execute(run); -+ } -+ }; -+ // Paper end - ProcessorMailbox threadedmailbox = ProcessorMailbox.create(executor, "worldgen"); - - Objects.requireNonNull(mainThreadExecutor); diff --git a/patches/server/0746-Set-AsyncAppender-dispatch-thread-to-be-a-daemon-thr.patch b/patches/server/0745-Set-AsyncAppender-dispatch-thread-to-be-a-daemon-thr.patch similarity index 100% rename from patches/server/0746-Set-AsyncAppender-dispatch-thread-to-be-a-daemon-thr.patch rename to patches/server/0745-Set-AsyncAppender-dispatch-thread-to-be-a-daemon-thr.patch diff --git a/patches/server/0747-Respect-despawn-rate-in-item-merge-check.patch b/patches/server/0746-Respect-despawn-rate-in-item-merge-check.patch similarity index 100% rename from patches/server/0747-Respect-despawn-rate-in-item-merge-check.patch rename to patches/server/0746-Respect-despawn-rate-in-item-merge-check.patch diff --git a/patches/server/0748-Move-BlockPistonRetractEvent-to-fix-duplication.patch b/patches/server/0747-Move-BlockPistonRetractEvent-to-fix-duplication.patch similarity index 100% rename from patches/server/0748-Move-BlockPistonRetractEvent-to-fix-duplication.patch rename to patches/server/0747-Move-BlockPistonRetractEvent-to-fix-duplication.patch diff --git a/patches/server/0749-Change-EnderEye-target-without-changing-other-things.patch b/patches/server/0748-Change-EnderEye-target-without-changing-other-things.patch similarity index 100% rename from patches/server/0749-Change-EnderEye-target-without-changing-other-things.patch rename to patches/server/0748-Change-EnderEye-target-without-changing-other-things.patch diff --git a/patches/server/0750-Fix-bed-handling-for-custom-dimensions.patch b/patches/server/0749-Fix-bed-handling-for-custom-dimensions.patch similarity index 95% rename from patches/server/0750-Fix-bed-handling-for-custom-dimensions.patch rename to patches/server/0749-Fix-bed-handling-for-custom-dimensions.patch index ec07f53e7c..8deabb5c89 100644 --- a/patches/server/0750-Fix-bed-handling-for-custom-dimensions.patch +++ b/patches/server/0749-Fix-bed-handling-for-custom-dimensions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix bed handling for custom dimensions diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 065589d43d411d1bde9f91594bfe7cdc6ff210a0..4668bcdaa08bbb0b01010408834e707d2ed058ab 100644 +index 8e1478593fcf79ee7a25d666503736cbe707a52c..8565aa3698a4febe21cb3aae0af51ae3479ec743 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1231,7 +1231,7 @@ public class ServerPlayer extends Player { +@@ -1255,7 +1255,7 @@ public class ServerPlayer extends Player { // CraftBukkit start - moved bed result checks from below into separate method private Either getBedResult(BlockPos blockposition, Direction enumdirection) { if (!this.isSleeping() && this.isAlive()) { diff --git a/patches/server/0751-Add-BlockBreakBlockEvent.patch b/patches/server/0750-Add-BlockBreakBlockEvent.patch similarity index 100% rename from patches/server/0751-Add-BlockBreakBlockEvent.patch rename to patches/server/0750-Add-BlockBreakBlockEvent.patch diff --git a/patches/server/0752-Vanilla-command-permission-fixes.patch b/patches/server/0751-Vanilla-command-permission-fixes.patch similarity index 100% rename from patches/server/0752-Vanilla-command-permission-fixes.patch rename to patches/server/0751-Vanilla-command-permission-fixes.patch diff --git a/patches/server/0752-Make-CallbackExecutor-strict-again.patch b/patches/server/0752-Make-CallbackExecutor-strict-again.patch new file mode 100644 index 0000000000..f236b3b25f --- /dev/null +++ b/patches/server/0752-Make-CallbackExecutor-strict-again.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Fri, 24 Apr 2020 09:06:15 -0700 +Subject: [PATCH] Make CallbackExecutor strict again + +The correct fix for double scheduling is to avoid it. The reason +this class is used is because double scheduling causes issues +elsewhere, and it acts as an explicit detector of what double +schedules. Effectively, use the callback executor as a tool of +finding issues rather than hiding these issues. + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 1c662deee2a3184c7612cf7de5f798753fbd7381..d11c70dc9f65171827190028ebcc4db7331fff20 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -182,17 +182,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + public final CallbackExecutor callbackExecutor = new CallbackExecutor(); + public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { + +- private final java.util.Queue queue = new java.util.ArrayDeque<>(); ++ private Runnable queued; // Paper - revert CB changes + + @Override + public void execute(Runnable runnable) { +- this.queue.add(runnable); ++ // Paper start - revert CB changes ++ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute"); ++ if (this.queued != null) { ++ MinecraftServer.LOGGER.fatal("Failed to schedule runnable", new IllegalStateException("Already queued")); ++ throw new IllegalStateException("Already queued"); ++ } ++ this.queued = runnable; ++ // Paper end - revert CB changes + } + + @Override + public void run() { +- Runnable task; +- while ((task = this.queue.poll()) != null) { ++ // Paper start - revert CB changes ++ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute"); ++ Runnable task = this.queued; ++ if (task != null) { ++ this.queued = null; ++ // Paper end - revert CB changes + task.run(); + } + } diff --git a/patches/server/0753-Prevent-unload-calls-removing-tickets-for-sync-loads.patch b/patches/server/0753-Prevent-unload-calls-removing-tickets-for-sync-loads.patch new file mode 100644 index 0000000000..293eb1263c --- /dev/null +++ b/patches/server/0753-Prevent-unload-calls-removing-tickets-for-sync-loads.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Thu, 18 Jun 2020 18:23:20 -0700 +Subject: [PATCH] Prevent unload() calls removing tickets for sync loads + + +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 58061491be6713a21e3f9e67a0b1ac0ecceb24d6..6b95085a5c8c7b91a326f205e56a978deacbbebd 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -573,6 +573,8 @@ public class ServerChunkCache extends ChunkSource { + return completablefuture; + } + ++ private long syncLoadCounter; // Paper - prevent plugin unloads from removing our ticket ++ + private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { + // Paper start - add isUrgent - old sig left in place for dirty nms plugins + return getChunkFutureMainThread(i, j, chunkstatus, flag, false); +@@ -591,9 +593,12 @@ public class ServerChunkCache extends ChunkSource { + ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel()); + currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)); + } ++ final Long identifier; // Paper - prevent plugin unloads from removing our ticket + if (flag && !currentlyUnloading) { + // CraftBukkit end + this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); ++ identifier = Long.valueOf(this.syncLoadCounter++); // Paper - prevent plugin unloads from removing our ticket ++ this.distanceManager.addTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); // Paper - prevent plugin unloads from removing our ticket + if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority + if (this.chunkAbsent(playerchunk, l)) { + ProfilerFiller gameprofilerfiller = this.level.getProfiler(); +@@ -604,12 +609,20 @@ public class ServerChunkCache extends ChunkSource { + playerchunk = this.getVisibleChunkIfPresent(k); + gameprofilerfiller.pop(); + if (this.chunkAbsent(playerchunk, l)) { ++ this.distanceManager.removeTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); // Paper + throw (IllegalStateException) Util.pauseInIde((Throwable) (new IllegalStateException("No chunk holder after ticket has been added"))); + } + } +- } ++ } else { identifier = null; } // Paper - prevent plugin unloads from removing our ticket + // Paper start - Chunk priority + CompletableFuture> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap); ++ // Paper start - prevent plugin unloads from removing our ticket ++ if (flag && !currentlyUnloading) { ++ future.thenAcceptAsync((either) -> { ++ ServerChunkCache.this.distanceManager.removeTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); ++ }, ServerChunkCache.this.mainThreadProcessor); ++ } ++ // Paper end - prevent plugin unloads from removing our ticket + if (isUrgent) { + future.thenAccept(either -> this.distanceManager.clearUrgent(chunkcoordintpair)); + } +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index 3c1698ba0d3bc412ab957777d9b5211dbc555208..41ddcf6775f99c56cf4b13b284420061e5dd6bdc 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -31,6 +31,7 @@ public class TicketType { + public static final TicketType PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit + public static final TicketType PLUGIN_TICKET = TicketType.create("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit + public static final TicketType DELAY_UNLOAD = create("delay_unload", Long::compareTo, 300); // Paper ++ public static final TicketType REQUIRED_LOAD = create("required_load", Long::compareTo); // Paper - make sure getChunkAt does not fail + + public static TicketType create(String name, Comparator argumentComparator) { + return new TicketType<>(name, argumentComparator, 0L); diff --git a/patches/server/0754-Do-not-allow-ticket-level-changes-while-unloading-pl.patch b/patches/server/0754-Do-not-allow-ticket-level-changes-while-unloading-pl.patch new file mode 100644 index 0000000000..a028936458 --- /dev/null +++ b/patches/server/0754-Do-not-allow-ticket-level-changes-while-unloading-pl.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sat, 19 Sep 2020 15:29:16 -0700 +Subject: [PATCH] Do not allow ticket level changes while unloading + playerchunks + +Sync loading the chunk at this stage would cause it to load +older data, as well as screwing our region state. + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index d11c70dc9f65171827190028ebcc4db7331fff20..62d5bfe5912e13bfef4f8e65c9a030e08b2cc4aa 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -336,6 +336,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + // Paper end + ++ boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks + private final java.util.concurrent.ExecutorService lightThread; // Paper + public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { + super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync); +@@ -853,6 +854,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + + @Nullable + ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) { ++ if (this.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper + if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) { + return holder; + } else { +@@ -1106,6 +1108,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + if (completablefuture1 != completablefuture) { + this.scheduleUnload(pos, holder); + } else { ++ // Paper start - do not allow ticket level changes while unloading chunks ++ org.spigotmc.AsyncCatcher.catchOp("playerchunk unload"); ++ boolean unloadingBefore = this.unloadingPlayerChunk; ++ this.unloadingPlayerChunk = true; ++ try { ++ // Paper end - do not allow ticket level changes while unloading chunks + if (this.pendingUnloads.remove(pos, holder) && ichunkaccess != null) { + if (ichunkaccess instanceof LevelChunk) { + ((LevelChunk) ichunkaccess).setLoaded(false); +@@ -1132,6 +1140,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.lightEngine.tryScheduleUpdate(); + this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); + } ++ } finally { this.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes while unloading chunks + + } + }; +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 6b95085a5c8c7b91a326f205e56a978deacbbebd..552d3c27abd582fcd09c8494dc0b796c4fc0291d 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -680,6 +680,7 @@ public class ServerChunkCache extends ChunkSource { + + public boolean runDistanceManagerUpdates() { + if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority ++ if (this.chunkMap.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper + boolean flag = this.distanceManager.runAllUpdates(this.chunkMap); + boolean flag1 = this.chunkMap.promoteChunkMap(); + diff --git a/patches/server/0755-Do-not-allow-the-server-to-unload-chunks-at-request-.patch b/patches/server/0755-Do-not-allow-the-server-to-unload-chunks-at-request-.patch new file mode 100644 index 0000000000..1db416a2b0 --- /dev/null +++ b/patches/server/0755-Do-not-allow-the-server-to-unload-chunks-at-request-.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Thu, 11 Mar 2021 02:32:30 -0800 +Subject: [PATCH] Do not allow the server to unload chunks at request of + plugins + +In general the chunk system is not well suited for this behavior, +especially if it is called during a chunk load. The chunks pushed +to be unloaded will simply be unloaded next tick, rather than +immediately. + +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 552d3c27abd582fcd09c8494dc0b796c4fc0291d..a1cee90b0435b96908a9095151e4d69255b5d0e6 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -747,6 +747,7 @@ public class ServerChunkCache extends ChunkSource { + + // CraftBukkit start - modelled on below + public void purgeUnload() { ++ if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system + this.level.getProfiler().push("purge"); + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); diff --git a/patches/server/0756-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0756-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch new file mode 100644 index 0000000000..bc7cf48904 --- /dev/null +++ b/patches/server/0756-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Thu, 11 Mar 2021 03:03:32 -0800 +Subject: [PATCH] Do not run close logic for inventories on chunk unload + +Still call the event and change the active container though. We +want to avoid close logic because it's possible to load the +chunk through it. This should also be OK from a leak prevention/ +state desync POV because the TE is getting unloaded anyways. + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index f1b9affe2e971203f9a72d3abbf902559e0b04e5..34497bf24046225108c47f1faf52bb1830f56d14 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1206,9 +1206,13 @@ public class ServerLevel extends Level implements WorldGenLevel { + // Spigot Start + for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { + if (tileentity instanceof net.minecraft.world.Container) { ++ // Paper start - this area looks like it can load chunks, change the behavior ++ // chests for example can apply physics to the world ++ // so instead we just change the active container and call the event + for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) { +- h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper ++ ((org.bukkit.craftbukkit.entity.CraftHumanEntity)h).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper + } ++ // Tuiniy end + } + } + // Spigot End +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 8565aa3698a4febe21cb3aae0af51ae3479ec743..718649f1ffa20e618063a17e62d4b00c01c7c8eb 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -1564,6 +1564,18 @@ public class ServerPlayer extends Player { + this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); + this.doCloseContainer(); + } ++ // Paper start - special close for unloaded inventory ++ @Override ++ public void closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { ++ // copied from above ++ CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit ++ // Paper end ++ // copied from below ++ this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); ++ this.containerMenu = this.inventoryMenu; ++ // do not run close logic ++ } ++ // Paper end - special close for unloaded inventory + + public void doCloseContainer() { + this.containerMenu.removed((Player) this); +diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java +index d8780f06efc261a42389e466573a0bcf10c333f6..cea92f1dc663bf0648b2bd877d86ca380a517bc9 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -498,6 +498,11 @@ public abstract class Player extends LivingEntity { + this.containerMenu = this.inventoryMenu; + } + // Paper end ++ // Paper start - special close for unloaded inventory ++ public void closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { ++ this.containerMenu = this.inventoryMenu; ++ } ++ // Paper end - special close for unloaded inventory + + public void closeContainer() { + this.containerMenu = this.inventoryMenu; diff --git a/patches/server/0757-Correctly-handle-recursion-for-chunkholder-updates.patch b/patches/server/0757-Correctly-handle-recursion-for-chunkholder-updates.patch new file mode 100644 index 0000000000..89c2fd766a --- /dev/null +++ b/patches/server/0757-Correctly-handle-recursion-for-chunkholder-updates.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 21 Mar 2021 17:32:47 -0700 +Subject: [PATCH] Correctly handle recursion for chunkholder updates + +If a chunk ticket level is brought up while unloading it would +cause a recursive call which would handle the increase but then +the caller would think the chunk would be unloaded. + +diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java +index e844ac574e4b94580a14027c130374f1287f7324..844a0e1ac3a6480c8d7b49debaada2c698432405 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java ++++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +@@ -624,8 +624,10 @@ public class ChunkHolder { + playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); + } + ++ protected long updateCount; // Paper - correctly handle recursion + protected void updateFutures(ChunkMap chunkStorage, Executor executor) { + ensureTickThread("Async ticket level update"); // Paper ++ long updateCount = ++this.updateCount; // Paper - correctly handle recursion + ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel); + ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel); + boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE; +@@ -667,6 +669,12 @@ public class ChunkHolder { + + // Run callback right away if the future was already done + chunkStorage.callbackExecutor.run(); ++ // Paper start - correctly handle recursion ++ if (this.updateCount != updateCount) { ++ // something else updated ticket level for us. ++ return; ++ } ++ // Paper end - correctly handle recursion + } + // CraftBukkit end + CompletableFuture completablefuture; diff --git a/patches/server/0758-Separate-lookup-locking-from-state-access-in-UserCac.patch b/patches/server/0758-Separate-lookup-locking-from-state-access-in-UserCac.patch new file mode 100644 index 0000000000..b5bd2f63c9 --- /dev/null +++ b/patches/server/0758-Separate-lookup-locking-from-state-access-in-UserCac.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sat, 11 Jul 2020 05:09:28 -0700 +Subject: [PATCH] Separate lookup locking from state access in UserCache + +Prevent lookups from stalling simple state access/write calls + +diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java +index 61405c2b53e03a4b83e2c70c6e4d3739ca9676cb..66dfa8c844963091b63e1f2f85d0da6dd2cd083c 100644 +--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java ++++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +@@ -62,6 +62,11 @@ public class GameProfileCache { + @Nullable + private Executor executor; + ++ // Paper start ++ protected final java.util.concurrent.locks.ReentrantLock stateLock = new java.util.concurrent.locks.ReentrantLock(); ++ protected final java.util.concurrent.locks.ReentrantLock lookupLock = new java.util.concurrent.locks.ReentrantLock(); ++ // Paper end ++ + public GameProfileCache(GameProfileRepository profileRepository, File cacheFile) { + this.profileRepository = profileRepository; + this.file = cacheFile; +@@ -69,6 +74,7 @@ public class GameProfileCache { + } + + private void safeAdd(GameProfileCache.GameProfileInfo entry) { ++ try { this.stateLock.lock(); // Paper - allow better concurrency + GameProfile gameprofile = entry.getProfile(); + + entry.setLastAccess(this.getNextOperation()); +@@ -83,6 +89,7 @@ public class GameProfileCache { + if (uuid != null) { + this.profilesByUUID.put(uuid, entry); + } ++ } finally { this.stateLock.unlock(); } // Paper - allow better concurrency + + } + +@@ -119,7 +126,7 @@ public class GameProfileCache { + return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper + } + +- public synchronized void add(GameProfile profile) { // Paper - synchronize ++ public void add(GameProfile profile) { // Paper - synchronize // Paper - allow better concurrency + Calendar calendar = Calendar.getInstance(); + + calendar.setTime(new Date()); +@@ -142,8 +149,9 @@ public class GameProfileCache { + } + // Paper end + +- public synchronized Optional get(String name) { // Paper - synchronize ++ public Optional get(String name) { // Paper - synchronize // Paper start - allow better concurrency + String s1 = name.toLowerCase(Locale.ROOT); ++ boolean stateLocked = true; try { this.stateLock.lock(); // Paper - allow better concurrency + GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); + boolean flag = false; + +@@ -159,8 +167,12 @@ public class GameProfileCache { + if (usercache_usercacheentry != null) { + usercache_usercacheentry.setLastAccess(this.getNextOperation()); + optional = Optional.of(usercache_usercacheentry.getProfile()); ++ stateLocked = false; this.stateLock.unlock(); // Paper - allow better concurrency + } else { ++ stateLocked = false; this.stateLock.unlock(); // Paper - allow better concurrency ++ try { this.lookupLock.lock(); // Paper - allow better concurrency + optional = GameProfileCache.lookupGameProfile(this.profileRepository, name); // Spigot - use correct case for offline players ++ } finally { this.lookupLock.unlock(); } // Paper - allow better concurrency + if (optional.isPresent()) { + this.add((GameProfile) optional.get()); + flag = false; +@@ -172,6 +184,7 @@ public class GameProfileCache { + } + + return optional; ++ } finally { if (stateLocked) { this.stateLock.unlock(); } } // Paper - allow better concurrency + } + + public void getAsync(String username, Consumer> consumer) { +@@ -198,6 +211,7 @@ public class GameProfileCache { + } + + public Optional get(UUID uuid) { ++ try { this.stateLock.lock(); // Paper - allow better concurrency + GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid); + + if (usercache_usercacheentry == null) { +@@ -206,6 +220,7 @@ public class GameProfileCache { + usercache_usercacheentry.setLastAccess(this.getNextOperation()); + return Optional.of(usercache_usercacheentry.getProfile()); + } ++ } finally { this.stateLock.unlock(); } // Paper - allow better concurrency + } + + public void setExecutor(Executor executor) { +@@ -322,7 +337,9 @@ public class GameProfileCache { + } + + private Stream getTopMRUProfiles(int limit) { ++ try { this.stateLock.lock(); // Paper - allow better concurrency + return ImmutableList.copyOf(this.profilesByUUID.values()).stream().sorted(Comparator.comparing(GameProfileCache.GameProfileInfo::getLastAccess).reversed()).limit((long) limit); ++ } finally { this.stateLock.unlock(); } // Paper - allow better concurrency + } + + private static JsonElement writeGameProfile(GameProfileCache.GameProfileInfo entry, DateFormat dateFormat) { diff --git a/patches/server/0759-Fix-chunks-refusing-to-unload-at-low-TPS.patch b/patches/server/0759-Fix-chunks-refusing-to-unload-at-low-TPS.patch new file mode 100644 index 0000000000..05d46f1b22 --- /dev/null +++ b/patches/server/0759-Fix-chunks-refusing-to-unload-at-low-TPS.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 1 Feb 2021 15:35:14 -0800 +Subject: [PATCH] Fix chunks refusing to unload at low TPS + +The full chunk future is appended to the chunk save future, but +when moving to unloaded ticket level it is not being completed with +the empty chunk access, so the chunk save must wait for the full +chunk future to complete. We can simply schedule to the immediate +executor to get this effect, rather than the main mailbox. + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 62d5bfe5912e13bfef4f8e65c9a030e08b2cc4aa..2cac6b2df5b92690ad347c0b6dc29525e0a53788 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -1502,9 +1502,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + chunk.unpackTicks(); + return chunk; + }); +- }, (runnable) -> { +- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(playerchunk, runnable)); +- }); ++ }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading + } + + public int getTickingGenerated() { diff --git a/patches/server/0760-Do-not-allow-ticket-level-changes-when-updating-chun.patch b/patches/server/0760-Do-not-allow-ticket-level-changes-when-updating-chun.patch new file mode 100644 index 0000000000..0a3d148f3a --- /dev/null +++ b/patches/server/0760-Do-not-allow-ticket-level-changes-when-updating-chun.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 20 Jun 2021 00:08:13 -0700 +Subject: [PATCH] Do not allow ticket level changes when updating chunk ticking + state + +This WILL cause state corruption if it happens. So, don't +allow it. + +diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java +index 844a0e1ac3a6480c8d7b49debaada2c698432405..660ec9359cb9fe9cdb54d7ef6139bbbccb91ba16 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java ++++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +@@ -597,7 +597,13 @@ public class ChunkHolder { + CompletableFuture completablefuture1 = new CompletableFuture(); + + completablefuture1.thenRunAsync(() -> { ++ // Paper start - do not allow ticket level changes ++ boolean unloadingBefore = this.chunkMap.unloadingPlayerChunk; ++ this.chunkMap.unloadingPlayerChunk = true; ++ try { ++ // Paper end - do not allow ticket level changes + playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); ++ } finally { this.chunkMap.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes + }, executor); + this.pendingFullStateConfirmation = completablefuture1; + completablefuture.thenAccept((either) -> { +@@ -621,7 +627,12 @@ public class ChunkHolder { + + private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) { + this.pendingFullStateConfirmation.cancel(false); ++ // Paper start - do not allow ticket level changes ++ boolean unloadingBefore = this.chunkMap.unloadingPlayerChunk; ++ this.chunkMap.unloadingPlayerChunk = true; ++ try { // Paper end - do not allow ticket level changes + playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); ++ } finally { this.chunkMap.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes + } + + protected long updateCount; // Paper - correctly handle recursion diff --git a/patches/server/0761-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0761-Do-not-submit-profile-lookups-to-worldgen-threads.patch new file mode 100644 index 0000000000..a636b5f2f5 --- /dev/null +++ b/patches/server/0761-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 8 Aug 2021 16:26:46 -0700 +Subject: [PATCH] Do not submit profile lookups to worldgen threads + +They block. On network I/O. + +If enough tasks are submitted the server will eventually stall +out due to a sync load, as the worldgen threads will be +stalling on profile lookups. + +diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java +index 59437f04911662f06596ef61b91017caa6427eec..69faebb95924946f648cf9f86ff777d3274e3f28 100644 +--- a/src/main/java/net/minecraft/Util.java ++++ b/src/main/java/net/minecraft/Util.java +@@ -67,6 +67,22 @@ public class Util { + private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); + private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority + private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority ++ // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread ++ public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() { ++ ++ private final AtomicInteger count = new AtomicInteger(); ++ ++ @Override ++ public Thread newThread(Runnable run) { ++ Thread ret = new Thread(run); ++ ret.setName("Profile Lookup Executor #" + this.count.getAndIncrement()); ++ ret.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -> { ++ LOGGER.fatal("Uncaught exception in thread " + thread.getName(), throwable); ++ }); ++ return ret; ++ } ++ }); ++ // Paper end - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread + private static final ExecutorService IO_POOL = makeIoExecutor(); + public static LongSupplier timeSource = System::nanoTime; + public static final UUID NIL_UUID = new UUID(0L, 0L); +diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java +index 66dfa8c844963091b63e1f2f85d0da6dd2cd083c..f5b8ff3032e46173c0e8920efb336b9901331259 100644 +--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java ++++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +@@ -200,7 +200,7 @@ public class GameProfileCache { + } else { + this.requests.put(username, CompletableFuture.supplyAsync(() -> { + return this.get(username); +- }, Util.backgroundExecutor()).whenCompleteAsync((optional, throwable) -> { ++ }, Util.PROFILE_EXECUTOR).whenCompleteAsync((optional, throwable) -> { // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor + this.requests.remove(username); + }, this.executor).whenCompleteAsync((optional, throwable) -> { + consumer.accept(optional); +diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +index 6381544b0038de9a09c01238638e4e127e4eddc6..f61c313195c3d16d996721b2f8cd0d9a10ce1aaf 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +@@ -150,7 +150,7 @@ public class SkullBlockEntity extends BlockEntity { + public static void updateGameprofile(@Nullable GameProfile owner, Consumer callback) { + if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && profileCache != null && sessionService != null) { + profileCache.getAsync(owner.getName(), (profile) -> { +- Util.backgroundExecutor().execute(() -> { ++ Util.PROFILE_EXECUTOR.execute(() -> { // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor + Util.ifElse(profile, (profilex) -> { + Property property = Iterables.getFirst(profilex.getProperties().get("textures"), (Property)null); + if (property == null) {