Interface Chunk

All Superinterfaces:
SchedulerSource

public interface Chunk extends SchedulerSource
A loaded 16x16 column of a World.

Block coordinates taken by this interface are local on the X and Z axes (0 to 15) and absolute on the Y axis. Tasks scheduled through SchedulerSource run on the region thread owning this chunk.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    blockLight(int localX, int worldY, int localZ)
    Returns the block light level at a position of this chunk, between 0 and 15.
    int
    blockStateId(int localX, int worldY, int localZ)
    Gets the block state at a position of this chunk.
    int
    Returns the chunk X coordinate.
    int
    Returns the chunk Z coordinate.
    int
    Returns the number of block layers of this chunk, starting at minY().
    default boolean
    Whether this chunk is force-loaded.
    int
    lightLevel(int localX, int worldY, int localZ)
    Returns the effective light level at a position of this chunk, the highest of block and sky light.
    int
    Returns the lowest block Y coordinate of this chunk, inclusive.
    default ChunkPos
    pos()
    Returns the position of this chunk.
    setBlockStateId(int localX, int worldY, int localZ, int stateId)
    Replaces the block state at a position of this chunk, on the region thread owning it.
    int
    skyLight(int localX, int worldY, int localZ)
    Returns the sky light level at a position of this chunk, between 0 and 15.
    Returns the world this chunk belongs to.

    Methods inherited from interface SchedulerSource

    execute, executeDelayed, isOwnedByCurrentThread
  • Method Details

    • world

      World world()
      Returns the world this chunk belongs to.
      Returns:
      the world this chunk belongs to
      Since:
      0.1.0
    • chunkX

      int chunkX()
      Returns the chunk X coordinate.
      Returns:
      the chunk X coordinate
      Since:
      0.1.0
    • chunkZ

      int chunkZ()
      Returns the chunk Z coordinate.
      Returns:
      the chunk Z coordinate
      Since:
      0.1.0
    • pos

      default ChunkPos pos()
      Returns the position of this chunk.
      Returns:
      the position of this chunk
      Since:
      0.1.0
    • isForceLoaded

      default boolean isForceLoaded()
      Whether this chunk is force-loaded.
      Returns:
      true if this chunk is force-loaded
      Since:
      0.1.0
      See Also:
    • minY

      int minY()
      Returns the lowest block Y coordinate of this chunk, inclusive.
      Returns:
      the lowest block Y coordinate of this chunk, inclusive
      Since:
      0.1.0
    • height

      int height()
      Returns the number of block layers of this chunk, starting at minY().
      Returns:
      the number of block layers of this chunk, starting at minY()
      Since:
      0.1.0
    • blockStateId

      int blockStateId(int localX, int worldY, int localZ)
      Gets the block state at a position of this chunk.
      Parameters:
      localX - the X coordinate inside the chunk, 0 to 15
      worldY - the absolute Y coordinate
      localZ - the Z coordinate inside the chunk, 0 to 15
      Returns:
      the network identifier of the block state
      Since:
      0.1.0
    • setBlockStateId

      CompletableFuture<Boolean> setBlockStateId(int localX, int worldY, int localZ, int stateId)
      Replaces the block state at a position of this chunk, on the region thread owning it.
      Parameters:
      localX - the X coordinate inside the chunk, 0 to 15
      worldY - the absolute Y coordinate
      localZ - the Z coordinate inside the chunk, 0 to 15
      stateId - the network identifier of the new block state
      Returns:
      a future completing with true if the block changed
      Since:
      0.1.0
    • blockLight

      int blockLight(int localX, int worldY, int localZ)
      Returns the block light level at a position of this chunk, between 0 and 15.
      Parameters:
      localX - the X coordinate inside the chunk
      worldY - the absolute Y coordinate
      localZ - the Z coordinate inside the chunk
      Returns:
      the block light level at a position of this chunk, between 0 and 15
      Since:
      0.1.0
    • skyLight

      int skyLight(int localX, int worldY, int localZ)
      Returns the sky light level at a position of this chunk, between 0 and 15.
      Parameters:
      localX - the X coordinate inside the chunk
      worldY - the absolute Y coordinate
      localZ - the Z coordinate inside the chunk
      Returns:
      the sky light level at a position of this chunk, between 0 and 15
      Since:
      0.1.0
    • lightLevel

      int lightLevel(int localX, int worldY, int localZ)
      Returns the effective light level at a position of this chunk, the highest of block and sky light.
      Parameters:
      localX - the X coordinate inside the chunk
      worldY - the absolute Y coordinate
      localZ - the Z coordinate inside the chunk
      Returns:
      the effective light level at a position of this chunk, the highest of block and sky light
      Since:
      0.1.0