Added a whole buncha overloads for Location in World

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-02-18 16:34:49 +00:00
parent 9adb4e4d92
commit d7633fa07b
2 changed files with 34 additions and 1 deletions

View File

@ -52,7 +52,7 @@ public class Location implements Cloneable {
* @return Block at the represented location * @return Block at the represented location
*/ */
public Block getBlock() { public Block getBlock() {
return world.getBlockAt(getBlockX(), getBlockY(), getBlockZ()); return world.getBlockAt(this);
} }
/** /**

View File

@ -34,6 +34,16 @@ public interface World {
* @return Block at the given location * @return Block at the given location
*/ */
public Block getBlockAt(int x, int y, int z); 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 * 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); 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 * Gets the highest non-air coordinate at the given (x,z) location
* @param x X-coordinate of the blocks * @param x X-coordinate of the blocks
@ -53,6 +71,13 @@ public interface World {
*/ */
public int getHighestBlockYAt(int x, int z); 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 * Gets the chunk at the given location
* *
@ -62,6 +87,14 @@ public interface World {
*/ */
public Chunk getChunkAt(int x, int z); 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 * Gets the chunk which contains the given block
* *