diff --git a/patches/server/0018-Rewrite-chunk-system.patch b/patches/server/0018-Rewrite-chunk-system.patch index 0cb9df59a9..ac597c6bb2 100644 --- a/patches/server/0018-Rewrite-chunk-system.patch +++ b/patches/server/0018-Rewrite-chunk-system.patch @@ -6475,10 +6475,10 @@ index 0000000000000000000000000000000000000000..679ed4d53269e1113035b462cf74ab16 +} diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff3723229fb47db1 +index 0000000000000000000000000000000000000000..5b446e6ac151f99f64f0c442d0b40b5e251bc4c4 --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java -@@ -0,0 +1,1499 @@ +@@ -0,0 +1,1500 @@ +package io.papermc.paper.chunk.system.scheduling; +import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor; +import ca.spottedleaf.concurrentutil.lock.ReentrantAreaLock; @@ -6545,7 +6545,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + + private static final long NO_TIMEOUT_MARKER = Long.MIN_VALUE; + private static final long PROBE_MARKER = Long.MIN_VALUE + 1; -+ public final ReentrantAreaLock ticketLockArea = new ReentrantAreaLock(ChunkTaskScheduler.getChunkSystemLockShift()); ++ public final ReentrantAreaLock ticketLockArea; + + private final ConcurrentHashMap>> tickets = new java.util.concurrent.ConcurrentHashMap<>(); + private final ConcurrentHashMap sectionToChunkToExpireCount = new java.util.concurrent.ConcurrentHashMap<>(); @@ -6557,7 +6557,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + final List scheduledTasks = new ArrayList<>(); + final List changedFullStatus = new ArrayList<>(); + final boolean ret; -+ final ca.spottedleaf.concurrentutil.lock.ReentrantAreaLock.Node ticketLock = this.ticketLockArea.lock( ++ final ReentrantAreaLock.Node ticketLock = this.ticketLockArea.lock( + ((posX >> ticketShift) - 1) << ticketShift, + ((posZ >> ticketShift) - 1) << ticketShift, + (((posX >> ticketShift) + 1) << ticketShift) | ticketMask, @@ -6618,7 +6618,8 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + public ChunkHolderManager(final ServerLevel world, final ChunkTaskScheduler taskScheduler) { + this.world = world; + this.taskScheduler = taskScheduler; -+ this.unloadQueue = new ChunkQueue(TickRegions.getRegionChunkShift()); ++ this.ticketLockArea = new ReentrantAreaLock(taskScheduler.getChunkSystemLockShift()); ++ this.unloadQueue = new ChunkQueue(world.getRegionChunkShift()); + } + + private final AtomicLong statusUpgradeId = new AtomicLong(); @@ -6871,7 +6872,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + public Long2ObjectOpenHashMap>> getTicketsCopy() { + final Long2ObjectOpenHashMap>> ret = new Long2ObjectOpenHashMap<>(); + final Long2ObjectOpenHashMap> sections = new Long2ObjectOpenHashMap(); -+ final int sectionShift = ChunkTaskScheduler.getChunkSystemLockShift(); ++ final int sectionShift = this.taskScheduler.getChunkSystemLockShift(); + for (final RegionFileIOThread.ChunkCoordinate coord : this.tickets.keySet()) { + sections.computeIfAbsent( + CoordinateUtils.getChunkKey( @@ -6960,7 +6961,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + private void addExpireCount(final int chunkX, final int chunkZ) { + final long chunkKey = CoordinateUtils.getChunkKey(chunkX, chunkZ); + -+ final int sectionShift = TickRegions.getRegionChunkShift(); ++ final int sectionShift = this.world.getRegionChunkShift(); + final RegionFileIOThread.ChunkCoordinate sectionKey = new RegionFileIOThread.ChunkCoordinate(CoordinateUtils.getChunkKey( + chunkX >> sectionShift, + chunkZ >> sectionShift @@ -6974,7 +6975,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + private void removeExpireCount(final int chunkX, final int chunkZ) { + final long chunkKey = CoordinateUtils.getChunkKey(chunkX, chunkZ); + -+ final int sectionShift = TickRegions.getRegionChunkShift(); ++ final int sectionShift = this.world.getRegionChunkShift(); + final RegionFileIOThread.ChunkCoordinate sectionKey = new RegionFileIOThread.ChunkCoordinate(CoordinateUtils.getChunkKey( + chunkX >> sectionShift, + chunkZ >> sectionShift @@ -7153,7 +7154,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + } + + final Long2ObjectOpenHashMap> sections = new Long2ObjectOpenHashMap(); -+ final int sectionShift = ChunkTaskScheduler.getChunkSystemLockShift(); ++ final int sectionShift = this.taskScheduler.getChunkSystemLockShift(); + for (final RegionFileIOThread.ChunkCoordinate coord : this.tickets.keySet()) { + sections.computeIfAbsent( + CoordinateUtils.getChunkKey( @@ -7187,7 +7188,7 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + } + + public void tick() { -+ final int sectionShift = TickRegions.getRegionChunkShift(); ++ final int sectionShift = this.world.getRegionChunkShift(); + + final Predicate> expireNow = (final Ticket ticket) -> { + if (ticket.removeDelay == NO_TIMEOUT_MARKER) { @@ -7881,9 +7882,9 @@ index 0000000000000000000000000000000000000000..8e52ebe8d12f5da3d877b0e4ff372322 + + final JsonArray unloadQueue = new JsonArray(); + ret.add("unload_queue", unloadQueue); -+ ret.addProperty("lock_shift", Integer.valueOf(ChunkTaskScheduler.getChunkSystemLockShift())); ++ ret.addProperty("lock_shift", Integer.valueOf(this.taskScheduler.getChunkSystemLockShift())); + ret.addProperty("ticket_shift", Integer.valueOf(ThreadedTicketLevelPropagator.SECTION_SHIFT)); -+ ret.addProperty("region_shift", Integer.valueOf(TickRegions.getRegionChunkShift())); ++ ret.addProperty("region_shift", Integer.valueOf(this.world.getRegionChunkShift())); + for (final ChunkQueue.SectionToUnload section : this.unloadQueue.retrieveForAllRegions()) { + final JsonObject sectionJson = new JsonObject(); + unloadQueue.add(sectionJson); @@ -8934,10 +8935,10 @@ index 0000000000000000000000000000000000000000..4cc1b3ba6d093a9683dbd8b7fe76106a +} diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java new file mode 100644 -index 0000000000000000000000000000000000000000..f975cb93716e137d973ff2f9011acdbef58859a2 +index 0000000000000000000000000000000000000000..17ce14f2dcbf900890efbc2351782bc6f8867068 --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java -@@ -0,0 +1,880 @@ +@@ -0,0 +1,883 @@ +package io.papermc.paper.chunk.system.scheduling; + +import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor; @@ -8946,6 +8947,7 @@ index 0000000000000000000000000000000000000000..f975cb93716e137d973ff2f9011acdbe +import ca.spottedleaf.concurrentutil.lock.ReentrantAreaLock; +import ca.spottedleaf.concurrentutil.util.ConcurrentUtil; +import com.mojang.logging.LogUtils; ++import io.papermc.paper.chunk.system.io.RegionFileIOThread; +import io.papermc.paper.chunk.system.scheduling.queue.RadiusAwarePrioritisedExecutor; +import io.papermc.paper.configuration.GlobalConfiguration; +import io.papermc.paper.util.CoordinateUtils; @@ -9035,7 +9037,7 @@ index 0000000000000000000000000000000000000000..f975cb93716e137d973ff2f9011acdbe + ChunkTaskScheduler.newChunkSystemGenParallelism = useParallelGen ? newChunkSystemWorkerThreads : 1; + ChunkTaskScheduler.newChunkSystemLoadParallelism = newChunkSystemWorkerThreads; + -+ io.papermc.paper.chunk.system.io.RegionFileIOThread.init(newChunkSystemIOThreads); ++ RegionFileIOThread.init(newChunkSystemIOThreads); + workerThreads = new ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadPool( + "Paper Chunk System Worker Pool", newChunkSystemWorkerThreads, + (final Thread thread, final Integer id) -> { @@ -9126,16 +9128,6 @@ index 0000000000000000000000000000000000000000..f975cb93716e137d973ff2f9011acdbe + } + } + -+ // must be >= region shift (in paper, doesn't exist) and must be >= ticket propagator section shift -+ // it must be >= region shift since the regioniser assumes ticket updates do not occur in parallel for the region sections -+ // it must be >= ticket propagator section shift so that the ticket propagator can assume that owning a position implies owning -+ // the entire section -+ // we just take the max, as we want the smallest shift that satifies these properties -+ private static final int LOCK_SHIFT = ThreadedTicketLevelPropagator.SECTION_SHIFT; -+ public static int getChunkSystemLockShift() { -+ return LOCK_SHIFT; -+ } -+ + private static final int[] ACCESS_RADIUS_TABLE = new int[ChunkStatus.getStatusList().size()]; + private static final int[] MAX_ACCESS_RADIUS_TABLE = new int[ACCESS_RADIUS_TABLE.length]; + static { @@ -9189,12 +9181,24 @@ index 0000000000000000000000000000000000000000..f975cb93716e137d973ff2f9011acdbe + return (status.ordinal() - 1) + getAccessRadius(ChunkStatus.FULL); + } + -+ final ReentrantAreaLock schedulingLockArea = new ReentrantAreaLock(getChunkSystemLockShift()); ++ final ReentrantAreaLock schedulingLockArea; ++ private final int lockShift; ++ ++ public final int getChunkSystemLockShift() { ++ return this.lockShift; ++ } + // Folia end - use area based lock to reduce contention + + public ChunkTaskScheduler(final ServerLevel world, final PrioritisedThreadPool workers) { + this.world = world; + this.workers = workers; ++ // must be >= region shift (in paper, doesn't exist) and must be >= ticket propagator section shift ++ // it must be >= region shift since the regioniser assumes ticket updates do not occur in parallel for the region sections ++ // it must be >= ticket propagator section shift so that the ticket propagator can assume that owning a position implies owning ++ // the entire section ++ // we just take the max, as we want the smallest shift that satisfies these properties ++ this.lockShift = Math.max(world.getRegionChunkShift(), ThreadedTicketLevelPropagator.SECTION_SHIFT); ++ this.schedulingLockArea = new ReentrantAreaLock(this.getChunkSystemLockShift()); + + final String worldName = world.getWorld().getName(); + this.parallelGenExecutor = workers.createExecutor("Chunk parallel generation executor for world '" + worldName + "'", Math.max(1, newChunkSystemGenParallelism)); @@ -19534,7 +19538,7 @@ index 5cd680d2ed47aadb5e65a775d70bc662a92e3d7a..1ad6b62ee53e2ee4a710211dfc750780 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29db076b86 100644 +index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0ff6e1f3f24b4086ce62faecf400c493f31fc964 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -196,7 +196,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -19639,7 +19643,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 chunkProvider.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); chunkProvider.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, holderIdentifier); -@@ -317,12 +332,223 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -317,12 +332,228 @@ public class ServerLevel extends Level implements WorldGenLevel { for (int cx = minChunkX; cx <= maxChunkX; ++cx) { for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) { io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad( @@ -19741,9 +19745,8 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 ); } + super.write(pos, nbt); - } - } -- // Paper end ++ } ++ } + + private void writeEntityChunk(int chunkX, int chunkZ, net.minecraft.nbt.CompoundTag compound) throws IOException { + if (!io.papermc.paper.chunk.system.io.RegionFileIOThread.isRegionFileThread()) { @@ -19786,7 +19789,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 + @Override + public ChunkAccess syncLoadNonFull(int chunkX, int chunkZ, net.minecraft.world.level.chunk.ChunkStatus status) { + if (status == null || status.isOrAfter(net.minecraft.world.level.chunk.ChunkStatus.FULL)) { -+ throw new IllegalArgumentException("Status: " + status.toString()); ++ throw new IllegalArgumentException("Status: " + status); + } + ChunkAccess loaded = this.getIfAboveStatus(chunkX, chunkZ, status); + if (loaded != null) { @@ -19819,6 +19822,11 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 + + return loaded; + } ++ ++ public final int getRegionChunkShift() { ++ // placeholder for folia ++ return io.papermc.paper.threadedregions.TickRegions.getRegionChunkShift(); ++ } + // Paper end - rewrite chunk system + + public final io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader playerChunkLoader = new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader(this); @@ -19833,8 +19841,9 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 + if (this.viewDistances.compareAndSet(curr, update.apply(curr))) { + return; + } -+ } -+ } + } + } +- // Paper end + + public void setTickViewDistance(final int distance) { + if ((distance < io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.MIN_VIEW_DISTANCE || distance > io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.MAX_VIEW_DISTANCE)) { @@ -19865,7 +19874,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { -@@ -366,16 +592,16 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -366,16 +597,16 @@ public class ServerLevel extends Level implements WorldGenLevel { // CraftBukkit end boolean flag2 = minecraftserver.forceSynchronousWrites(); DataFixer datafixer = minecraftserver.getFixerUpper(); @@ -19887,7 +19896,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 return minecraftserver.overworld().getDataStorage(); }); this.chunkSource.getGeneratorState().ensureStructuresGenerated(); -@@ -404,6 +630,9 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -404,6 +635,9 @@ public class ServerLevel extends Level implements WorldGenLevel { return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences"); }); this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit @@ -19897,7 +19906,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } /** @deprecated */ -@@ -529,7 +758,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -529,7 +763,7 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.push("checkDespawn"); entity.checkDespawn(); gameprofilerfiller.pop(); @@ -19906,7 +19915,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 Entity entity1 = entity.getVehicle(); if (entity1 != null) { -@@ -554,13 +783,16 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -554,13 +788,16 @@ public class ServerLevel extends Level implements WorldGenLevel { } gameprofilerfiller.push("entityManagement"); @@ -19925,7 +19934,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } protected void tickTime() { -@@ -1029,6 +1261,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1029,6 +1266,11 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) { @@ -19937,7 +19946,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 ServerChunkCache chunkproviderserver = this.getChunkSource(); if (!savingDisabled) { -@@ -1044,16 +1281,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1044,16 +1286,13 @@ public class ServerLevel extends Level implements WorldGenLevel { } timings.worldSaveChunks.startTiming(); // Paper @@ -19958,7 +19967,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 // CraftBukkit start - moved from MinecraftServer.saveChunks ServerLevel worldserver1 = this; -@@ -1189,7 +1423,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1189,7 +1428,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED); } @@ -19967,7 +19976,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } // CraftBukkit start -@@ -1205,7 +1439,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1205,7 +1444,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } // CraftBukkit end @@ -19976,7 +19985,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } } -@@ -1217,10 +1451,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1217,10 +1456,10 @@ public class ServerLevel extends Level implements WorldGenLevel { public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { // CraftBukkit end Stream stream = entity.getSelfAndPassengers().map(Entity::getUUID); // CraftBukkit - decompile error @@ -19990,7 +19999,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 return false; } else { this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit -@@ -1746,7 +1980,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1746,7 +1985,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -19999,7 +20008,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); -@@ -1795,7 +2029,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1795,7 +2034,7 @@ public class ServerLevel extends Level implements WorldGenLevel { BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1); try { @@ -20008,7 +20017,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } catch (Throwable throwable4) { if (bufferedwriter2 != null) { try { -@@ -1816,7 +2050,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1816,7 +2055,7 @@ public class ServerLevel extends Level implements WorldGenLevel { BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2); try { @@ -20017,7 +20026,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } catch (Throwable throwable6) { if (bufferedwriter3 != null) { try { -@@ -1958,7 +2192,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1958,7 +2197,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @VisibleForTesting public String getWatchdogStats() { @@ -20026,7 +20035,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats()); } -@@ -2018,15 +2252,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2018,15 +2257,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public LevelEntityGetter getEntities() { org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot @@ -20047,7 +20056,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } public void startTickingChunk(LevelChunk chunk) { -@@ -2042,34 +2276,49 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2042,34 +2281,49 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void close() throws IOException { super.close(); @@ -20104,7 +20113,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 } @Override -@@ -2090,7 +2339,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2090,7 +2344,7 @@ public class ServerLevel extends Level implements WorldGenLevel { CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); crashreportsystemdetails.setDetail("Loaded entity count", () -> { @@ -20114,7 +20123,7 @@ index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29 return crashreportsystemdetails; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d53c25ed96cfea839a5ad3531092d63478f6b869..48c1dd9015f9c9b9e4b8eb202a8f50d72c4e5929 100644 +index 61d4afb6b76fdffdda9f01af5005f005e21f4807..682388297375ea43515388bbdf9f7d2b949a7a62 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -265,6 +265,50 @@ public class ServerPlayer extends Player { @@ -20485,7 +20494,7 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..5de5209e04d631bd6a50e28e8d3abebf this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F); if (this.unacknowledgedBatches == 0) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7c1154cd5fcc1f4c86067bb633218de682ef7bef..5248aaee63e87a339c6debdfbe09707c6849d84b 100644 +index 38260251813a8fc5d1f5c1b2bbec9a112d00bafd..d22341dd864ac3423ec4ae1e3f4febefe24ae3f6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -696,6 +696,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0033-Entity-Origin-API.patch b/patches/server/0033-Entity-Origin-API.patch index 2be24f301f..134242c957 100644 --- a/patches/server/0033-Entity-Origin-API.patch +++ b/patches/server/0033-Entity-Origin-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0653b5abc89d0c5a54566e3e518cfd29db076b86..bc2111031f277dc27b8ae673259a10999df1ec43 100644 +index 0ff6e1f3f24b4086ce62faecf400c493f31fc964..7431b66079406a311a8e46ccabc8f3efa67f37e8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2399,6 +2399,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2404,6 +2404,15 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit @@ -132,7 +132,7 @@ index f08c021f867c00611139a17db48352944eb2aa99..5c3b86e2301079e775971aa4da6a8f2d @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index fa66a1c6c26f8952478edcf6d7d0598d64d9111c..acfe67911d052933bbf62e5c68181f4472b6e4c9 100644 +index e269812e6193492afc3f25612edafa1a58325fa3..49294a8d580d891f21d8d4cbae14ae477c01ff8d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -967,5 +967,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0042-Disable-thunder.patch b/patches/server/0042-Disable-thunder.patch index 7143a63d06..3c1ca12b7d 100644 --- a/patches/server/0042-Disable-thunder.patch +++ b/patches/server/0042-Disable-thunder.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable thunder diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 363f94a2fb54b7a55f392cc65a6e4d68f313fb07..6e70f759d7f38b16127c12e4a07f2d88fa4cfcaf 100644 +index 7431b66079406a311a8e46ccabc8f3efa67f37e8..93b67b8cf9f2e290ffedba0ae85a3949e483442e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -842,7 +842,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -847,7 +847,7 @@ public class ServerLevel extends Level implements WorldGenLevel { ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("thunder"); diff --git a/patches/server/0043-Disable-ice-and-snow.patch b/patches/server/0043-Disable-ice-and-snow.patch index dae4de0702..164770d59c 100644 --- a/patches/server/0043-Disable-ice-and-snow.patch +++ b/patches/server/0043-Disable-ice-and-snow.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable ice and snow diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6e70f759d7f38b16127c12e4a07f2d88fa4cfcaf..91683741c38cb9b9224c40a7637580bb4d15b075 100644 +index 93b67b8cf9f2e290ffedba0ae85a3949e483442e..287af97463b780649f91065959898d7ced86c150 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -872,11 +872,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -877,11 +877,13 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.popPush("iceandsnow"); diff --git a/patches/server/0075-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0075-Configurable-spawn-chances-for-skeleton-horses.patch index b8993ebffe..fba0df6afa 100644 --- a/patches/server/0075-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0075-Configurable-spawn-chances-for-skeleton-horses.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 88249c9a31e6dc1bb0912daebed80ede4d791d9f..30ae12f1d6abdaeaac070c54a22f0c869143745f 100644 +index 82e1ef7c041c620741e9b714d73ced1a9cc76a67..119b317c75c4a6c6c600f2402dc9b28f62deab03 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -847,7 +847,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -852,7 +852,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); diff --git a/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch index ff9af7572e..c683bb8473 100644 --- a/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9ac9f250d2f9b29ce520da93a9398113b2ff3e50..0523b0e70c10f7f02551be90cd02b6d8dabde673 100644 +index b854f430048f7e6531a9394fcb2e13ffc40f66bd..be98fe9934ec1b22c7b1c743bc137c805aea92e2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2411,6 +2411,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2416,6 +2416,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end @@ -16,7 +16,7 @@ index 9ac9f250d2f9b29ce520da93a9398113b2ff3e50..0523b0e70c10f7f02551be90cd02b6d8 } public void onTrackingEnd(Entity entity) { -@@ -2486,6 +2487,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2491,6 +2492,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } // CraftBukkit end diff --git a/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index db735a0ec7..b04392dd4b 100644 --- a/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 16abfc81d054cdc983500d3e498533ea8e8cc0be..6baf4caafbb4f7a09fe3a806bbff17c9f6105fbd 100644 +index be98fe9934ec1b22c7b1c743bc137c805aea92e2..de95a2e79894c1552b28c8c4f6aa36fc26929098 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1619,6 +1619,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1624,6 +1624,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void updateNeighborsAt(BlockPos pos, Block sourceBlock) { diff --git a/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 50da6bac6e..a5661b0c24 100644 --- a/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4d89f0c8ba1454aedb759c367009ec25931b66d5..cc3a34afddac429b1ce75e54fdb284d7683a4310 100644 +index de95a2e79894c1552b28c8c4f6aa36fc26929098..173ee629f92905e3905b4786905d976ed9e22978 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2432,6 +2432,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2437,6 +2437,7 @@ public class ServerLevel extends Level implements WorldGenLevel { { if ( iter.next().player == entity ) { diff --git a/patches/server/0102-Fix-global-sound-handling.patch b/patches/server/0102-Fix-global-sound-handling.patch index e85056eb58..860d760f9d 100644 --- a/patches/server/0102-Fix-global-sound-handling.patch +++ b/patches/server/0102-Fix-global-sound-handling.patch @@ -11,10 +11,10 @@ Co-authored-by: lexikiq Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cc3a34afddac429b1ce75e54fdb284d7683a4310..90340d70d0a43987dddcd4f627ace76139f07245 100644 +index 173ee629f92905e3905b4786905d976ed9e22978..5847f0ace5b7adb631f1f71f36b78807c8ab8509 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1553,7 +1553,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1558,7 +1558,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) { diff --git a/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch index 1fd6bf21f3..1b7d7ce46a 100644 --- a/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch @@ -16,10 +16,10 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cc3a34afddac429b1ce75e54fdb284d7683a4310..418f9ed95179a234a4f7df3ba5813e9642b5f44c 100644 +index 5847f0ace5b7adb631f1f71f36b78807c8ab8509..7c1e5806d7b5e7dbb53050de24f5f6e668fa90f4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2364,6 +2364,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2369,6 +2369,12 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); diff --git a/patches/server/0191-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/0191-Expand-World.spawnParticle-API-and-add-Builder.patch index 04bf7ca110..5cd6f9f899 100644 --- a/patches/server/0191-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/0191-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 418f9ed95179a234a4f7df3ba5813e9642b5f44c..4190c31fae199e6b6481d2b840f15fe68615d720 100644 +index 7c1e5806d7b5e7dbb53050de24f5f6e668fa90f4..29044088ea933e2ba2c7f98d7a59c880a8d774fb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1738,12 +1738,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1743,12 +1743,17 @@ public class ServerLevel extends Level implements WorldGenLevel { } public int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { diff --git a/patches/server/0213-InventoryCloseEvent-Reason-API.patch b/patches/server/0213-InventoryCloseEvent-Reason-API.patch index f1ee7a86d6..00ed17f9be 100644 --- a/patches/server/0213-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0213-InventoryCloseEvent-Reason-API.patch @@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 243cba71dabd245ef5c0e196dadf3425424255b0..6d7bc8e979e608db9fca1bb881b7767f9f9fd89b 100644 +index 29044088ea933e2ba2c7f98d7a59c880a8d774fb..c7de5cd2cca4580ef7ff59763eae3c8d6eef209c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1470,7 +1470,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1475,7 +1475,7 @@ public class ServerLevel extends Level implements WorldGenLevel { for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { if (tileentity instanceof net.minecraft.world.Container) { for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) { @@ -19,7 +19,7 @@ index 243cba71dabd245ef5c0e196dadf3425424255b0..6d7bc8e979e608db9fca1bb881b7767f } } } -@@ -2455,7 +2455,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2460,7 +2460,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { @@ -29,7 +29,7 @@ index 243cba71dabd245ef5c0e196dadf3425424255b0..6d7bc8e979e608db9fca1bb881b7767f } // 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 8f826978564a1d144901f1ca2e46c5b083b68945..0100aafc999cadcfa7a904a812355502379c418d 100644 +index 3014467f1c9159e04afd0bb816e02af6599f1f71..29f91654226ae349e310121c8fef20d9c1f6c183 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -692,7 +692,7 @@ public class ServerPlayer extends Player { @@ -186,7 +186,7 @@ index f929327522b98c12823ebbf94531c1c3681b1efa..701c8c8320f922c6227046d827559527 // Check if the fromWorld and toWorld are the same. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 42c4423979cb007f9e9270ee319d765f208dc61b..49b6b109eec1220b8d669adc435baf5636cba9cd 100644 +index 73963d1e17fa09f17913a2b9fdce0845949e3bec..fc9cf505f32b7cd5f7785314ce16d71c9236b640 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1331,7 +1331,7 @@ public class CraftEventFactory { diff --git a/patches/server/0233-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0233-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 2b77e88cd8..626622cb64 100644 --- a/patches/server/0233-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0233-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -29,7 +29,7 @@ index c9e3e104cd051a38e367653dc6c4f969665fc250..45ee0cd242271883412284625230822d protected void tick() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2e1cabfc3131f43feadf8ce61d0027c18d7c78e6..9d098a0836ea0b152eacd787ea7c43846f9122b2 100644 +index c7de5cd2cca4580ef7ff59763eae3c8d6eef209c..98de2c14e146f862adc37fde428cf6c46d98d790 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -223,6 +223,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -42,7 +42,7 @@ index 2e1cabfc3131f43feadf8ce61d0027c18d7c78e6..9d098a0836ea0b152eacd787ea7c4384 @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI return this.chunkSource.getChunk(x, z, false); -@@ -1432,7 +1435,28 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1437,7 +1440,28 @@ public class ServerLevel extends Level implements WorldGenLevel { // CraftBukkit start private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot @@ -85,7 +85,7 @@ index 17cae197f76e02491791c55554bd57592a30aa1d..7be66f8649d6f6cb67e3b42e8f4fe739 if (this.bukkitEntity == null) { this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index ee04acca6e7e9055fe42595efaa41a11c528121a..26e5abfe928abc09e0e0e4574550912778607cbf 100644 +index 7f7e28808aaf5b858415532d85c246999bc71ed0..b4f7e73fa673006ad0f8ea5a8de5a825aa75e41c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -153,6 +153,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0295-Entity-getEntitySpawnReason.patch b/patches/server/0295-Entity-getEntitySpawnReason.patch index d2b110d6ec..4c18450bb0 100644 --- a/patches/server/0295-Entity-getEntitySpawnReason.patch +++ b/patches/server/0295-Entity-getEntitySpawnReason.patch @@ -22,10 +22,10 @@ index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..a7c89cdf20cb63792c76de81c1ff9f2c }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9d098a0836ea0b152eacd787ea7c43846f9122b2..45a6277c93f6d6370442664a8777b08977df0a6b 100644 +index 98de2c14e146f862adc37fde428cf6c46d98d790..9b687c6a134641dab0e60fe58372899a7f2945f5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1450,6 +1450,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1455,6 +1455,7 @@ public class ServerLevel extends Level implements WorldGenLevel { return true; } // Paper end @@ -34,7 +34,7 @@ index 9d098a0836ea0b152eacd787ea7c43846f9122b2..45a6277c93f6d6370442664a8777b089 // Paper start if (DEBUG_ENTITIES) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 3d13d3a219d10cb12bcdfe31eff9b54136629492..f86dd0b58a13c7908961533c75e20ea73c0cb658 100644 +index 18dc5ef7892c24f4071c8c0621ac412a5d8767bd..c98e4469fa8940762c26a8d787bfabe4b2719fb5 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -223,6 +223,11 @@ public abstract class PlayerList { @@ -133,7 +133,7 @@ index faad948f089575e4988d989790cc1dd13f8a79cd..ee11a52e82091911aa3a196bcc1f7ab8 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 594eeb83425787e160f8051f15c7cdf61a7bb090..4d71849e8330e6f758e10223fabdb5d6ed0e7221 100644 +index 388c9db9d130071122e9f80749fb2eef05455408..3da7fbec0fb55fb590fc9ff4bd0f984a5cac9fba 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1018,5 +1018,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0308-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/patches/server/0308-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 7b2aa675bc..240ce7f9ae 100644 --- a/patches/server/0308-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/patches/server/0308-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -63,10 +63,10 @@ index af90bb579429336cc4e99386fd620c898c23d274..96fd66ed2742a79064852af6e936830d // this.updateMobSpawningFlags(); worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 45a6277c93f6d6370442664a8777b08977df0a6b..de4a35992002b962f680d3c43daf51f87f91fef0 100644 +index 9b687c6a134641dab0e60fe58372899a7f2945f5..1867dffd8bdfa1ffb070f90ca76b4c7c74de9352 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1893,12 +1893,84 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1898,12 +1898,84 @@ public class ServerLevel extends Level implements WorldGenLevel { return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap(); } @@ -191,7 +191,7 @@ index 4d2348df25410a0b5364eec066880326d6667dad..286aad3205ef8a9e21a47ef07893844f this.maxCount = i * i; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d72119d42dda1e7d73de24534dc4a39fecf90f3e..e53cd6a490b0cf6d72e24f73511f948bfd548893 100644 +index 5fc33643ad6c5ebd7ebb8ad57d5ef9df2fdba4bd..8bf52e9b92aecb7426e7ee6104166b7df84d5bcc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1407,15 +1407,21 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0327-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0327-Optimise-EntityGetter-getPlayerByUUID.patch index dd98a56be5..0b0e0e7770 100644 --- a/patches/server/0327-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0327-Optimise-EntityGetter-getPlayerByUUID.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID Use the PlayerList map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index de4a35992002b962f680d3c43daf51f87f91fef0..316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede 100644 +index 1867dffd8bdfa1ffb070f90ca76b4c7c74de9352..86f2d1c6298a08968febf1bfd5073ac386c0a998 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -554,6 +554,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -559,6 +559,15 @@ public class ServerLevel extends Level implements WorldGenLevel { }); } diff --git a/patches/server/0331-Entity-Activation-Range-2.0.patch b/patches/server/0331-Entity-Activation-Range-2.0.patch index 2c2297baeb..03b7e119f2 100644 --- a/patches/server/0331-Entity-Activation-Range-2.0.patch +++ b/patches/server/0331-Entity-Activation-Range-2.0.patch @@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal public net.minecraft.world.entity.LivingEntity jumping diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede..2a3d4a041345d5478916f4d2c5c3c382fca5758f 100644 +index 86f2d1c6298a08968febf1bfd5073ac386c0a998..e147ec8eeb69668da8eb52550c39623f700c2052 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -29,7 +29,7 @@ index 316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede..2a3d4a041345d5478916f4d2c5c3c382 import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.util.Pair; -@@ -1207,17 +1206,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1212,17 +1211,17 @@ public class ServerLevel extends Level implements WorldGenLevel { ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper @@ -51,7 +51,7 @@ index 316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede..2a3d4a041345d5478916f4d2c5c3c382 try { // Paper end - timings entity.setOldPosAndRot(); -@@ -1228,9 +1227,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1233,9 +1232,13 @@ public class ServerLevel extends Level implements WorldGenLevel { return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); @@ -65,7 +65,7 @@ index 316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede..2a3d4a041345d5478916f4d2c5c3c382 Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -1238,13 +1241,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1243,13 +1246,18 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -85,7 +85,7 @@ index 316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede..2a3d4a041345d5478916f4d2c5c3c382 passenger.setOldPosAndRot(); ++passenger.tickCount; ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1253,8 +1261,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1258,8 +1266,17 @@ public class ServerLevel extends Level implements WorldGenLevel { return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); @@ -103,7 +103,7 @@ index 316f6b2c111b4f8a5ae0fa4dcb9695fa5ec62ede..2a3d4a041345d5478916f4d2c5c3c382 gameprofilerfiller.pop(); Iterator iterator = passenger.getPassengers().iterator(); -@@ -1264,6 +1281,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1269,6 +1286,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(passenger, entity2); } @@ -348,7 +348,7 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6 + } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f300b637466b7e591a4d7e19dd7cfefa7f954e6a..2e5b01cc9c438a2bee7eb770e4c266425a9d287f 100644 +index f131fdd758c42da3be15b6cd6334c50c01ab407c..e4c0e0eb3ee268c82019fbebe11008373e8148a0 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -163,6 +163,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0337-Anti-Xray.patch b/patches/server/0337-Anti-Xray.patch index 0ec957804e..109ef46716 100644 --- a/patches/server/0337-Anti-Xray.patch +++ b/patches/server/0337-Anti-Xray.patch @@ -1104,10 +1104,10 @@ index be89e5b8c1ea7f85aef267a15986affa5fa1fd4b..43472855136f26b282d94fd241853d86 public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2a3d4a041345d5478916f4d2c5c3c382fca5758f..9c1b670a986f4507aab124225e7da68fef6e156c 100644 +index e147ec8eeb69668da8eb52550c39623f700c2052..2a6ac42a2b7388dcbd405fb00b05067b8b5a78cb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -568,7 +568,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -573,7 +573,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Holder holder = worlddimension.type(); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error @@ -1155,7 +1155,7 @@ index 5de5209e04d631bd6a50e28e8d3abebf148252c1..19b3f4fa7678a038bf25efc2a8b46dda DebugPackets.sendPoiPacketsForChunk(world, chunkPos); } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1aaf490303bb76524af771b1a6992be5f2791003..934a0de16e61de967d15b001bda45a97501dc658 100644 +index e4c0e0eb3ee268c82019fbebe11008373e8148a0..5d344f88e5e5ff73ae29833952fc2df80473ced6 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -178,6 +178,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1558,7 +1558,7 @@ index 545b14f02ac72dda30891d681eba585d19fd5e1d..6dc7e23e96aaffb912611a9dbd41459c private static final byte[] EMPTY_LIGHT = new byte[2048]; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 83242862a49e39c40dd8467f1d2a0ac74ced8343..64d827c7e7f9cf76f9db900333b987a626ab53cc 100644 +index 71ea77e3a487bf7adfb5d430c3df0035abdd4f1c..51d4f3cbcc803f35ea16c1633e41c70a1d366fbf 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2374,7 +2374,7 @@ public final class CraftServer implements Server { @@ -1571,7 +1571,7 @@ index 83242862a49e39c40dd8467f1d2a0ac74ced8343..64d827c7e7f9cf76f9db900333b987a6 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 12b78640b89a014af9e35ad03cb4cd217a29bc21..a834b763cf9190bf0effb02fe08b97861d5160cb 100644 +index 44ff199c5cd675cd795e89e0bee0d57f7dce958a..9e755de8e278f5dd20c9a2d8c8057c16ffe0e118 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -421,11 +421,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0341-Add-debug-for-sync-chunk-loads.patch b/patches/server/0341-Add-debug-for-sync-chunk-loads.patch index 62c144b4f3..a61d557719 100644 --- a/patches/server/0341-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0341-Add-debug-for-sync-chunk-loads.patch @@ -312,10 +312,10 @@ index 4039bd5a80bd2305082d21c0fe826f76d8beb4c4..974b4970be214ca36a801d39932abcc7 chunkproviderserver_b.managedBlock(completablefuture::isDone); io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9c1b670a986f4507aab124225e7da68fef6e156c..8b34c951a56832cb67f51235d3e94643dd1820c4 100644 +index 2a6ac42a2b7388dcbd405fb00b05067b8b5a78cb..6a2ced4ff900f07833400926333fee527fac1074 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -647,6 +647,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -652,6 +652,13 @@ public class ServerLevel extends Level implements WorldGenLevel { this.entityLookup = new io.papermc.paper.chunk.system.entity.EntityLookup(this, new EntityCallbacks()); // Paper - rewrite chunk system } diff --git a/patches/server/0359-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0359-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index f5b3749b9a..14d1ad78e9 100644 --- a/patches/server/0359-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0359-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -25,10 +25,10 @@ index 1f9efff4ddccf2569fdfe42e6cbc92792643d0ea..876200db872bce89976329c4d6c6fbe9 EntityType entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8b34c951a56832cb67f51235d3e94643dd1820c4..3bfab189f3c81b086712b85ab1d4dd3209a3f6b8 100644 +index 6a2ced4ff900f07833400926333fee527fac1074..1e54396f42737f18d6b3cef7d0c208ec03088b73 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2510,7 +2510,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2515,7 +2515,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTrackingStart(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -37,7 +37,7 @@ index 8b34c951a56832cb67f51235d3e94643dd1820c4..3bfab189f3c81b086712b85ab1d4dd32 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -2545,6 +2545,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2550,6 +2550,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit diff --git a/patches/server/0386-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0386-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index a505a250cc..023909195a 100644 --- a/patches/server/0386-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0386-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -557,7 +557,7 @@ index fe47a38137f7b7fa94c507e790eec4fb7303595f..7f5ecea0ee78a534d7c56fa9e3ad2117 paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3bfab189f3c81b086712b85ab1d4dd3209a3f6b8..c877aca6093435be9d349c07ea1b01d06bcbd416 100644 +index 1e54396f42737f18d6b3cef7d0c208ec03088b73..f734f6476c89bbed511d0b8209bd1cbdbd791998 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -223,7 +223,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -571,7 +571,7 @@ index 3bfab189f3c81b086712b85ab1d4dd3209a3f6b8..c877aca6093435be9d349c07ea1b01d0 } @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI -@@ -1488,7 +1490,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1493,7 +1495,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity.isRemoved()) { // Paper start if (DEBUG_ENTITIES) { diff --git a/patches/server/0418-incremental-chunk-and-player-saving.patch b/patches/server/0418-incremental-chunk-and-player-saving.patch index d0b5ef42ae..9ed020478a 100644 --- a/patches/server/0418-incremental-chunk-and-player-saving.patch +++ b/patches/server/0418-incremental-chunk-and-player-saving.patch @@ -76,10 +76,10 @@ index 974b4970be214ca36a801d39932abcc751e540a5..63fad53a9184d7ab97f143b7d85ae9ef public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c877aca6093435be9d349c07ea1b01d06bcbd416..17802108f41c98b77c89922451ee56b5ba2dcde2 100644 +index f734f6476c89bbed511d0b8209bd1cbdbd791998..9924f0ba2ac867748e49d738ac5bcef292cfc649 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1302,6 +1302,37 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1307,6 +1307,37 @@ public class ServerLevel extends Level implements WorldGenLevel { return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos); } @@ -118,7 +118,7 @@ index c877aca6093435be9d349c07ea1b01d06bcbd416..17802108f41c98b77c89922451ee56b5 // Paper start - rewrite chunk system - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 030d6c0d067dacf4f9603bdfb21acca8cafbeff0..14126f4f2f0c8d5ae06275fd735178a2c4d3efc0 100644 +index d43bf7ff39e9424f5cdcc93d29779570c8735869..fddbd703071ec93d6e3a9ecc1ff17b3e74eb8986 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -190,6 +190,7 @@ import org.bukkit.inventory.MainHand; @@ -130,7 +130,7 @@ index 030d6c0d067dacf4f9603bdfb21acca8cafbeff0..14126f4f2f0c8d5ae06275fd735178a2 private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a1a0177e4bce9623c606d6c0a40c6a3ce52afdb7..90c3146fae238e9c0300b97ca2eda48292b62213 100644 +index cb173f30bf5abd7c709d2186dd489e50c178b3cc..62888ec5766806016545e34758da20884626697a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -552,6 +552,7 @@ public abstract class PlayerList { diff --git a/patches/server/0441-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0441-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index db95a1991f..612ce91bb3 100644 --- a/patches/server/0441-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0441-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 17802108f41c98b77c89922451ee56b5ba2dcde2..0bd086f67f5d1f06f66499ae961c71e780a8290a 100644 +index 9924f0ba2ac867748e49d738ac5bcef292cfc649..4e37b64f608b9a4c6d421fc685680f7bd2269bb1 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2030,9 +2030,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2035,9 +2035,11 @@ public class ServerLevel extends Level implements WorldGenLevel { public void setDefaultSpawnPos(BlockPos pos, float angle) { // Paper - configurable spawn radius BlockPos prevSpawn = this.getSharedSpawnPos(); @@ -21,7 +21,7 @@ index 17802108f41c98b77c89922451ee56b5ba2dcde2..0bd086f67f5d1f06f66499ae961c71e7 // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8c36d0d130eba1ff16c500d8fde62b88430e90ef..5d8d2a9a4267477b6bf9d7209508a26abb0920fe 100644 +index 8efc044e5a38766aa29cb62db553a8390de50139..52628759695a441ff21f3077cfe9f75a6e999456 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -262,12 +262,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0458-Extend-block-drop-capture-to-capture-all-items-added.patch b/patches/server/0458-Extend-block-drop-capture-to-capture-all-items-added.patch index 4bb5817380..c417d51121 100644 --- a/patches/server/0458-Extend-block-drop-capture-to-capture-all-items-added.patch +++ b/patches/server/0458-Extend-block-drop-capture-to-capture-all-items-added.patch @@ -6,10 +6,10 @@ 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 0bd086f67f5d1f06f66499ae961c71e780a8290a..0fa23738e2a095f55960ebbcfe3198d4feff4b01 100644 +index 4e37b64f608b9a4c6d421fc685680f7bd2269bb1..6a05779c83a77e16bf53b6e2378e3cb08851ed5d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1528,6 +1528,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1533,6 +1533,12 @@ public class ServerLevel extends Level implements WorldGenLevel { // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; } else { diff --git a/patches/server/0521-Remove-stale-POIs.patch b/patches/server/0521-Remove-stale-POIs.patch index bea67cb132..772b6b12c0 100644 --- a/patches/server/0521-Remove-stale-POIs.patch +++ b/patches/server/0521-Remove-stale-POIs.patch @@ -5,10 +5,10 @@ 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 0fa23738e2a095f55960ebbcfe3198d4feff4b01..7b97230bfffd6cac128330cdfe451a62f0427a11 100644 +index 6a05779c83a77e16bf53b6e2378e3cb08851ed5d..f1d441758874f76ecde4275bdc721cb927754542 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2099,6 +2099,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2104,6 +2104,11 @@ public class ServerLevel extends Level implements WorldGenLevel { }); optional1.ifPresent((holder) -> { this.getServer().execute(() -> { diff --git a/patches/server/0539-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0539-added-option-to-disable-pathfinding-updates-on-block.patch index 1b96c337d6..07cad2cd08 100644 --- a/patches/server/0539-added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/0539-added-option-to-disable-pathfinding-updates-on-block.patch @@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e411fe6e0e1495c417bb8938bf6bd42b7ac63f18..bbb2f5370474111e357fb43d800fcbb24a51e82c 100644 +index 18aabf214ab5ffef94c71dfe1a7f1ee361a020ec..cea93f8edc6c7b03da421663fe3d9933040e3439 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1673,6 +1673,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1678,6 +1678,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } this.getChunkSource().blockChanged(pos); @@ -16,7 +16,7 @@ index e411fe6e0e1495c417bb8938bf6bd42b7ac63f18..bbb2f5370474111e357fb43d800fcbb2 VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); -@@ -1714,6 +1715,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1719,6 +1720,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } diff --git a/patches/server/0599-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0599-Add-cause-to-Weather-ThunderChangeEvents.patch index 8547a1f008..6445926bdd 100644 --- a/patches/server/0599-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0599-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index bbb2f5370474111e357fb43d800fcbb24a51e82c..08fee3d75a9f7ae950698a6ca8f18917ab0e3b21 100644 +index cea93f8edc6c7b03da421663fe3d9933040e3439..a53edd823643d53e45e5376a6a5300804430e7c2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -668,8 +668,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -673,8 +673,8 @@ public class ServerLevel extends Level implements WorldGenLevel { this.serverLevelData.setClearWeatherTime(clearDuration); this.serverLevelData.setRainTime(rainDuration); this.serverLevelData.setThunderTime(rainDuration); @@ -19,7 +19,7 @@ index bbb2f5370474111e357fb43d800fcbb24a51e82c..08fee3d75a9f7ae950698a6ca8f18917 } @Override -@@ -1105,8 +1105,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1110,8 +1110,8 @@ public class ServerLevel extends Level implements WorldGenLevel { this.serverLevelData.setThunderTime(j); this.serverLevelData.setRainTime(k); this.serverLevelData.setClearWeatherTime(i); @@ -30,7 +30,7 @@ index bbb2f5370474111e357fb43d800fcbb24a51e82c..08fee3d75a9f7ae950698a6ca8f18917 } this.oThunderLevel = this.thunderLevel; -@@ -1173,14 +1173,14 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1178,14 +1178,14 @@ public class ServerLevel extends Level implements WorldGenLevel { @VisibleForTesting public void resetWeatherCycle() { // CraftBukkit start @@ -95,7 +95,7 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..47266d2b86e7f2022de7ea0c9347b4f5 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 52baae96454715658505eba2cf9472aa71c9a1eb..e975c92d5ba2928ba0186d0253deedfa4ec9bb2c 100644 +index 6ab03cc55658789baedf5374ebb9c0a6c0187826..7612ceb9ac9dedeaaade51ba4cac3f35c010da4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1243,7 +1243,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0651-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/server/0651-Add-methods-to-find-targets-for-lightning-strikes.patch index f3db9c89d3..ce199539cd 100644 --- a/patches/server/0651-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/server/0651-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Add methods to find targets for lightning strikes public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 107e2b2a159838301e173323df1747954a52b104..31d6fa97fcd1572fd291870082309469987676c6 100644 +index b87def2d484f014a4c20bdd75cd48611e08f0426..76c8e4083bc89c78725dde0984efdf959c4b5e92 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -994,6 +994,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -999,6 +999,11 @@ public class ServerLevel extends Level implements WorldGenLevel { } protected BlockPos findLightningTargetAround(BlockPos pos) { @@ -22,7 +22,7 @@ index 107e2b2a159838301e173323df1747954a52b104..31d6fa97fcd1572fd291870082309469 BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); Optional optional = this.findLightningRod(blockposition1); -@@ -1008,6 +1013,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1013,6 +1018,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!list.isEmpty()) { return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition(); } else { @@ -31,7 +31,7 @@ index 107e2b2a159838301e173323df1747954a52b104..31d6fa97fcd1572fd291870082309469 blockposition1 = blockposition1.above(2); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 6c91471b5459ca45b532934d25c682ddc5b00042..e58fa390ec085d63a240efc5167289f21bb3cc54 100644 +index 144d49ddf5b4daf9d36ba84a25b130c1491fcc02..392714a19fc977678a7a7041d48ff553934ecf51 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -701,6 +701,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0663-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0663-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index fec409617e..3cd563ecba 100644 --- a/patches/server/0663-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0663-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -9,10 +9,10 @@ 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 00d37fc84d460cc5f2b897f66314d4e9ee2c9dd0..60563da7a11c394c5135c6cc630dabe871d48a05 100644 +index 76c8e4083bc89c78725dde0984efdf959c4b5e92..a885b90a44066103133af953d56bb3dbb9b899be 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1574,9 +1574,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1579,9 +1579,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) { @@ -28,7 +28,7 @@ index 00d37fc84d460cc5f2b897f66314d4e9ee2c9dd0..60563da7a11c394c5135c6cc630dabe8 } // 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 b7cdc097e77cb133442191af6e46324a4d0310da..7337d1e7e988889e9604433e8891750d8f172527 100644 +index 9f7c149d3ad1175d55ec02e295ee43bc571c3280..87fdc78409fb16c961c04a5551980a8a231b70d0 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1630,6 +1630,18 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0678-Execute-chunk-tasks-mid-tick.patch b/patches/server/0678-Execute-chunk-tasks-mid-tick.patch index 10dee7b12a..d42293ceec 100644 --- a/patches/server/0678-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0678-Execute-chunk-tasks-mid-tick.patch @@ -123,7 +123,7 @@ index 63fad53a9184d7ab97f143b7d85ae9ef2ca9f8bc..1483007b79e18107e41037c279e048f0 } } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e2b22b51a8c6d668eaa6572de16bb7a76351d0d3..716420eb3dea5a9b6d8e72d0bdf388dc37677032 100644 +index a885b90a44066103133af953d56bb3dbb9b899be..2c759854ed9f78c48c4e9ed2dc72e5a5693bd712 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -217,6 +217,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -134,7 +134,7 @@ index e2b22b51a8c6d668eaa6572de16bb7a76351d0d3..716420eb3dea5a9b6d8e72d0bdf388dc // CraftBukkit start public final LevelStorageSource.LevelStorageAccess convertable; -@@ -1206,6 +1207,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1211,6 +1212,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (fluid1.is(fluid)) { fluid1.tick(this, pos); } @@ -142,7 +142,7 @@ index e2b22b51a8c6d668eaa6572de16bb7a76351d0d3..716420eb3dea5a9b6d8e72d0bdf388dc } -@@ -1215,6 +1217,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1220,6 +1222,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (iblockdata.is(block)) { iblockdata.tick(this, pos, this.random); } @@ -151,7 +151,7 @@ index e2b22b51a8c6d668eaa6572de16bb7a76351d0d3..716420eb3dea5a9b6d8e72d0bdf388dc } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 18e26a5fd8843618710403b3fa4818287e90376c..705f31f54bf7d24aa57700044b65845da532d4eb 100644 +index e939b572c4e9bb316b342cdadf116942f04f53b2..17b7f100979042ef33e18ab930a0935e4cfaa674 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -923,6 +923,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0681-Optimise-random-block-ticking.patch b/patches/server/0681-Optimise-random-block-ticking.patch index 4675516661..695231a1d6 100644 --- a/patches/server/0681-Optimise-random-block-ticking.patch +++ b/patches/server/0681-Optimise-random-block-ticking.patch @@ -90,10 +90,10 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 716420eb3dea5a9b6d8e72d0bdf388dc37677032..cd331e0c9b46187d3ee5012f18b27bd60fbccc16 100644 +index 2c759854ed9f78c48c4e9ed2dc72e5a5693bd712..5e5b840301bf7021ce2776f49732f608330894eb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -856,6 +856,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -861,6 +861,10 @@ public class ServerLevel extends Level implements WorldGenLevel { entityplayer.stopSleepInBed(false, false); }); } @@ -104,7 +104,7 @@ index 716420eb3dea5a9b6d8e72d0bdf388dc37677032..cd331e0c9b46187d3ee5012f18b27bd6 public void tickChunk(LevelChunk chunk, int randomTickSpeed) { ChunkPos chunkcoordintpair = chunk.getPos(); -@@ -865,8 +869,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -870,8 +874,10 @@ public class ServerLevel extends Level implements WorldGenLevel { ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("thunder"); @@ -116,7 +116,7 @@ index 716420eb3dea5a9b6d8e72d0bdf388dc37677032..cd331e0c9b46187d3ee5012f18b27bd6 if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); -@@ -898,7 +904,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -903,7 +909,10 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!this.paperConfig().environment.disableIceAndSnow) { // Paper for (int l = 0; l < randomTickSpeed; ++l) { if (this.random.nextInt(48) == 0) { @@ -128,7 +128,7 @@ index 716420eb3dea5a9b6d8e72d0bdf388dc37677032..cd331e0c9b46187d3ee5012f18b27bd6 } } } // Paper -@@ -906,36 +915,37 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -911,36 +920,37 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.popPush("tickBlocks"); timings.chunkTicksBlocks.startTiming(); // Paper if (randomTickSpeed > 0) { @@ -190,7 +190,7 @@ index 716420eb3dea5a9b6d8e72d0bdf388dc37677032..cd331e0c9b46187d3ee5012f18b27bd6 timings.chunkTicksBlocks.stopTiming(); // Paper gameprofilerfiller.pop(); -@@ -943,17 +953,25 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -948,17 +958,25 @@ public class ServerLevel extends Level implements WorldGenLevel { @VisibleForTesting public void tickPrecipitation(BlockPos pos) { @@ -220,7 +220,7 @@ index 716420eb3dea5a9b6d8e72d0bdf388dc37677032..cd331e0c9b46187d3ee5012f18b27bd6 if (i > 0 && biomebase.shouldSnow(this, blockposition1)) { BlockState iblockdata = this.getBlockState(blockposition1); -@@ -971,12 +989,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -976,12 +994,13 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -324,7 +324,7 @@ index 722e323d2ae3f4ac8aa3197fed79f7d926d5ccfa..f8c1dfc8e121a406955348a1ec00c264 public BlockPos getHomePos() { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 705f31f54bf7d24aa57700044b65845da532d4eb..0bf3bfd0a44fe7219e6ed451eb85c25e87a31aac 100644 +index 17b7f100979042ef33e18ab930a0935e4cfaa674..c438c75b8edfbb8d728b01a96882e6cd802a3bea 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -1394,10 +1394,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0684-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0684-Detail-more-information-in-watchdog-dumps.patch index f97eec2cad..728dfc6dbb 100644 --- a/patches/server/0684-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/0684-Detail-more-information-in-watchdog-dumps.patch @@ -76,10 +76,10 @@ index 7de24c39b460e43d27839b3821e67213508ece81..7297bca9224c12d7ace0e1967340d994 }); throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cd331e0c9b46187d3ee5012f18b27bd60fbccc16..424d6fee9f5663371082fce4e23b6dc9282a591f 100644 +index 5e5b840301bf7021ce2776f49732f608330894eb..681faafdeb4b7d7d8b2078fbc0fc6067838ab1c9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1240,7 +1240,26 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1245,7 +1245,26 @@ public class ServerLevel extends Level implements WorldGenLevel { } @@ -106,7 +106,7 @@ index cd331e0c9b46187d3ee5012f18b27bd60fbccc16..424d6fee9f5663371082fce4e23b6dc9 ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper -@@ -1280,7 +1299,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1285,7 +1304,13 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } // } finally { timer.stopTiming(); } // Paper - timings - move up diff --git a/patches/server/0687-Distance-manager-tick-timings.patch b/patches/server/0687-Distance-manager-tick-timings.patch index 731b2b5f86..f946d92596 100644 --- a/patches/server/0687-Distance-manager-tick-timings.patch +++ b/patches/server/0687-Distance-manager-tick-timings.patch @@ -19,10 +19,10 @@ index 46449728f69ee7d4f78470f8da23c055acd53a3b..4b467f1af93452d13829f756d55dee18 public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks"); diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java -index 8e52ebe8d12f5da3d877b0e4ff3723229fb47db1..abd0217cf0bff183c8e262edc173a53403797c1a 100644 +index 5b446e6ac151f99f64f0c442d0b40b5e251bc4c4..6bc7c6f16a1649fc9e24e7cf90fca401e5bd4875 100644 --- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java -@@ -1315,7 +1315,9 @@ public final class ChunkHolderManager { +@@ -1316,7 +1316,9 @@ public final class ChunkHolderManager { } public boolean processTicketUpdates() { diff --git a/patches/server/0688-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0688-Fix-merchant-inventory-not-closing-on-entity-removal.patch index 0542a5f892..87a5c3bc96 100644 --- a/patches/server/0688-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0688-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 424d6fee9f5663371082fce4e23b6dc9282a591f..9d17813757f968624231b53aa1f895f5d25ab5d8 100644 +index 681faafdeb4b7d7d8b2078fbc0fc6067838ab1c9..0d18158174966245b679954f5a9268c6aac4be32 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2692,6 +2692,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2697,6 +2697,11 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot end // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message diff --git a/patches/server/0796-Don-t-tick-markers.patch b/patches/server/0796-Don-t-tick-markers.patch index fa030b09e2..b8d498005c 100644 --- a/patches/server/0796-Don-t-tick-markers.patch +++ b/patches/server/0796-Don-t-tick-markers.patch @@ -23,10 +23,10 @@ index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..5f43aedc6596e2b1ac7af97115157147 } }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9d17813757f968624231b53aa1f895f5d25ab5d8..a96aa3568453aa2da8b5cd5b269fc0b3fec13938 100644 +index 0d18158174966245b679954f5a9268c6aac4be32..9e0fb3a13cd4ae0142e3e63995b7eac61e48eea6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2601,6 +2601,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2606,6 +2606,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void onTickingStart(Entity entity) { diff --git a/patches/server/0806-Add-Alternate-Current-redstone-implementation.patch b/patches/server/0806-Add-Alternate-Current-redstone-implementation.patch index 28ad7aaa29..51458c3c44 100644 --- a/patches/server/0806-Add-Alternate-Current-redstone-implementation.patch +++ b/patches/server/0806-Add-Alternate-Current-redstone-implementation.patch @@ -2008,7 +2008,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index afe430860c150db8fc4597f906f201a5eac95369..1cdba4369c5177ec9f449de05cb97ee4aac84ec6 100644 +index 9e0fb3a13cd4ae0142e3e63995b7eac61e48eea6..8587f35706daf5a317035d0f7acee0b350984aab 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -224,6 +224,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2019,7 +2019,7 @@ index afe430860c150db8fc4597f906f201a5eac95369..1cdba4369c5177ec9f449de05cb97ee4 public static Throwable getAddToWorldStackTrace(Entity entity) { final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr); -@@ -2590,6 +2591,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2595,6 +2596,13 @@ public class ServerLevel extends Level implements WorldGenLevel { return crashreportsystemdetails; } diff --git a/patches/server/0813-Prevent-empty-items-from-being-added-to-world.patch b/patches/server/0813-Prevent-empty-items-from-being-added-to-world.patch index 6ac2045202..fba041d2f5 100644 --- a/patches/server/0813-Prevent-empty-items-from-being-added-to-world.patch +++ b/patches/server/0813-Prevent-empty-items-from-being-added-to-world.patch @@ -7,10 +7,10 @@ The previous solution caused a bunch of bandaid fixes inorder to resolve edge ca Just simply prevent them from being added to the world instead. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4cf7e66dfee34a29894f53d17e7e13c46fb4b85e..62b2efd9cf00ec79fb937099dd9cbfe9fc58d198 100644 +index 8587f35706daf5a317035d0f7acee0b350984aab..289b482e1e3e5824c4deadee89e39b2617f5068e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1583,6 +1583,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1588,6 +1588,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; } else { diff --git a/patches/server/0845-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0845-Fix-a-bunch-of-vanilla-bugs.patch index 9a2ac5e886..92764e14ad 100644 --- a/patches/server/0845-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0845-Fix-a-bunch-of-vanilla-bugs.patch @@ -124,10 +124,10 @@ index a0603e567deeede8b4cd2ba57ded44f29239d78d..982750fd4f3f474514194df9b7638831 return this.anyPlayerCloseEnoughForSpawning(pos, false); } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 62b2efd9cf00ec79fb937099dd9cbfe9fc58d198..66eecf5155f8f526480511d2b3af1b6f87280474 100644 +index 289b482e1e3e5824c4deadee89e39b2617f5068e..6e246868a395eb872d3e2680753c4584c98fdd15 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1028,7 +1028,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1033,7 +1033,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } else { AABB axisalignedbb = AABB.encapsulatingFullBlocks(blockposition1, new BlockPos(blockposition1.atY(this.getMaxBuildHeight()))).inflate(3.0D); List list = this.getEntitiesOfClass(LivingEntity.class, axisalignedbb, (entityliving) -> { @@ -137,7 +137,7 @@ index 62b2efd9cf00ec79fb937099dd9cbfe9fc58d198..66eecf5155f8f526480511d2b3af1b6f if (!list.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index cd0fc31064ae5ec9a9422a7596372d94a6904186..9327f230d80046ec6a33475c2f9fb3823f887c58 100644 +index 08acf8c6e6c624016ca97eef15da29d338433411..e6b6dcdb08e71fbcb27757413816c1329510eadc 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -468,14 +468,14 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0846-Remove-unnecessary-onTrackingStart-during-navigation.patch b/patches/server/0846-Remove-unnecessary-onTrackingStart-during-navigation.patch index 9a13680600..f75417df4e 100644 --- a/patches/server/0846-Remove-unnecessary-onTrackingStart-during-navigation.patch +++ b/patches/server/0846-Remove-unnecessary-onTrackingStart-during-navigation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 66eecf5155f8f526480511d2b3af1b6f87280474..22dd14b715f91c7771411a5375cf470fc2c940d5 100644 +index 6e246868a395eb872d3e2680753c4584c98fdd15..88deea3a8b90148b014730d9186526725b5991bb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2637,7 +2637,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2642,7 +2642,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; @@ -17,7 +17,7 @@ index 66eecf5155f8f526480511d2b3af1b6f87280474..22dd14b715f91c7771411a5375cf470f String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); -@@ -2723,7 +2723,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2728,7 +2728,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; diff --git a/patches/server/0871-check-global-player-list-where-appropriate.patch b/patches/server/0871-check-global-player-list-where-appropriate.patch index 321a591aa5..1359c3bbb7 100644 --- a/patches/server/0871-check-global-player-list-where-appropriate.patch +++ b/patches/server/0871-check-global-player-list-where-appropriate.patch @@ -7,10 +7,10 @@ Makes certain entities check all players when searching for a player instead of just checking players in their world. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 22dd14b715f91c7771411a5375cf470fc2c940d5..c04ba20ba3f07e96fba1697f17e36c47aae5fabf 100644 +index 88deea3a8b90148b014730d9186526725b5991bb..412ce6611f88c10fb374fdbae9748cceae689308 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2760,4 +2760,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2765,4 +2765,12 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::move); } } diff --git a/patches/server/0919-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch b/patches/server/0919-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch index fcb9da83f3..a2ab5008f0 100644 --- a/patches/server/0919-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch +++ b/patches/server/0919-Prevent-GameEvents-being-fired-from-unloaded-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent GameEvents being fired from unloaded chunks diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c04ba20ba3f07e96fba1697f17e36c47aae5fabf..2ca2b6c45fa05fde11c36d31a4c1cdeae9c08786 100644 +index 412ce6611f88c10fb374fdbae9748cceae689308..c17d8e00cd43f2f969c81be2ee65fab2b8578eae 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1720,6 +1720,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1725,6 +1725,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void gameEvent(GameEvent event, Vec3 emitterPos, GameEvent.Context emitter) { diff --git a/patches/server/1013-Lag-compensation-ticks.patch b/patches/server/1013-Lag-compensation-ticks.patch index 43d7f9cd21..196ed51498 100644 --- a/patches/server/1013-Lag-compensation-ticks.patch +++ b/patches/server/1013-Lag-compensation-ticks.patch @@ -30,10 +30,10 @@ index a8f9f4e23575cb58045f9d8efe011a60a51dbd7a..34f19ac897a30c0c4e3ab406013fcca1 net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2ca2b6c45fa05fde11c36d31a4c1cdeae9c08786..dac0771836a1c26aa10a2609bb77d7fc68bb9423 100644 +index c17d8e00cd43f2f969c81be2ee65fab2b8578eae..15dc5af10041f71b5d377353302fb09a34bcda82 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -566,6 +566,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -571,6 +571,17 @@ public class ServerLevel extends Level implements WorldGenLevel { return player != null && player.level() == this ? player : null; } // Paper end diff --git a/patches/server/1017-Optimise-nearby-player-retrieval.patch b/patches/server/1017-Optimise-nearby-player-retrieval.patch index 728c9ea672..61b46e2944 100644 --- a/patches/server/1017-Optimise-nearby-player-retrieval.patch +++ b/patches/server/1017-Optimise-nearby-player-retrieval.patch @@ -8,10 +8,10 @@ we can instead use the nearby player tracking system to reduce the number of tests per search. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index dac0771836a1c26aa10a2609bb77d7fc68bb9423..8f85aafb181cadd2983b0f3735782729858226c6 100644 +index 15dc5af10041f71b5d377353302fb09a34bcda82..1d44387ea8665f7bbf3da04a1dd882f586ff37ac 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -577,6 +577,115 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -582,6 +582,115 @@ public class ServerLevel extends Level implements WorldGenLevel { this.lagCompensationTick = (System.nanoTime() - net.minecraft.server.MinecraftServer.SERVER_INIT) / (java.util.concurrent.TimeUnit.MILLISECONDS.toNanos(50L)); } // Paper end - lag compensation diff --git a/patches/server/1019-Fix-missing-map-initialize-event-call.patch b/patches/server/1019-Fix-missing-map-initialize-event-call.patch index cb7ba8687a..e009d02fb1 100644 --- a/patches/server/1019-Fix-missing-map-initialize-event-call.patch +++ b/patches/server/1019-Fix-missing-map-initialize-event-call.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Fix missing map initialize event call public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8f85aafb181cadd2983b0f3735782729858226c6..b78a9628a88f2a495ef6de74446a02a14d41a1f6 100644 +index 1d44387ea8665f7bbf3da04a1dd882f586ff37ac..676087c3addd712939c865b39ddb5d9f0bc7ce25 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2129,13 +2129,25 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2134,13 +2134,25 @@ public class ServerLevel extends Level implements WorldGenLevel { @Nullable @Override public MapItemSavedData getMapData(String id) {