2022-03-15 19:38:36 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
|
|
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
|
2023-06-08 10:08:08 +02:00
|
|
|
index 5c8e905bbf56dd2af5b30d34371793c3f98801ab..5bab5c75a2ce945b43434d2240c9d1124a20aee2 100644
|
2022-03-15 19:38:36 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
2023-05-12 13:10:08 +02:00
|
|
|
@@ -220,6 +220,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
2022-12-07 22:35:34 +01:00
|
|
|
return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registries.BIOME), this.getHandle().getNoiseBiome(x >> 2, y >> 2, z >> 2));
|
2022-03-15 19:38:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public Biome getComputedBiome(int x, int y, int z) {
|
2022-12-08 04:24:00 +01:00
|
|
|
+ return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registries.BIOME), this.getHandle().getBiome(new BlockPos(x, y, z)));
|
2022-03-15 19:38:36 +01:00
|
|
|
+ }
|
|
|
|
+ // 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
|
2023-06-08 10:08:08 +02:00
|
|
|
index 8131c1db3d7963121a24348575ea8a98a80a974c..84d1351c423965acf79c1413d00eff9eaa3927a2 100644
|
2022-03-15 19:38:36 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
2023-06-06 11:09:19 +02:00
|
|
|
@@ -345,6 +345,13 @@ public class CraftBlock implements Block {
|
2022-03-15 19:38:36 +01:00
|
|
|
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
|
2023-05-12 13:10:08 +02:00
|
|
|
index 0ea1586bab74983fca19dcc5415fbc7a044fe186..e3d6f0847bb3b524452f4dc073c07a5d9448bb9f 100644
|
2022-03-15 19:38:36 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
2023-05-12 13:10:08 +02:00
|
|
|
@@ -167,6 +167,14 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
|
2022-03-15 19:38:36 +01:00
|
|
|
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);
|