mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Fix locateNearestBiome nullability check (#8662)
This commit is contained in:
parent
326a65e427
commit
0148283131
2 changed files with 10 additions and 6 deletions
|
@ -5,10 +5,10 @@ Subject: [PATCH] More World API
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 9055b7821ba2a52e20bf6422cae2edfefc1872b1..7beaea21edf0b832bc1115d90f5893c75a8da912 100644
|
index 9055b7821ba2a52e20bf6422cae2edfefc1872b1..efc2fa39175d6981ebbc5b204baeef4298eb0e5c 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
|
||||||
@@ -2034,6 +2034,65 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@@ -2034,6 +2034,69 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), new Location(this, found.getFirst().getX(), found.getFirst().getY(), found.getFirst().getZ()));
|
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), new Location(this, found.getFirst().getX(), found.getFirst().getY(), found.getFirst().getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,12 @@ index 9055b7821ba2a52e20bf6422cae2edfefc1872b1..7beaea21edf0b832bc1115d90f5893c7
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
|
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
|
||||||
+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ());
|
+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ());
|
||||||
+ BlockPos nearest = getHandle().findClosestBiome3d( holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step).getFirst();
|
+ Pair<BlockPos, Holder<net.minecraft.world.level.biome.Biome>> pair = getHandle().findClosestBiome3d(holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step);
|
||||||
+ return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
|
+ if (pair == null) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ BlockPos nearest = pair.getFirst();
|
||||||
|
+ return new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
|
|
@ -18,7 +18,7 @@ index bb411f4efc550ed7872f0252373be81bd8e99b76..3cbf801b2e5420c0e870f73788deb550
|
||||||
|
|
||||||
private static boolean isOutsideSpawnableHeight(int y) {
|
private static boolean isOutsideSpawnableHeight(int y) {
|
||||||
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 37a204d35979fb51cab9c228515e35c4b1049ab1..c5eb25b191cbb496be2a761d0b6eec9776319687 100644
|
index 01ccb54fb94fc5c03865b12bde63a2cb5a46e0f5..f8d321e925bf2708e51590542325c1bdc67d5964 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
|
||||||
@@ -312,9 +312,24 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@@ -312,9 +312,24 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
|
@ -86,7 +86,7 @@ index 37a204d35979fb51cab9c228515e35c4b1049ab1..c5eb25b191cbb496be2a761d0b6eec97
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
@@ -2314,6 +2334,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@@ -2318,6 +2338,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
// Spigot end
|
// Spigot end
|
||||||
// Paper start
|
// Paper start
|
||||||
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
|
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
|
||||||
|
|
Loading…
Reference in a new issue