Paper/patches/api/0354-Add-getComputedBiome-API.patch
Nassim Jahnke 9df2066642
Updated Upstream (Bukkit/CraftBukkit)
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:
dfe1fb48 PR-906: Add missing MinecraftExperimental annotation to Bundles
825ab30d PR-905: Add missing MapCursor.Type and update documentation
e03d10e6 PR-903: Make BARRIER Waterlogged
1961ead6 PR-898: Use Java Consumer instead of Bukkit Consumer

CraftBukkit Changes:
f71a799f0 Make BARRIER Waterlogged
172f76a45 Upgrade specialsource-maven-plugin
f0702775c SPIGOT-7486: Alternate approach to null profile names
069495671 SPIGOT-7485: Allow air entity items since required for Vanilla logic
5dfd33dc2 SPIGOT-7484: Cancelling PlayerEditBookEvent does not update client's book contents
02d490788 PR-1250: Standardize and centralize Bukkit / Minecraft registry conversion
9024a09b9 PR-1251: Use Java Consumer instead of Bukkit Consumer
6d4b25bf1 Increase diff stability
2023-09-23 12:21:59 +10: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 63503cf17847a85264c930a9fc23a5aab5955c3c..93e20ca14a2b7e5817fab788b6dfa73c6ced6acb 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 c5670b40880fa124c7615f9b1d379b75d7110f05..5e42a4c3aa872d9755f8cd5ce3f4ee36bcc71fb9 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -371,10 +371,22 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
* 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
*