aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2024-07-30 19:50:14 -0700
committerSpottedleaf <[email protected]>2024-07-30 19:50:14 -0700
commit0a1be9ae87416ffca38cf20412e248c78a9d6a3c (patch)
tree5fb05b325f238764f4d0e4e19c30080f3dc94518
parent58c7ea3193c5c192fb09b0197b86f0ff5dbe2dfd (diff)
downloadPaper-0a1be9ae87416ffca38cf20412e248c78a9d6a3c.tar.gz
Paper-0a1be9ae87416ffca38cf20412e248c78a9d6a3c.zip
Make loadChunksForMoveAsync use new chunk system load calls
This is to allow the call to work properly when on Folia, as Folia does not have a main thread.
-rw-r--r--patches/server/0988-Moonrise-optimisation-patches.patch149
-rw-r--r--patches/server/0990-disable-forced-empty-world-ticks.patch4
-rw-r--r--patches/server/0992-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch4
-rw-r--r--patches/server/0997-Entity-Activation-Range-2.0.patch12
-rw-r--r--patches/server/0999-Anti-Xray.patch6
-rw-r--r--patches/server/1001-Add-Alternate-Current-redstone-implementation.patch6
-rw-r--r--patches/server/1034-Lag-compensation-ticks.patch4
-rw-r--r--patches/server/1035-Detail-more-information-in-watchdog-dumps.patch6
-rw-r--r--patches/server/1036-Write-SavedData-IO-async.patch8
-rw-r--r--patches/server/1039-Incremental-chunk-and-player-saving.patch4
10 files changed, 128 insertions, 75 deletions
diff --git a/patches/server/0988-Moonrise-optimisation-patches.patch b/patches/server/0988-Moonrise-optimisation-patches.patch
index 4ac5b7f523..8e70453dec 100644
--- a/patches/server/0988-Moonrise-optimisation-patches.patch
+++ b/patches/server/0988-Moonrise-optimisation-patches.patch
@@ -25574,7 +25574,7 @@ index 1d849ce4e2c85f149af25318b8ffb6dcef6c6788..12d86f27d04bffed8c3844e36b42fbc2
if (!list.equals(this.lastPassengers)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341a54477f2 100644
+index c97292f22a3402dbd59cef4af554954dc1d4f91a..b2c5ead035f583585b79f7eba51d66da89bf1259 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@@ -25595,10 +25595,40 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
private final GameEventDispatcher gameEventDispatcher;
public boolean noSave;
private final SleepStatus sleepStatus;
-@@ -339,6 +339,195 @@ public class ServerLevel extends Level implements WorldGenLevel {
- return player != null && player.level() == this ? player : null;
- }
- // Paper end - optimise getPlayerByUUID
+@@ -271,15 +271,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+
+ public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority priority,
+ java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
+- if (Thread.currentThread() != this.thread) {
+- this.getChunkSource().mainThreadProcessor.execute(() -> {
+- this.loadChunksForMoveAsync(axisalignedbb, priority, onLoad);
+- });
+- return;
+- }
+- List<net.minecraft.world.level.chunk.ChunkAccess> ret = new java.util.ArrayList<>();
+- it.unimi.dsi.fastutil.ints.IntArrayList ticketLevels = new it.unimi.dsi.fastutil.ints.IntArrayList();
+-
++ // Paper - rewrite chunk system
+ int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3;
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
+
+@@ -292,30 +284,160 @@ public class ServerLevel extends Level implements WorldGenLevel {
+ int minChunkZ = minBlockZ >> 4;
+ int maxChunkZ = maxBlockZ >> 4;
+
+- ServerChunkCache chunkProvider = this.getChunkSource();
++ this.moonrise$loadChunksAsync(minChunkX, maxChunkX, minChunkZ, maxChunkZ, priority, onLoad); // Paper - rewrite chunk system
++ }
++ // Paper end
++
++ // Paper start - optimise getPlayerByUUID
++ @Nullable
++ @Override
++ public Player getPlayerByUUID(UUID uuid) {
++ final Player player = this.getServer().getPlayerList().getPlayer(uuid);
++ return player != null && player.level() == this ? player : null;
++ }
++ // Paper end - optimise getPlayerByUUID
+ // Paper start - rewrite chunk system
+ private boolean markedClosing;
+ private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder();
@@ -25648,12 +25678,15 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
+ public final ChunkAccess moonrise$syncLoadNonFull(final int chunkX, final int chunkZ, final net.minecraft.world.level.chunk.status.ChunkStatus status) {
+ return this.moonrise$getChunkTaskScheduler().syncLoadNonFull(chunkX, chunkZ, status);
+ }
-+
+
+- int requiredChunks = (maxChunkX - minChunkX + 1) * (maxChunkZ - minChunkZ + 1);
+- int[] loadedChunks = new int[1];
+ @Override
+ public final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler moonrise$getChunkTaskScheduler() {
+ return this.chunkTaskScheduler;
+ }
-+
+
+- Long holderIdentifier = Long.valueOf(chunkProvider.chunkFutureAwaitCounter++);
+ @Override
+ public final ca.spottedleaf.moonrise.patches.chunk_system.io.RegionFileIOThread.ChunkDataController moonrise$getChunkDataController() {
+ return this.chunkDataController;
@@ -25663,7 +25696,8 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
+ public final ca.spottedleaf.moonrise.patches.chunk_system.io.RegionFileIOThread.ChunkDataController moonrise$getPoiChunkDataController() {
+ return this.poiDataController;
+ }
-+
+
+- java.util.function.Consumer<net.minecraft.world.level.chunk.ChunkAccess> consumer = (net.minecraft.world.level.chunk.ChunkAccess chunk) -> {
+ @Override
+ public final ca.spottedleaf.moonrise.patches.chunk_system.io.RegionFileIOThread.ChunkDataController moonrise$getEntityChunkDataController() {
+ return this.entityDataController;
@@ -25727,33 +25761,51 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
+ final List<ChunkAccess> ret = new ArrayList<>(requiredChunks);
+
+ final java.util.function.Consumer<net.minecraft.world.level.chunk.ChunkAccess> consumer = (final ChunkAccess chunk) -> {
-+ if (chunk != null) {
+ if (chunk != null) {
+- int ticketLevel = Math.max(33, chunkProvider.chunkMap.getUpdatingChunkIfPresent(chunk.getPos().toLong()).getTicketLevel());
+- ret.add(chunk);
+- ticketLevels.add(ticketLevel);
+- chunkProvider.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunk.getPos(), ticketLevel, holderIdentifier);
+ synchronized (ret) {
+ ret.add(chunk);
+ }
+ chunkHolderManager.addTicketAtLevel(ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.CHUNK_LOAD, chunk.getPos(), ticketLevel, holderIdentifier);
-+ }
+ }
+- if (++loadedChunks[0] == requiredChunks) {
+ if (loadedChunks.incrementAndGet() == requiredChunks) {
-+ try {
-+ onLoad.accept(java.util.Collections.unmodifiableList(ret));
-+ } finally {
-+ for (int i = 0, len = ret.size(); i < len; ++i) {
+ try {
+ onLoad.accept(java.util.Collections.unmodifiableList(ret));
+ } finally {
+ for (int i = 0, len = ret.size(); i < len; ++i) {
+- ChunkPos chunkPos = ret.get(i).getPos();
+- int ticketLevel = ticketLevels.getInt(i);
+ final ChunkPos chunkPos = ret.get(i).getPos();
-+
+
+- chunkProvider.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos);
+- chunkProvider.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, holderIdentifier);
+ chunkHolderManager.removeTicketAtLevel(ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.CHUNK_LOAD, chunkPos, ticketLevel, holderIdentifier);
-+ }
-+ }
-+ }
-+ };
-+
-+ for (int cx = minChunkX; cx <= maxChunkX; ++cx) {
-+ for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) {
+ }
+ }
+ }
+@@ -323,22 +445,46 @@ public class ServerLevel extends Level implements WorldGenLevel {
+
+ for (int cx = minChunkX; cx <= maxChunkX; ++cx) {
+ for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) {
+- ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(
+- this, cx, cz, net.minecraft.world.level.chunk.status.ChunkStatus.FULL, true, priority, consumer
+- );
+ chunkTaskScheduler.scheduleChunkLoad(cx, cz, chunkStatus, true, priority, consumer);
-+ }
-+ }
-+ }
-+
-+ @Override
+ }
+ }
+ }
+- // Paper end
+
+- // Paper start - optimise getPlayerByUUID
+- @Nullable
+ @Override
+- public Player getPlayerByUUID(UUID uuid) {
+- final Player player = this.getServer().getPlayerList().getPlayer(uuid);
+- return player != null && player.level() == this ? player : null;
+ public final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder moonrise$getViewDistanceHolder() {
+ return this.viewDistanceHolder;
+ }
@@ -25761,7 +25813,8 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
+ @Override
+ public final long moonrise$getLastMidTickFailure() {
+ return this.lastMidTickFailure;
-+ }
+ }
+- // Paper end - optimise getPlayerByUUID
+
+ @Override
+ public final void moonrise$setLastMidTickFailure(final long time) {
@@ -25791,7 +25844,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
-@@ -385,14 +574,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -385,14 +531,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
@@ -25809,7 +25862,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
return minecraftserver.overworld().getDataStorage();
});
this.chunkSource.getGeneratorState().ensureStructuresGenerated();
-@@ -420,6 +608,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -420,6 +565,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
});
@@ -25829,7 +25882,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
}
-@@ -553,7 +754,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -553,7 +711,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("checkDespawn");
entity.checkDespawn();
gameprofilerfiller.pop();
@@ -25838,7 +25891,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
Entity entity1 = entity.getVehicle();
if (entity1 != null) {
-@@ -578,13 +779,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -578,13 +736,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
gameprofilerfiller.push("entityManagement");
@@ -25857,7 +25910,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
protected void tickTime() {
-@@ -626,6 +830,63 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -626,6 +787,63 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
}
@@ -25921,7 +25974,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
ChunkPos chunkcoordintpair = chunk.getPos();
boolean flag = this.isRaining();
-@@ -675,35 +936,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -675,35 +893,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("tickBlocks");
timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) {
@@ -25958,7 +26011,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
timings.chunkTicksBlocks.stopTiming(); // Paper
-@@ -976,6 +1209,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -976,6 +1166,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (fluid1.is(fluid)) {
fluid1.tick(this, pos);
}
@@ -25970,7 +26023,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
-@@ -985,6 +1223,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -985,6 +1180,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (iblockdata.is(block)) {
iblockdata.tick(this, pos, this.random);
}
@@ -25982,7 +26035,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
-@@ -1061,6 +1304,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1061,6 +1261,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
@@ -25994,7 +26047,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
ServerChunkCache chunkproviderserver = this.getChunkSource();
if (!savingDisabled) {
-@@ -1076,16 +1324,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1076,16 +1281,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
timings.worldSaveChunks.startTiming(); // Paper
@@ -26022,7 +26075,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
// CraftBukkit start - moved from MinecraftServer.saveChunks
ServerLevel worldserver1 = this;
-@@ -1218,7 +1471,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1218,7 +1428,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
}
@@ -26031,7 +26084,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
// CraftBukkit start
-@@ -1249,7 +1502,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1249,7 +1459,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// CraftBukkit end
@@ -26040,7 +26093,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
}
-@@ -1260,11 +1513,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1260,11 +1470,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
// CraftBukkit end
@@ -26053,7 +26106,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
return false;
} else {
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
-@@ -1850,7 +2099,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1850,7 +2056,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@@ -26062,7 +26115,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
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()));
-@@ -1899,7 +2148,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1899,7 +2105,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
try {
@@ -26071,7 +26124,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
} catch (Throwable throwable4) {
if (bufferedwriter2 != null) {
try {
-@@ -1920,7 +2169,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1920,7 +2126,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
try {
@@ -26080,7 +26133,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
} catch (Throwable throwable6) {
if (bufferedwriter3 != null) {
try {
-@@ -2062,7 +2311,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2062,7 +2268,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting
public String getWatchdogStats() {
@@ -26089,7 +26142,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
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());
}
-@@ -2092,15 +2341,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2092,15 +2298,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public LevelEntityGetter<Entity> getEntities() {
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
@@ -26118,7 +26171,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
public void startTickingChunk(LevelChunk chunk) {
-@@ -2120,34 +2379,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2120,34 +2336,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public void close() throws IOException {
super.close();
@@ -26173,7 +26226,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..c759555241649cf5b355268066375341
}
@Override
-@@ -2173,7 +2445,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2173,7 +2402,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
crashreportsystemdetails.setDetail("Loaded entity count", () -> {
diff --git a/patches/server/0990-disable-forced-empty-world-ticks.patch b/patches/server/0990-disable-forced-empty-world-ticks.patch
index 747f78f9fd..e3bca0910f 100644
--- a/patches/server/0990-disable-forced-empty-world-ticks.patch
+++ b/patches/server/0990-disable-forced-empty-world-ticks.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index c759555241649cf5b355268066375341a54477f2..7da9729a6ac0684624f900a9e47f24e35bd3f3d9 100644
+index b2c5ead035f583585b79f7eba51d66da89bf1259..067697f6762b115b3d500a298532f69f286b5d6f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -729,7 +729,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -686,7 +686,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.handlingTick = false;
gameprofilerfiller.pop();
diff --git a/patches/server/0992-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0992-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
index fe409f5c40..b5c9d92ddb 100644
--- a/patches/server/0992-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
+++ b/patches/server/0992-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 7da9729a6ac0684624f900a9e47f24e35bd3f3d9..978208f74b6f1d3f859165e951d41013a5f00256 100644
+index 067697f6762b115b3d500a298532f69f286b5d6f..6476a69d7d68998ecc398840e673952e61dcc647 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2537,6 +2537,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -2494,6 +2494,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
{
if ( iter.next().player == entity )
{
diff --git a/patches/server/0997-Entity-Activation-Range-2.0.patch b/patches/server/0997-Entity-Activation-Range-2.0.patch
index d5ac20ddf2..ef299ab7d1 100644
--- a/patches/server/0997-Entity-Activation-Range-2.0.patch
+++ b/patches/server/0997-Entity-Activation-Range-2.0.patch
@@ -17,7 +17,7 @@ Adds villagers as separate config
public net.minecraft.world.entity.Entity isInsidePortal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a72da2535 100644
+index 6476a69d7d68998ecc398840e673952e61dcc647..3880ca95731c82bf48bb460f4c59a2c61970930b 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;
@@ -28,7 +28,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a
import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
-@@ -1235,17 +1234,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1192,17 +1191,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
++TimingHistory.entityTicks; // Paper - timings
// Spigot start
co.aikar.timings.Timing timer; // Paper
@@ -50,7 +50,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a
try {
// Paper end - timings
entity.setOldPosAndRot();
-@@ -1256,9 +1255,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1213,9 +1212,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
@@ -64,7 +64,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
-@@ -1266,13 +1269,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1223,13 +1226,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.tickPassenger(entity, entity1);
}
@@ -84,7 +84,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a
passenger.setOldPosAndRot();
++passenger.tickCount;
ProfilerFiller gameprofilerfiller = this.getProfiler();
-@@ -1281,8 +1289,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1238,8 +1246,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
});
gameprofilerfiller.incrementCounter("tickPassenger");
@@ -102,7 +102,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a
gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
-@@ -1292,6 +1309,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1249,6 +1266,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.tickPassenger(passenger, entity2);
}
diff --git a/patches/server/0999-Anti-Xray.patch b/patches/server/0999-Anti-Xray.patch
index 9efe1e1c24..87839cda7a 100644
--- a/patches/server/0999-Anti-Xray.patch
+++ b/patches/server/0999-Anti-Xray.patch
@@ -1104,10 +1104,10 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 1196eb573317ad01b6df0ae2d38aa17a72da2535..a5320b96148d79f8d2493060718688786466e6dd 100644
+index 3880ca95731c82bf48bb460f4c59a2c61970930b..4fea1670cb7b731145c0769cf9c2e2485bdd1d6b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -534,7 +534,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -491,7 +491,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
@@ -1155,7 +1155,7 @@ index 32634e45ac8433648e49e47e20081e15ad41ff15..dafa2cf7d3c49fc5bdcd68d2a9528127
if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index 9b1a6d8351fb473eec75a2fd08fb892b770e3586..0d0b07c9199be9ca0d5ac3feb1d44f149ba69283 100644
+index eec536d493575f593dd71c63944b047566f3822d..0a97d45f96b3b3cd12fa99373fcb5999c3fba96b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -414,7 +414,7 @@ public abstract class PlayerList {
diff --git a/patches/server/1001-Add-Alternate-Current-redstone-implementation.patch b/patches/server/1001-Add-Alternate-Current-redstone-implementation.patch
index 17df7da36c..d3dea51359 100644
--- a/patches/server/1001-Add-Alternate-Current-redstone-implementation.patch
+++ b/patches/server/1001-Add-Alternate-Current-redstone-implementation.patch
@@ -2009,7 +2009,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 a5320b96148d79f8d2493060718688786466e6dd..472655c55b1f5c213da9b6c1940a353bafdac509 100644
+index 4fea1670cb7b731145c0769cf9c2e2485bdd1d6b..3f1428b282987e1c4cd2fb5b035df5170cd09e00 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -2020,7 +2020,7 @@ index a5320b96148d79f8d2493060718688786466e6dd..472655c55b1f5c213da9b6c1940a353b
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
-@@ -2468,6 +2469,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -2425,6 +2426,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return crashreportsystemdetails;
}
@@ -2035,7 +2035,7 @@ index a5320b96148d79f8d2493060718688786466e6dd..472655c55b1f5c213da9b6c1940a353b
EntityCallbacks() {}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index ae7cd8df617dba09abb9ca1108aff719a9c3304f..9501a2527bb0db91dd5494ccb4066b9629993e59 100644
+index 87cde688976a45aa8848586b5371b3ab493813ea..5c4eaa6bcf20b0fcec14bd5ef76ea6f29a8613a2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -2013,4 +2013,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
diff --git a/patches/server/1034-Lag-compensation-ticks.patch b/patches/server/1034-Lag-compensation-ticks.patch
index d7881d9b73..ef9a724904 100644
--- a/patches/server/1034-Lag-compensation-ticks.patch
+++ b/patches/server/1034-Lag-compensation-ticks.patch
@@ -28,10 +28,10 @@ index 93ebdbfad4f9f300f31a124d8d4b36c4f5ce382c..a2875f7cdfb6b43ed59cff41ab4122a0
this.profiler.push(() -> {
String s = String.valueOf(worldserver);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 472655c55b1f5c213da9b6c1940a353bafdac509..86288143a54e1d786672a81c05698b37fa5d8de2 100644
+index 3f1428b282987e1c4cd2fb5b035df5170cd09e00..415b7839544d269a562b2bceeaa416a1a89be96e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -528,6 +528,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -485,6 +485,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return this.entityTickingChunks;
}
// Paper end - rewrite chunk system
diff --git a/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch
index 44068aa731..7497c32cc5 100644
--- a/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch
+++ b/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch
@@ -76,10 +76,10 @@ index d0d36a57ec4896bcb74970f8fb24d8f3e17db133..e2c24813f59c2fd075c740ac1842a38f
});
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 86288143a54e1d786672a81c05698b37fa5d8de2..1d74a728c03e2c6ffe0e795a5f24eac471a75157 100644
+index 415b7839544d269a562b2bceeaa416a1a89be96e..6d8a5c2b0d95828abbd99914d1d308522b89529f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -1242,7 +1242,26 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1199,7 +1199,26 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
}
@@ -106,7 +106,7 @@ index 86288143a54e1d786672a81c05698b37fa5d8de2..1d74a728c03e2c6ffe0e795a5f24eac4
++TimingHistory.entityTicks; // Paper - timings
// Spigot start
co.aikar.timings.Timing timer; // Paper
-@@ -1282,7 +1301,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1239,7 +1258,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.tickPassenger(entity, entity1);
}
// } finally { timer.stopTiming(); } // Paper - timings - move up
diff --git a/patches/server/1036-Write-SavedData-IO-async.patch b/patches/server/1036-Write-SavedData-IO-async.patch
index f92c991a18..538d0fcba4 100644
--- a/patches/server/1036-Write-SavedData-IO-async.patch
+++ b/patches/server/1036-Write-SavedData-IO-async.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Write SavedData IO async
Co-Authored-By: Shane Freeder <[email protected]>
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
-index cdb9160244cc69acd36ac9afcfe109a15ab2ab58..8a0b00d645e4cf2ca96ec7e8ebc6ef726a0ab8b0 100644
+index 4a5dc7fd4eb1a7ab1ec371f0f107de882f88149c..dcb5651d1d9b10b40430fb2f713beedf68336704 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -369,6 +369,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -24,10 +24,10 @@ index cdb9160244cc69acd36ac9afcfe109a15ab2ab58..8a0b00d645e4cf2ca96ec7e8ebc6ef72
// CraftBukkit start - modelled on below
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 1d74a728c03e2c6ffe0e795a5f24eac471a75157..46e8dd8dae25e1b2124e9c8031844fbe96eb6e1a 100644
+index 6d8a5c2b0d95828abbd99914d1d308522b89529f..e50df5a1f3b89b3d0687d6584bdd977f8b71a3f6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -1373,7 +1373,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1330,7 +1330,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -36,7 +36,7 @@ index 1d74a728c03e2c6ffe0e795a5f24eac471a75157..46e8dd8dae25e1b2124e9c8031844fbe
if (progressListener != null) {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
-@@ -1404,12 +1404,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1361,12 +1361,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// CraftBukkit end
}
diff --git a/patches/server/1039-Incremental-chunk-and-player-saving.patch b/patches/server/1039-Incremental-chunk-and-player-saving.patch
index dc3c15aede..a19a5893eb 100644
--- a/patches/server/1039-Incremental-chunk-and-player-saving.patch
+++ b/patches/server/1039-Incremental-chunk-and-player-saving.patch
@@ -56,10 +56,10 @@ index a2875f7cdfb6b43ed59cff41ab4122a08c4cc57f..45695abbeb0a6d47b31b23ba6c464f17
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
this.runAllTasks();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 46e8dd8dae25e1b2124e9c8031844fbe96eb6e1a..2766ec28f028c0bd672009928bf64c1a6e5d07d6 100644
+index e50df5a1f3b89b3d0687d6584bdd977f8b71a3f6..2fe9d9b38c01d04416843fdd48d3e33899b7de63 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -1358,6 +1358,35 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -1315,6 +1315,35 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
}