Add getComputedBiome API

This commit is contained in:
Jason Penilla 2022-03-14 22:45:32 -07:00
parent b0e4de9c20
commit ffdfd64ea5
2 changed files with 36 additions and 0 deletions

View file

@ -25,6 +25,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);
@ -36,10 +37,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}.
*

View file

@ -375,10 +375,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
*