Interface ChunkVolume

All Superinterfaces:
Volume
All Known Subinterfaces:
ClientWorld, GenerationRegion, Region<R>, ServerWorld, World<W,L>, WorldLike<P>

public interface ChunkVolume extends Volume
Presents a volume of Chunks that can exist without a WorldLike volume.
  • Method Summary

    Modifier and Type
    Method
    Description
    Chunk<? extends @NonNull Object>
    chunk(int x, int y, int z)
    Gets the loaded chunk at the given chunk coordinate position.
    default Chunk<? extends @NonNull Object>
    chunk(Vector3i chunkPosition)
    Gets the loaded chunk at the given chunk coordinate position.
    Chunk<? extends @NonNull Object>
    chunkAtBlock(int bx, int by, int bz)
    Gets the loaded chunk at the given chunk coordinate position.
    default Chunk<? extends @NonNull Object>
    chunkAtBlock(Vector3i blockPosition)
    Gets the loaded chunk at the given block coordinate position.
    Returns information about the chunk layout used by this volume's implementation.
    boolean
    hasChunk(int cx, int cy, int cz)
    Gets whether a Chunk exists at the particular chunk coordinates.
    default boolean
    hasChunk(Vector3i chunkPosition)
    Gets whether a Chunk exists at the particular block coordinates.
    default boolean
    hasChunkAtBlock(int bx, int by, int bz)
    Gets whether a Chunk exists at the particular block coordinates.
    default boolean
    hasChunkAtBlock(Vector3i blockPosition)
    Gets whether a Chunk exists at the particular block coordinates.
    boolean
    isChunkLoaded(int cx, int cy, int cz, boolean allowEmpty)
    Gets whether a Chunk is loaded at the particular chunk coordinates.
    default boolean
    isChunkLoaded(Vector3i chunkPosition, boolean allowEmpty)
    Gets whether a Chunk is loaded at the particular chunk coordinates.
    default boolean
    isChunkLoadedAtBlock(int bx, int by, int bz, boolean allowEmpty)
    Gets whether a Chunk is loaded at the particular block coordinates.
    default boolean
    isChunkLoadedAtBlock(Vector3i position, boolean allowEmpty)
    Gets whether a Chunk is loaded at the particular block coordinates.

    Methods inherited from interface org.spongepowered.api.world.volume.Volume

    available, contains, contains, isAreaAvailable, max, min, size
  • Method Details

    • chunkLayout

      ChunkLayout chunkLayout()
      Returns information about the chunk layout used by this volume's implementation. May differ based on the Server.chunkLayout() used on the server.
      Returns:
      The chunk layout used by the implementation
    • chunk

      Chunk<? extends @NonNull Object> chunk(int x, int y, int z)
      Gets the loaded chunk at the given chunk coordinate position. The position is the same as Chunk.chunkPosition(). The difference between a block placed within a WorldLike is different from a Chunk's position, and therefore care should be taken when requesting a chunk. It is not guaranteed that the returned Chunk is empty or not, nor the state of the chunk.

      In Vanilla, the y coordinate will always be 0.

      Parameters:
      x - The x coordinate
      y - The y coordinate
      z - The z coordinate
      Returns:
      The chunk, may be empty
    • chunk

      default Chunk<? extends @NonNull Object> chunk(Vector3i chunkPosition)
      Gets the loaded chunk at the given chunk coordinate position. The position is the same as Chunk.chunkPosition(). The difference between a block placed within a WorldLike is different from a Chunk's position, and therefore care should be taken when requesting a chunk. It is not guaranteed that the returned Chunk is empty or not, nor the state of the chunk.
      Parameters:
      chunkPosition - The position
      Returns:
      The chunk, if available
    • chunkAtBlock

      default Chunk<? extends @NonNull Object> chunkAtBlock(Vector3i blockPosition)
      Gets the loaded chunk at the given block coordinate position.
      Parameters:
      blockPosition - The position
      Returns:
      The chunk, if available
    • chunkAtBlock

      Chunk<? extends @NonNull Object> chunkAtBlock(int bx, int by, int bz)
      Gets the loaded chunk at the given chunk coordinate position. The position is the block position relative to the Chunk.chunkPosition(), and therefor is going to return a different chunk from chunk(Vector3i). This is more usable from ServerLocations or a Locatable that returns a position in relation to a WorldLike.
      Parameters:
      bx - The x coordinate
      by - The y coordinate
      bz - The z coordinate
      Returns:
      The chunk, if available
    • isChunkLoaded

      boolean isChunkLoaded(int cx, int cy, int cz, boolean allowEmpty)
      Gets whether a Chunk is loaded at the particular chunk coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      cx - The chunk x coordinate
      cy - The chunk y coordinate
      cz - The chunk z coordinate
      allowEmpty - Whether to allow empty chunks
      Returns:
      Whether a chunk is loaded or not
    • isChunkLoadedAtBlock

      default boolean isChunkLoadedAtBlock(int bx, int by, int bz, boolean allowEmpty)
      Gets whether a Chunk is loaded at the particular block coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      bx - The block x coordinate
      by - The block y coordinate
      bz - The block z coordinate
      allowEmpty - Whether to allow empty chunks
      Returns:
      Whether a chunk is loaded or not
    • isChunkLoaded

      default boolean isChunkLoaded(Vector3i chunkPosition, boolean allowEmpty)
      Gets whether a Chunk is loaded at the particular chunk coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      chunkPosition - The chunk coordinates
      allowEmpty - Whether to allow empty chunks
      Returns:
      Whether a chunk is loaded or not
    • isChunkLoadedAtBlock

      default boolean isChunkLoadedAtBlock(Vector3i position, boolean allowEmpty)
      Gets whether a Chunk is loaded at the particular block coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      position - The block coordinates
      allowEmpty - Whether to allow empty chunks
      Returns:
      Whether a chunk is loaded or not
    • hasChunk

      boolean hasChunk(int cx, int cy, int cz)
      Gets whether a Chunk exists at the particular chunk coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      cx - The chunk x coordinate
      cy - The chunk y coordinate
      cz - The chunk z coordinate
      Returns:
      Whether a chunk exists
    • hasChunkAtBlock

      default boolean hasChunkAtBlock(int bx, int by, int bz)
      Gets whether a Chunk exists at the particular block coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      bx - The block x coordinate
      by - The block y coordinate
      bz - The block z coordinate
      Returns:
      Whether a chunk exists
    • hasChunk

      default boolean hasChunk(Vector3i chunkPosition)
      Gets whether a Chunk exists at the particular block coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      chunkPosition - The chunk coordinates
      Returns:
      Whether a chunk exists
    • hasChunkAtBlock

      default boolean hasChunkAtBlock(Vector3i blockPosition)
      Gets whether a Chunk exists at the particular block coordinates. Note that chunk coordinates are distinctly different from block coordinates, refer to the chunkLayout() to convert back and forth.
      Parameters:
      blockPosition - The block coordinates
      Returns:
      Whether a chunk exists