From 108dc2358b5200dcca59b7acf0a8b164c3f42033 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 28 Mar 2023 16:13:18 -0700 Subject: [PATCH] Use chunk coords for thread check for CraftWorld#getHighestBlockYAt Not block coords --- patches/server/0004-Threaded-Regions.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0004-Threaded-Regions.patch b/patches/server/0004-Threaded-Regions.patch index 3bc1219..1ac5448 100644 --- a/patches/server/0004-Threaded-Regions.patch +++ b/patches/server/0004-Threaded-Regions.patch @@ -23223,7 +23223,7 @@ index e0b6c737f9de2b6e692d6813d8dea4c35f038573..851937baff90177e648d970cf1c462b8 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ff6559bf563f2fdcc0f2843d4f4aa24d7ddfb6db..eb8206eaeb83ed8cfb86b1889166cfefddbdd70d 100644 +index ff6559bf563f2fdcc0f2843d4f4aa24d7ddfb6db..2ead9af36c4d41c61b68a960ff17e25894efeb2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -180,7 +180,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -23324,7 +23324,7 @@ index ff6559bf563f2fdcc0f2843d4f4aa24d7ddfb6db..eb8206eaeb83ed8cfb86b1889166cfef public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { - world.captureTreeGeneration = true; - world.captureBlockStates = true; -+ io.papermc.paper.util.TickThread.ensureTickThread(this.world, loc.getBlockX() >> 4, loc.getBlockZ() >> 4, "Cannot generate tree asynchronously"); // Folia - region threading ++ io.papermc.paper.util.TickThread.ensureTickThread(this.world, loc.getX(), loc.getZ(), "Cannot generate tree asynchronously"); // Folia - region threading + io.papermc.paper.threadedregions.RegionizedWorldData worldData = world.getCurrentWorldData(); // Folia - region threading + worldData.captureTreeGeneration = true; // Folia - region threading + worldData.captureBlockStates = true; // Folia - region threading @@ -23395,7 +23395,7 @@ index ff6559bf563f2fdcc0f2843d4f4aa24d7ddfb6db..eb8206eaeb83ed8cfb86b1889166cfef @Override public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { -+ io.papermc.paper.util.TickThread.ensureTickThread(this.world, x, z, "Cannot retrieve chunk asynchronously"); // Folia - region threading ++ io.papermc.paper.util.TickThread.ensureTickThread(this.world, x >> 4, z >> 4, "Cannot retrieve chunk asynchronously"); // Folia - region threading warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper // Transient load for this tick return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);