diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java index 7020d32a..5742dfc8 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.entity.*; import org.bukkit.generator.BlockPopulator; @@ -74,6 +75,25 @@ public interface World { */ public int getHighestBlockYAt(Location location); + /** + * Gets the highest non-empty block at the given coordinates + * + * @param x X-coordinate of the block + * @param z Z-coordinate of the block + * + * @return Highest non-empty block + */ + public Block getHighestBlockAt(int x, int z); + + /** + * Gets the highest non-empty block at the given coordinates + * + * @param location Coordinates to get the highest block + * + * @return Highest non-empty block + */ + public Block getHighestBlockAt(Location location); + /** * Gets the {@link Chunk} at the given coordinates * @@ -651,6 +671,42 @@ public interface World { */ public boolean getAllowMonsters(); + /** + * Gets the biome 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 z Z coordinate of the block + * + * @return Biome of the requested block + */ + public Biome getBiome(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. + * + * @param x X coordinate of the block + * @param z Z coordinate of the block + * + * @return Temperature of the requested block + */ + public double getTemperature(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 z Z coordinate of the block + * + * @return Humidity of the requested block + */ + public double getHumidity(int x, int z); + /** * Represents various map environment types that a world may be */ diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java index f66b3e0c..391545b2 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -236,4 +236,36 @@ public interface Block { * @return */ int getBlockPower(); + + /** + * Checks if this block is empty. + * + * A block is considered empty when {@link #getType()} returns {@link Material#AIR}. + * + * @return true if this block is empty + */ + boolean isEmpty(); + + /** + * Checks if this block is liquid. + * + * A block is considered liquid when {@link #getType()} returns {@link Material#WATER}, {@link Material#STATIONARY_WATER}, {@link Material#LAVA} or {@link Material#STATIONARY_LAVA}. + * + * @return true if this block is liquid + */ + boolean isLiquid(); + + /** + * Gets the temperature of the biome of this block + * + * @return Temperature of this block + */ + double getTemperature(); + + /** + * Gets the humidity of the biome of this block + * + * @return Humidity of this block + */ + double getHumidity(); }