Paper/patches/api/0373-Add-getComputedBiome-API.patch
Nassim Jahnke 385f313a8b
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8092)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
d41796de SPIGOT-7071: Add Player#stopSound(SoundCategory category)
61dae5b2 SPIGOT-7011, SPIGOT-7065: Overhaul of structures

CraftBukkit Changes:
991aeda12 SPIGOT-1729, SPIGOT-7090: Keep precision in teleportation between worlds
5c9a5f628 SPIGOT-7071: Add Player#stopSound(SoundCategory category)
68f888ded SPIGOT-7011, SPIGOT-7065: Overhaul of structures
0231a3746 Remove outdated build delay.

Spigot Changes:
475f6008 Rebuild patches
8ce1761f Rebuild patches
2022-07-04 16:38:06 +02:00

80 lines
3.0 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:45:32 -0700
Subject: [PATCH] Add getComputedBiome API
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 43b53c21af01e0f496c8aaacff82dfdfadaf40f6..3f7e860de4e28745fcdf8d2f41f4a8c210f48909 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java
+++ b/src/main/java/org/bukkit/RegionAccessor.java
@@ -26,6 +26,7 @@ public interface RegionAccessor extends Keyed { // Paper
*
* @param location the location of the biome
* @return Biome at the given location
+ * @see #getComputedBiome(int, int, int)
*/
@NotNull
Biome getBiome(@NotNull Location location);
@@ -37,10 +38,33 @@ public interface RegionAccessor extends Keyed { // Paper
* @param y Y-coordinate of the block
* @param z Z-coordinate of the block
* @return Biome at the given coordinates
+ * @see #getComputedBiome(int, int, int)
*/
@NotNull
Biome getBiome(int x, int y, int z);
+ // Paper start
+ /**
+ * Gets the computed {@link Biome} at the given coordinates.
+ *
+ * <p>The computed Biome is the Biome as seen by clients for rendering
+ * purposes and in the "F3" debug menu. This is computed by looking at the noise biome
+ * at this and surrounding quarts and applying complex math operations.</p>
+ *
+ * <p>Most other Biome-related methods named getBiome, setBiome, and similar
+ * operate on the "noise biome", which is stored per-quart, or in other words,
+ * 1 Biome per 4x4x4 block region. This is how Biomes are currently generated and
+ * stored on disk.</p>
+ *
+ * @param x X-coordinate of the block
+ * @param y Y-coordinate of the block
+ * @param z Z-coordinate of the block
+ * @return Biome at the given coordinates
+ */
+ @NotNull
+ Biome getComputedBiome(int x, int y, int z);
+ // Paper end
+
/**
* Sets the {@link Biome} at the given {@link Location}.
*
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index cff39708e66208921da15d12d94407d6b6950298..e405c279f6135c94c775a856ab88fd3cace6bd5c 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -370,10 +370,22 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
* Returns the biome that this block resides in
*
* @return Biome type containing this block
+ * @see #getComputedBiome()
*/
@NotNull
Biome getBiome();
+ // Paper start
+ /**
+ * Gets the computed biome at the location of this Block.
+ *
+ * @return computed biome at the location of this Block.
+ * @see org.bukkit.RegionAccessor#getComputedBiome(int, int, int)
+ */
+ @NotNull
+ Biome getComputedBiome();
+ // Paper end
+
/**
* Sets the biome that this block resides in
*