aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0831-Implement-getComputedBiome-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0831-Implement-getComputedBiome-API.patch')
-rw-r--r--patches/server/0831-Implement-getComputedBiome-API.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/patches/server/0831-Implement-getComputedBiome-API.patch b/patches/server/0831-Implement-getComputedBiome-API.patch
new file mode 100644
index 0000000000..b6a274bb77
--- /dev/null
+++ b/patches/server/0831-Implement-getComputedBiome-API.patch
@@ -0,0 +1,61 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jason Penilla <[email protected]>
+Date: Mon, 14 Mar 2022 22:46:05 -0700
+Subject: [PATCH] Implement getComputedBiome API
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+index 5628940cd3c3566c5db2beda506d4f20b6e3cbae..6445c2e4c97860e1c98f5263188d309cf55936f0 100644
+--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+@@ -211,6 +211,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
+ return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), this.getHandle().getNoiseBiome(x >> 2, y >> 2, z >> 2));
+ }
+
++ // Paper start
++ @Override
++ public Biome getComputedBiome(int x, int y, int z) {
++ return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), this.getHandle().getBiome(new BlockPos(x, y, z)));
++ }
++ // Paper end
++
+ @Override
+ public void setBiome(Location location, Biome biome) {
+ this.setBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ(), biome);
+diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+index 0030ac394d44acddcd2fc716277ae2b509a378af..22356c2380741dd811810420127e247e46b0b8e2 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+@@ -341,6 +341,13 @@ public class CraftBlock implements Block {
+ return this.getWorld().getBiome(this.getX(), this.getY(), this.getZ());
+ }
+
++ // Paper start
++ @Override
++ public Biome getComputedBiome() {
++ return this.getWorld().getComputedBiome(this.getX(), this.getY(), this.getZ());
++ }
++ // Paper end
++
+ @Override
+ public void setBiome(Biome bio) {
+ this.getWorld().setBiome(this.getX(), this.getY(), this.getZ(), bio);
+diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
+index 392701b0022e05d0fd03ee5836fd18f00502f028..b01904021bd4f485aaf03d1d7634b56f134d3099 100644
+--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
++++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
+@@ -166,6 +166,14 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
+ return super.getBiome(x, y, z);
+ }
+
++ // Paper start
++ @Override
++ public Biome getComputedBiome(int x, int y, int z) {
++ Preconditions.checkArgument(this.isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z);
++ return super.getComputedBiome(x, y, z);
++ }
++ // Paper end
++
+ @Override
+ public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> biomeBase) {
+ Preconditions.checkArgument(this.isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z);