Interface Chunk

All Superinterfaces:
Comparable<Chunk>
All Known Implementing Classes:
LockableChunk

public interface Chunk extends Comparable<Chunk>
  • Field Details

  • Method Details

    • getOrCreateSection

      ChunkSection getOrCreateSection(@org.checkerframework.checker.index.qual.NonNegative int y)
    • getSection

      @Nullable ChunkSection getSection(@org.checkerframework.checker.index.qual.NonNegative int y)
    • getSections

      ChunkSection[] getSections()
    • getBlock

      default BlockState getBlock(int x, int y, int z)
    • getBlock

      BlockState getBlock(int x, int y, int z, @org.checkerframework.checker.index.qual.NonNegative int layer)
    • getAndSetBlock

      default BlockState getAndSetBlock(int x, int y, int z, BlockState blockState)
    • getAndSetBlock

      BlockState getAndSetBlock(int x, int y, int z, @org.checkerframework.checker.index.qual.NonNegative int layer, BlockState blockState)
    • setBlock

      default void setBlock(int x, int y, int z, BlockState blockState)
    • setBlock

      void setBlock(int x, int y, int z, @org.checkerframework.checker.index.qual.NonNegative int layer, BlockState blockState)
    • getBiome

      int getBiome(int x, int z)
    • setBiome

      void setBiome(int x, int z, int biome)
    • getSkyLight

      byte getSkyLight(int x, int y, int z)
    • setSkyLight

      void setSkyLight(int x, int y, int z, @org.checkerframework.checker.index.qual.NonNegative int level)
    • getBlockLight

      byte getBlockLight(int x, int y, int z)
    • setBlockLight

      void setBlockLight(int x, int y, int z, @org.checkerframework.checker.index.qual.NonNegative int level)
    • getHighestBlock

      int getHighestBlock(int x, int z)
    • addEntity

      void addEntity(@NonNull Entity entity)
    • removeEntity

      void removeEntity(Entity entity)
    • addBlockEntity

      void addBlockEntity(BlockEntity blockEntity)
    • removeBlockEntity

      void removeBlockEntity(BlockEntity blockEntity)
    • getBlockEntity

      BlockEntity getBlockEntity(int x, int y, int z)
    • getX

      int getX()
      Get the chunk's X coordinate in the level it was loaded.
      Returns:
      chunk x
    • getZ

      int getZ()
      Get the chunk's Z coordinate in the level it was loaded.
      Returns:
      chunk z
    • getLevel

      Level getLevel()
      Get the level the chunk was loaded in.
      Returns:
      chunk level
    • getBiomeArray

      byte[] getBiomeArray()
      Get the copy of the biome array.
      Returns:
      biome array
    • getHeightMapArray

      int[] getHeightMapArray()
      Get a copy of the height map array.
      Returns:
      height map
    • getPlayers

      Set<? extends Player> getPlayers()
      Gets an immutable copy of players currently in this chunk
      Returns:
      player set
    • getEntities

      Set<? extends Entity> getEntities()
      Gets an immutable copy of entities currently in this chunk
      Returns:
      entity set
    • getBlockEntities

      Set<? extends BlockEntity> getBlockEntities()
      Gets an immutable copy of all block entities within the current chunk.
      Returns:
      block entity set
    • getState

      int getState()
      Gets this chunk's current state.
    • setState

      int setState(int next)
      Atomically updates this chunk's state.
      Parameters:
      next - the new state to set
      Returns:
      the chunk's previous state
      Throws:
      IllegalStateException - if the new state is invalid, or the same as or lower than the current state
    • isGenerated

      default boolean isGenerated()
    • isPopulated

      default boolean isPopulated()
    • isFinished

      default boolean isFinished()
    • isDirty

      boolean isDirty()
      Whether the chunk has changed since it was last loaded or saved.
      Returns:
      dirty
    • setDirty

      default void setDirty()
      Sets the chunk's dirty status.
    • setDirty

      void setDirty(boolean dirty)
      Sets the chunk's dirty status.
      Parameters:
      dirty - true if chunk is dirty
    • clearDirty

      boolean clearDirty()
      Atomically resets this chunk's dirty status.
      Returns:
      whether or not the chunk was previously dirty
    • clear

      void clear()
      Clear chunk to a state as if it was not generated.
    • key

      default long key()
      Returns:
      this chunk's key
    • compareTo

      default int compareTo(Chunk o)
      Specified by:
      compareTo in interface Comparable<Chunk>
    • readLockable

      LockableChunk readLockable()
    • writeLockable

      LockableChunk writeLockable()
    • close

      void close()
    • getLoaders

      Set<? extends ChunkLoader> getLoaders()
    • getPlayerLoaders

      Set<? extends Player> getPlayerLoaders()