Package org.spongepowered.api.world
Interface Location<W extends World<W,L>,L extends Location<W,L>>   
- All Known Subinterfaces:
- ClientLocation,- ServerLocation
public interface Location<W extends World<W,L>,L extends Location<W,L>>   
- 
Method SummaryModifier and TypeMethodDescriptionadd(double x, double y, double z) Add vector components to the position on this instance, returning a new Location instance.Add another Vector3d to the position on this instance, returning a new Location instance.Add another Vector3i to the position on this instance, returning a new Location instance.biome()Gets the block at this location.Gets the underlying biome position.block()Gets theBlockStatefor this location.Optional<? extends BlockEntity>Gets the associatedBlockEntityon this block.Gets the underlying block position.default BlockTypeGets theBlockTypefor this location.intblockX()Gets the floored X component of this instance's position.intblockY()Gets the floored Y component of this instance's position.intblockZ()Gets the floored Z component of this instance's position.Gets the underlying chunk position.fluid()Gets theFluidStatefor this location.booleanhasBlock()Returns true if this location has a block at itsblockPosition().booleanChecks for whether the block at this location contains block entity data.booleanReturns true if this location is in the given world.booleanGets whether this location is available.booleanisValid()Gets whether this location is valid.default Optional<ServerLocation>onServer()position()Gets the underlying position.relativeTo(Direction direction) Gets the location next to this one in the given direction.relativeToBlock(Direction direction) Gets the location next to this one in the given direction.booleansetBlock(BlockState state) Replace the block at this location with a new state.booleansetBlock(BlockState state, BlockChangeFlag flag) Replace the block at this location with a new state.booleansetBlockType(BlockType type) Replace the block type at this location by a new type.booleansetBlockType(BlockType type, BlockChangeFlag flag) Replace the block type at this location by a new type.sub(double x, double y, double z) Subtract vector components to the position on this instance, returning a new Location instance.Subtract another Vector3d to the position on this instance, returning a new Location instance.Subtract another Vector3i to the position on this instance, returning a new Location instance.withBlockPosition(Vector3i position) Create a new instance with a new block position.withPosition(Vector3d position) Create a new instance with a new position.Create a new instance with a new World.world()Gets the underlying world.Gets the underlyingWorldif it's available.doublex()Gets the X component of this instance's position.doubley()Gets the Y component of this instance's position.doublez()Gets the Z component of this instance's position.
- 
Method Details- 
worldW world()Gets the underlying world. Throws aIllegalStateExceptionif the world isn't available.- Returns:
- The underlying world
- See Also:
 
- 
worldIfAvailable- Returns:
- The underlying world, if available
- See Also:
 
- 
isAvailableboolean isAvailable()Gets whether this location is available. A location is available when the targetWorldexists and is loaded.- Returns:
- Whether the location is available
 
- 
isValidboolean isValid()Gets whether this location is valid. A location is valid when the targetWorldexists, this can be loaded or unloaded.- Returns:
- Whether the location is valid
 
- 
positionVector3d position()Gets the underlying position.- Returns:
- The underlying position
 
- 
blockPositionVector3i blockPosition()Gets the underlying block position.- Returns:
- The underlying block position
 
- 
chunkPositionVector3i chunkPosition()Gets the underlying chunk position.- Returns:
- The underlying chunk position
 
- 
biomePositionVector3i biomePosition()Gets the underlying biome position.- Returns:
- The underlying biome position
 
- 
xdouble x()Gets the X component of this instance's position.- Returns:
- The x component
 
- 
ydouble y()Gets the Y component of this instance's position.- Returns:
- The y component
 
- 
zdouble z()Gets the Z component of this instance's position.- Returns:
- The z component
 
- 
blockXint blockX()Gets the floored X component of this instance's position.- Returns:
- The floored x component
 
- 
blockYint blockY()Gets the floored Y component of this instance's position.- Returns:
- The floored y component
 
