Interface ChunkLayout
public interface ChunkLayout
A class for information about the chunk coordinate space, aka the layout.
 This can be used to obtain information about the chunk size and the space
 bounds, validate coordinates, convert from chunk to world and vice-versa and
 translate coordinates; among other things.
- 
Method SummaryModifier and TypeMethodDescriptionaddToChunk(int cx, int cy, int cz, int ox, int oy, int oz) Adds the chunk offset to the chunk coordinates.addToChunk(Vector3i chunkCoords, Vector3i chunkOffset) Adds the chunk offset to the chunk coordinates.Returns the size of the chunks in blocks.forceToChunk(int x, int y, int z) Converts world coordinates to chunk coordinates.default Vector3iforceToChunk(Vector3i worldCoords) Converts world coordinates to chunk coordinates.forceToWorld(int x, int y, int z) Converts chunk coordinates to world coordinates.default Vector3iforceToWorld(Vector3i chunkCoords) Converts chunk coordinates to world coordinates.booleanisInChunk(int x, int y, int z) Returns true if the local coordinates fit in a chunk.booleanisInChunk(int wx, int wy, int wz, int cx, int cy, int cz) Returns true if the world coordinates fit in the chunk at the given coordinates.default booleanReturns true if the local coordinates fit in a chunk.default booleanReturns true if the world coordinates fit in the chunk at the given coordinates.default booleanisValidChunk(int x, int y, int z) Returns true if the coordinates are valid chunk coordinates.default booleanisValidChunk(Vector3i coords) Returns true if the coordinates are valid chunk coordinates.moveToChunk(int x, int y, int z, Direction direction) Moves chunk coordinates one step in the given direction.moveToChunk(int x, int y, int z, Direction direction, int steps) Moves chunk coordinates a number of steps in the given direction.moveToChunk(Vector3i chunkCoords, Direction direction) Moves chunk coordinates one step in the given direction.moveToChunk(Vector3i chunkCoords, Direction direction, int steps) Moves chunk coordinates a number of steps in the given direction.spaceMax()Returns the maximum coordinates for chunks for each axis.spaceMin()Returns the minimum coordinates for chunks for each axis.Returns the origin of the chunk coordinate space.Gets the total size of the chunk space, which is equivalent tospaceMax()-spaceMin()+ 1.toChunk(int x, int y, int z) Converts world coordinates to chunk coordinates.Converts world coordinates to chunk coordinates.toWorld(int x, int y, int z) Converts chunk coordinates to world coordinates.Converts chunk coordinates to world coordinates.
- 
Method Details- 
chunkSizeVector3i chunkSize()Returns the size of the chunks in blocks. The axes are matched to the corresponding vector components.- Returns:
- The size of chunks
 
- 
spaceMaxVector3i spaceMax()Returns the maximum coordinates for chunks for each axis. The axes are matched to the corresponding vector components. Due to the limited precision of 32bit integers, there always is a practical limit.- Returns:
- The maximum coordinates of chunks
 
- 
spaceMinVector3i spaceMin()Returns the minimum coordinates for chunks for each axis. The axes are matched to the corresponding vector components. Due to the limited precision of 32bit integers, there always is a practical limit.- Returns:
- The minimum coordinates of chunks
 
- 
spaceSizeVector3i spaceSize()Gets the total size of the chunk space, which is equivalent tospaceMax()-spaceMin()+ 1.- Returns:
- The total size of the chunk space
 
- 
spaceOriginVector3i spaceOrigin()Returns the origin of the chunk coordinate space. NormallyVector3i.ZERO.- Returns:
- The origin of the chunk coordinate space
 
- 
isValidChunkReturns true if the coordinates are valid chunk coordinates. False if otherwise.- Parameters:
- coords- The coordinates to validate
- Returns:
- Whether or not the coordinates are valid for chunks
 
- 
isValidChunkdefault boolean isValidChunk(int x, int y, int z) Returns true if the coordinates are valid chunk coordinates. False if otherwise.- Parameters:
- x- The x coordinate to validate
- y- The y coordinate to validate
- z- The z coordinate to validate
- Returns:
- Whether or not the coordinates are valid for chunks
 
- 
isInChunkReturns true if the local coordinates fit in a chunk. That is they are positive and smaller than the chunk's size.- Parameters:
- localCoords- The coordinates to check
- Returns:
- Whether or not the coordinates fit in a chunk
 
- 
isInChunkboolean isInChunk(int x, int y, int z) Returns true if the local coordinates fit in a chunk. That is they are positive and smaller than the chunk's size.- Parameters:
- x- The x local coordinate to validate
- y- The y local coordinate to validate
- z- The z local coordinate to validate
- Returns:
- Whether or not the coordinates fit in a chunk
 
- 
isInChunkReturns true if the world coordinates fit in the chunk at the given coordinates.- Parameters:
- worldCoords- The world coordinates to validate
- chunkCoords- The chunk coordinates in which they must fit
- Returns:
- Whether or not the world coordinates fit in the chunk
 
- 
isInChunkboolean isInChunk(int wx, int wy, int wz, int cx, int cy, int cz) Returns true if the world coordinates fit in the chunk at the given coordinates.- Parameters:
- wx- The x world coordinate to validate
- wy- The y world coordinate to validate
- wz- The z world coordinate to validate
- cx- The x chunk coordinate in which they must fit
- cy- The y chunk coordinate in which they must fit
- cz- The z chunk coordinate in which they must fit
- Returns:
- Whether or not the world coordinates fit in the chunk
 
