From ff11da2791cde28483d1989ac9549bea979e5db2 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 11 Dec 2019 15:26:24 +1100 Subject: [PATCH] SPIGOT-5422: Add support for 3-dimensional biomes By: md_5 --- .../main/java/org/bukkit/ChunkSnapshot.java | 27 ++++++++- paper-api/src/main/java/org/bukkit/World.java | 58 +++++++++++++++++++ .../org/bukkit/generator/ChunkGenerator.java | 25 ++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/ChunkSnapshot.java b/paper-api/src/main/java/org/bukkit/ChunkSnapshot.java index dc5e6918d3..c51c73b659 100644 --- a/paper-api/src/main/java/org/bukkit/ChunkSnapshot.java +++ b/paper-api/src/main/java/org/bukkit/ChunkSnapshot.java @@ -104,19 +104,44 @@ public interface ChunkSnapshot { * @param x X-coordinate (0-15) * @param z Z-coordinate (0-15) * @return Biome at given coordinate + * @deprecated biomes are now 3-dimensional */ @NotNull + @Deprecated Biome getBiome(int x, int z); /** - * Get raw biome temperature (0.0-1.0) at given coordinate + * Get biome at given coordinates + * + * @param x X-coordinate (0-15) + * @param y Y-coordinate (0-255) + * @param z Z-coordinate (0-15) + * @return Biome at given coordinate + */ + @NotNull + Biome getBiome(int x, int y, int z); + + /** + * Get raw biome temperature at given coordinates * * @param x X-coordinate (0-15) * @param z Z-coordinate (0-15) * @return temperature at given coordinate + * @deprecated biomes are now 3-dimensional */ + @Deprecated double getRawBiomeTemperature(int x, int z); + /** + * Get raw biome temperature at given coordinates + * + * @param x X-coordinate (0-15) + * @param y Y-coordinate (0-15) + * @param z Z-coordinate (0-15) + * @return temperature at given coordinate + */ + double getRawBiomeTemperature(int x, int y, int z); + /** * Get world full time when chunk snapshot was captured * diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index ffaf8f5504..50fe188ea8 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -1278,19 +1278,44 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param x X coordinate of the block * @param z Z coordinate of the block * @return Biome of the requested block + * @deprecated biomes are now 3-dimensional */ @NotNull + @Deprecated Biome getBiome(int x, int z); + /** + * Gets the biome for the given block coordinates. + * + * @param x X coordinate of the block + * @param y Y coordinate of the block + * @param z Z coordinate of the block + * @return Biome of the requested block + */ + @NotNull + Biome getBiome(int x, int y, int z); + /** * Sets the biome for the given block coordinates * * @param x X coordinate of the block * @param z Z coordinate of the block * @param bio new Biome type for this block + * @deprecated biomes are now 3-dimensional */ + @Deprecated void setBiome(int x, int z, @NotNull Biome bio); + /** + * Sets the biome for the given block coordinates + * + * @param x X coordinate of the block + * @param y Y coordinate of the block + * @param z Z coordinate of the block + * @param bio new Biome type for this block + */ + void setBiome(int x, int y, int z, @NotNull Biome bio); + /** * Gets the temperature for the given block coordinates. *

@@ -1303,9 +1328,27 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param x X coordinate of the block * @param z Z coordinate of the block * @return Temperature of the requested block + * @deprecated biomes are now 3-dimensional */ + @Deprecated public double getTemperature(int x, int z); + /** + * Gets the temperature for the given block coordinates. + *

+ * It is safe to run this method when the block does not exist, it will + * not create the block. + *

+ * This method will return the raw temperature without adjusting for block + * height effects. + * + * @param x X coordinate of the block + * @param y Y coordinate of the block + * @param z Z coordinate of the block + * @return Temperature of the requested block + */ + public double getTemperature(int x, int y, int z); + /** * Gets the humidity for the given block coordinates. *

@@ -1315,9 +1358,24 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param x X coordinate of the block * @param z Z coordinate of the block * @return Humidity of the requested block + * @deprecated biomes are now 3-dimensional */ + @Deprecated public double getHumidity(int x, int z); + /** + * Gets the humidity for the given block coordinates. + *

+ * It is safe to run this method when the block does not exist, it will + * not create the block. + * + * @param x X coordinate of the block + * @param y Y coordinate of the block + * @param z Z coordinate of the block + * @return Humidity of the requested block + */ + public double getHumidity(int x, int y, int z); + /** * Gets the maximum height of this world. *

diff --git a/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java b/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java index dd01233380..5b847bb387 100644 --- a/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java +++ b/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java @@ -44,18 +44,43 @@ public abstract class ChunkGenerator { * @param x - 0-15 * @param z - 0-15 * @return Biome value + * @deprecated biomes are now 3-dimensional */ @NotNull + @Deprecated Biome getBiome(int x, int z); + /** + * Get biome at x, z within chunk being generated + * + * @param x - 0-15 + * @param y - 0-255 + * @param z - 0-15 + * @return Biome value + */ + @NotNull + Biome getBiome(int x, int y, int z); + /** * Set biome at x, z within chunk being generated * * @param x - 0-15 * @param z - 0-15 * @param bio - Biome value + * @deprecated biomes are now 3-dimensional */ + @Deprecated void setBiome(int x, int z, @NotNull Biome bio); + + /** + * Set biome at x, z within chunk being generated + * + * @param x - 0-15 + * @param y - 0-255 + * @param z - 0-15 + * @param bio - Biome value + */ + void setBiome(int x, int y, int z, @NotNull Biome bio); } /**