- 
blockZint blockZ()Gets the floored Z component of this instance's position.- Returns:
- The floored z component
 
- 
onServer
- 
inWorldReturns true if this location is in the given world. This is implemented as anObject.equals(Object)check.- Parameters:
- world- The world to check
- Returns:
- Whether this location is in the world
 
- 
withWorldCreate a new instance with a new World.- Parameters:
- world- The new world
- Returns:
- A new instance
 
- 
withPositionCreate a new instance with a new position.- Parameters:
- position- The new position
- Returns:
- A new instance
 
- 
withBlockPositionCreate a new instance with a new block position.- Parameters:
- position- The new position
- Returns:
- A new instance
 
- 
subSubtract another Vector3d to the position on this instance, returning a new Location instance.- Parameters:
- v- The vector to subtract
- Returns:
- A new instance
 
- 
subSubtract another Vector3i to the position on this instance, returning a new Location instance.- Parameters:
- v- The vector to subtract
- Returns:
- A new instance
 
- 
subSubtract vector components to the position on this instance, returning a new Location instance.- Parameters:
- x- The x component
- y- The y component
- z- The z component
- Returns:
- A new instance
 
- 
addAdd another Vector3d to the position on this instance, returning a new Location instance.- Parameters:
- v- The vector to add
- Returns:
- A new instance
 
- 
addAdd another Vector3i to the position on this instance, returning a new Location instance.- Parameters:
- v- The vector to add
- Returns:
- A new instance
 
- 
addAdd vector components to the position on this instance, returning a new Location instance.- Parameters:
- x- The x component
- y- The y component
- z- The z component
- Returns:
- A new instance
 
- 
relativeToGets the location next to this one in the given direction. Always moves by a unit amount, even diagonally.- Parameters:
- direction- The direction to move in
- Returns:
- The location in that direction
 
- 
relativeToBlockGets the location next to this one in the given direction. Always moves by a block amount, even diagonally.Direction.Division.SECONDARY_ORDINALdirections are not a valid argument. These will throw an exception.- Parameters:
- direction- The direction to move in
- Returns:
- The location in that direction
- Throws:
- IllegalArgumentException- If the direction is a- Direction.Division.SECONDARY_ORDINAL
 
- 
biomeBiome biome()Gets the block at this location.- Returns:
- The biome at this location
 
- 
hasBlockboolean hasBlock()Returns true if this location has a block at itsblockPosition().- Returns:
- Whether or not there is a block at this location.
 
- 
blockBlockState block()Gets theBlockStatefor this location.- Returns:
- The block state
 
- 
blockTypeGets theBlockTypefor this location.- Returns:
- The block type
 
- 
fluidFluidState fluid()Gets theFluidStatefor this location.- Returns:
- The fluid state
 
- 
hasBlockEntityboolean hasBlockEntity()Checks for whether the block at this location contains block entity data.- Returns:
- True if the block at this location has block entity data, false otherwise
 
- 
blockEntityOptional<? extends BlockEntity> blockEntity()Gets the associatedBlockEntityon this block.- Returns:
- The associated block entity, if available
 
- 
setBlockReplace the block at this location with a new state.This will remove any extended block data at the given position. - Parameters:
- state- The new block state
- Returns:
- True if the block change was successful
 
- 
setBlockReplace the block at this location with a new state.This will remove any extended block data at the given position. - Parameters:
- state- The new block state
- flag- The various change flags controlling some interactions
- Returns:
- True if the block change was successful
 
- 
setBlockTypeReplace the block type at this location by a new type.This will remove any extended block data at the given position. - Parameters:
- type- The new type
- Returns:
- True if the block change was successful
 
- 
setBlockTypeReplace the block type at this location by a new type.This will remove any extended block data at the given position. - Parameters:
- type- The new type
- flag- The various change flags controlling some interactions
- Returns:
- True if the block change was successful
 
 
-