diff --git a/paper-api/src/main/java/org/bukkit/Location.java b/paper-api/src/main/java/org/bukkit/Location.java index 85f2c71401..95b9557a27 100644 --- a/paper-api/src/main/java/org/bukkit/Location.java +++ b/paper-api/src/main/java/org/bukkit/Location.java @@ -52,7 +52,7 @@ public class Location implements Cloneable { * @return Block at the represented location */ public Block getBlock() { - return world.getBlockAt(getBlockX(), getBlockY(), getBlockZ()); + return world.getBlockAt(this); } /** diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index df8c7e2a3a..77ef9099bb 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -34,6 +34,16 @@ public interface World { * @return Block at the given location */ public Block getBlockAt(int x, int y, int z); + + /** + * Gets the block at the given location + * + * This block will always represent the latest state + * + * @param location Location of the block + * @return Block at the given location + */ + public Block getBlockAt(Location location); /** * Gets the block type-id at the given location @@ -45,6 +55,14 @@ public interface World { */ public int getBlockTypeIdAt(int x, int y, int z); + /** + * Gets the block type-id at the given location + * + * @param location Location of the block + * @return TypeId of the block at the given location + */ + public int getBlockTypeIdAt(Location location); + /** * Gets the highest non-air coordinate at the given (x,z) location * @param x X-coordinate of the blocks @@ -53,6 +71,13 @@ public interface World { */ public int getHighestBlockYAt(int x, int z); + /** + * Gets the highest non-air coordinate at the given location + * @param location Location of the blocks + * @return Y-coordinate of the highest non-air block + */ + public int getHighestBlockYAt(Location location); + /** * Gets the chunk at the given location * @@ -62,6 +87,14 @@ public interface World { */ public Chunk getChunkAt(int x, int z); + /** + * Gets the chunk at the given location + * + * @param location Location of the chunk + * @return Chunk at the given location + */ + public Chunk getChunkAt(Location location); + /** * Gets the chunk which contains the given block *