Interface GeneratedChunk


public interface GeneratedChunk
The chunk a WorldGenerator fills.

X and Z coordinates are local to the chunk (0 to 15); Y coordinates are absolute. Out-of-range coordinates throw IllegalArgumentException.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    blockAt(int x, int y, int z)
    Reads back a block placed so far.
    int
    Returns the chunk X coordinate.
    int
    Returns the chunk Z coordinate.
    int
    Returns the number of block layers, starting at minY().
    int
    Returns the lowest block Y coordinate, inclusive.
    void
    setBiome(int x, int y, int z, Key biome)
    Sets the biome of the 4x4x4 cell holding a block.
    default void
    setBlock(int x, int y, int z, BlockData data)
    Places a block state.
    default void
    setBlock(int x, int y, int z, Key block)
    Places the default state of a block.
    void
    setBlock(int x, int y, int z, Key block, Map<String,String> properties)
    Places a block state.
  • Method Details

    • 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
    • minY

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

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

      default void setBlock(int x, int y, int z, Key block)
      Places the default state of a block.
      Parameters:
      x - the X coordinate inside the chunk, 0 to 15
      y - the absolute Y coordinate
      z - the Z coordinate inside the chunk, 0 to 15
      block - the block key
      Since:
      0.1.0
    • setBlock

      void setBlock(int x, int y, int z, Key block, Map<String,String> properties)
      Places a block state. Properties that are not given keep their default value.
      Parameters:
      x - the X coordinate inside the chunk, 0 to 15
      y - the absolute Y coordinate
      z - the Z coordinate inside the chunk, 0 to 15
      block - the block key
      properties - property name to value, e.g. half=upper
      Since:
      0.1.0
    • setBlock

      default void setBlock(int x, int y, int z, BlockData data)
      Places a block state.
      Parameters:
      x - the X coordinate inside the chunk, 0 to 15
      y - the absolute Y coordinate
      z - the Z coordinate inside the chunk, 0 to 15
      data - the block state
      Since:
      0.1.0
    • blockAt

      Key blockAt(int x, int y, int z)
      Reads back a block placed so far.
      Parameters:
      x - the X coordinate inside the chunk, 0 to 15
      y - the absolute Y coordinate
      z - the Z coordinate inside the chunk, 0 to 15
      Returns:
      the key of the block currently stored at the position
      Since:
      0.1.0
    • setBiome

      void setBiome(int x, int y, int z, Key biome)
      Sets the biome of the 4x4x4 cell holding a block.
      Parameters:
      x - the X coordinate inside the chunk, 0 to 15
      y - the absolute Y coordinate
      z - the Z coordinate inside the chunk, 0 to 15
      biome - the biome key, registered in the BiomeRegistry
      Since:
      0.1.0