Use chunk coords for thread check for CraftWorld#getHighestBlockYAt

Not block coords
This commit is contained in:
Spottedleaf 2023-03-28 16:13:18 -07:00
parent 1c5e9be7fd
commit 108dc2358b

View File

@ -23223,7 +23223,7 @@ index e0b6c737f9de2b6e692d6813d8dea4c35f038573..851937baff90177e648d970cf1c462b8
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/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 { @@ -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) { public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
- world.captureTreeGeneration = true; - world.captureTreeGeneration = true;
- world.captureBlockStates = 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 + io.papermc.paper.threadedregions.RegionizedWorldData worldData = world.getCurrentWorldData(); // Folia - region threading
+ worldData.captureTreeGeneration = true; // Folia - region threading + worldData.captureTreeGeneration = true; // Folia - region threading
+ worldData.captureBlockStates = true; // Folia - region threading + worldData.captureBlockStates = true; // Folia - region threading
@ -23395,7 +23395,7 @@ index ff6559bf563f2fdcc0f2843d4f4aa24d7ddfb6db..eb8206eaeb83ed8cfb86b1889166cfef
@Override @Override
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { 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 warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper
// Transient load for this tick // Transient load for this tick
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);