13
0
geforkt von Mirrors/Paper

Fix locateNearestBiome nullability check (#8662)

Dieser Commit ist enthalten in:
SoSeDiK 2022-12-13 17:01:54 +02:00
Ursprung 298cdefc8b
Commit 45821f2511

Datei anzeigen

@ -21,8 +21,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
+ 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();
+ return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
+ Pair<BlockPos, Holder<net.minecraft.world.level.biome.Biome>> pair = getHandle().findClosestBiome3d(holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step);
+ if (pair == null) {
+ return null;
+ }
+ BlockPos nearest = pair.getFirst();
+ return new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
+ }
+
+ @Override