mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 16:50:17 +01:00
61 lines
3.2 KiB
Diff
61 lines
3.2 KiB
Diff
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
|
|
index 5ca1bc3a0574c1080cb000245dbc8fa093ee7d01..5be114bc70c6fdbcb7d804e7558a5172c4461b96 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
@@ -220,6 +220,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
|
return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registries.BIOME), 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(Registries.BIOME), 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 e649c3296363ea2f8429593e33a7833143bcabba..0a3fa0f75d2d9f09be8c29d35cb22953ceb8906b 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -344,6 +344,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 23ffe4b8a19286543e12bf7408879e6d1305a78f..935bca901f0618d77f3bf6c057bcbc606c742fac 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
|
|
@@ -165,6 +165,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);
|