- 
toChunkConverts world coordinates to chunk coordinates. Returns nothing if the conversion failed because the resulting chunk coordinates aren't valid.- Parameters:
- worldCoords- The world coordinates to convert to chunk coordinates
- Returns:
- The chunk coordinates on success, else nothing
 
- 
toChunkConverts world coordinates to chunk coordinates. Returns nothing if the conversion failed because the resulting chunk coordinates aren't valid.- Parameters:
- x- The x world coordinate to convert to chunk coordinates
- y- The y world coordinate to convert to chunk coordinates
- z- The z world coordinate to convert to chunk coordinates
- Returns:
- The chunk coordinates on success, else nothing
 
- 
toWorldConverts chunk coordinates to world coordinates. Returns nothing if the conversion failed because the given chunk coordinates aren't valid.- Parameters:
- chunkCoords- The chunk coordinates to convert to world coordinates
- Returns:
- The world coordinates on success, else nothing
 
- 
toWorldConverts chunk coordinates to world coordinates. Returns nothing if the conversion failed because the given chunk coordinates aren't valid.- Parameters:
- x- The x chunk coordinate to convert to world coordinates
- y- The y chunk coordinate to convert to world coordinates
- z- The z chunk coordinate to convert to world coordinates
- Returns:
- The world coordinates on success, else nothing
 
- 
forceToChunkConverts world coordinates to chunk coordinates. This method never fails and can returns invalid chunk coordinates.- Parameters:
- worldCoords- The world coordinates to convert to chunk coordinates
- Returns:
- The chunk coordinates
 
- 
forceToChunkConverts world coordinates to chunk coordinates. This method never fails and can return invalid chunk coordinates.- Parameters:
- x- The x world coordinate to convert to chunk coordinates
- y- The y world coordinate to convert to chunk coordinates
- z- The z world coordinate to convert to chunk coordinates
- Returns:
- The chunk coordinates
 
- 
forceToWorldConverts chunk coordinates to world coordinates. This method never fails and can returns invalid world coordinates.- Parameters:
- chunkCoords- The chunk coordinates to convert to world coordinates
- Returns:
- The world coordinates
 
- 
forceToWorldConverts chunk coordinates to world coordinates. This method never fails and can returns invalid world coordinates.- Parameters:
- x- The x chunk coordinate to convert to world coordinates
- y- The y chunk coordinate to convert to world coordinates
- z- The z chunk coordinate to convert to world coordinates
- Returns:
- The world coordinates
 
- 
addToChunkAdds the chunk offset to the chunk coordinates. Returns nothing if the new coordinates are not valid.- Parameters:
- chunkCoords- The chunk coordinates to add to
- chunkOffset- The chunk offset to add to the chunk coordinates
- Returns:
- The new chunk coordinates if they are valid
 
- 
addToChunkAdds the chunk offset to the chunk coordinates. Returns nothing if the new coordinates are not valid.- Parameters:
- cx- The x chunk coordinate to add to
- cy- The y chunk coordinate to add to
- cz- The z chunk coordinate to add to
- ox- The x chunk offset to add to the chunk coordinates
- oy- The y chunk offset to add to the chunk coordinates
- oz- The z chunk offset to add to the chunk coordinates
- Returns:
- The new chunk coordinates if they are valid
 
- 
moveToChunkMoves chunk coordinates one step in the given direction. Returns nothing if the new coordinates are not valid.Direction.Division.SECONDARY_ORDINALdirections are not a valid argument. These will throw an exception.- Parameters:
- chunkCoords- The chunk coordinates to move from
- direction- The direction in which to move a step
- Returns:
- The new chunk coordinates if they are valid
- Throws:
- IllegalArgumentException- If the direction is a- Direction.Division.SECONDARY_ORDINAL
 
- 
moveToChunkMoves chunk coordinates one step in the given direction. Returns nothing if the new coordinates are not valid.Direction.Division.SECONDARY_ORDINALdirections are not a valid argument. These will throw an exception.- Parameters:
- x- The x chunk coordinate to move from
- y- The y chunk coordinate to move from
- z- The z chunk coordinate to move from
- direction- The direction in which to move a step
- Returns:
- The new chunk coordinates if they are valid
- Throws:
- IllegalArgumentException- If the direction is a- Direction.Division.SECONDARY_ORDINAL
 
- 
moveToChunkMoves chunk coordinates a number of steps in the given direction. Returns nothing if the new coordinates are not valid.Direction.Division.SECONDARY_ORDINALdirections are not a valid argument. These will throw an exception.- Parameters:
- chunkCoords- The chunk coordinates to move from
- direction- The direction in which to move
- steps- The number of steps to take
- Returns:
- The new chunk coordinates if they are valid
- Throws:
- IllegalArgumentException- If the direction is a- Direction.Division.SECONDARY_ORDINAL
 
- 
moveToChunkMoves chunk coordinates a number of steps in the given direction. Returns nothing if the new coordinates are not valid.Direction.Division.SECONDARY_ORDINALdirections are not a valid argument. These will throw an exception.- Parameters:
- x- The x chunk coordinate to move from
- y- The y chunk coordinate to move from
- z- The z chunk coordinate to move from
- direction- The direction in which to move
- steps- The number of steps to take
- Returns:
- The new chunk coordinates if they are valid
- Throws:
- IllegalArgumentException- If the direction is a- Direction.Division.SECONDARY_ORDINAL
 
 
-