Class CloudChunk

java.lang.Object
org.cloudburstmc.server.level.chunk.CloudChunk
All Implemented Interfaces:
Closeable, AutoCloseable, Comparable<org.cloudburstmc.api.level.chunk.Chunk>, org.cloudburstmc.api.level.chunk.Chunk

@ThreadSafe @ParametersAreNonnullByDefault public final class CloudChunk extends Object implements org.cloudburstmc.api.level.chunk.Chunk, Closeable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
     

    Fields inherited from interface org.cloudburstmc.api.level.chunk.Chunk

    STATE_FINISHED, STATE_GENERATED, STATE_NEW, STATE_POPULATED
  • Constructor Summary

    Constructors
    Constructor
    Description
    CloudChunk​(int x, int z, org.cloudburstmc.api.level.Level level)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBlockEntity​(org.cloudburstmc.api.blockentity.BlockEntity blockEntity)
     
    void
    addEntity​(org.cloudburstmc.api.entity.Entity entity)
     
    void
    addLoader​(org.cloudburstmc.api.level.ChunkLoader chunkLoader)
     
    static short
    blockKey​(int x, int y, int z)
     
    static int
    blockKey​(int x, int y, int z, int layer)
     
    static short
    blockKey​(com.nukkitx.math.vector.Vector3i vector)
     
    void
     
    boolean
     
    void
     
    com.nukkitx.protocol.bedrock.packet.LevelChunkPacket
     
    static com.nukkitx.math.vector.Vector4i
    fromKey​(long chunkKey, int blockKey)
     
    static com.nukkitx.math.vector.Vector3i
    fromKey​(long chunkKey, short blockKey)
     
    static int
    fromKeyX​(long key)
     
    static int
    fromKeyZ​(long key)
     
    org.cloudburstmc.api.block.BlockState
    getAndSetBlock​(int x, int y, int z, int layer, org.cloudburstmc.api.block.BlockState blockState)
     
    int
    getBiome​(int x, int z)
     
    byte[]
     
    org.cloudburstmc.api.block.BlockState
    getBlock​(int x, int y, int z, int layer)
     
     
    org.cloudburstmc.api.blockentity.BlockEntity
    getBlockEntity​(int x, int y, int z)
     
    byte
    getBlockLight​(int x, int y, int z)
     
     
    int[]
     
    int
    getHighestBlock​(int x, int z)
     
    org.cloudburstmc.api.level.Level
     
    Set<org.cloudburstmc.api.level.ChunkLoader>
     
    org.cloudburstmc.api.level.chunk.ChunkSection
     
     
     
    org.cloudburstmc.api.level.chunk.ChunkSection
    getSection​(int y)
     
    org.cloudburstmc.api.level.chunk.ChunkSection[]
     
    byte
    getSkyLight​(int x, int y, int z)
     
    int
     
    int
     
    int
     
    void
     
    boolean
     
    static long
    key​(int x, int z)
     
    org.cloudburstmc.api.level.chunk.LockableChunk
     
    void
    removeBlockEntity​(org.cloudburstmc.api.blockentity.BlockEntity blockEntity)
     
    void
    removeEntity​(org.cloudburstmc.api.entity.Entity entity)
     
    void
    removeLoader​(org.cloudburstmc.api.level.ChunkLoader chunkLoader)
     
    void
    setBiome​(int x, int z, int biome)
     
    void
    setBlock​(int x, int y, int z, int layer, org.cloudburstmc.api.block.BlockState blockState)
     
    void
    setBlockLight​(int x, int y, int z, int level)
     
    void
    setDirty​(boolean dirty)
     
    void
    setSkyLight​(int x, int y, int z, int level)
     
    int
    setState​(int next)
     
    void
    tick​(int tick)
     
    org.cloudburstmc.api.level.chunk.LockableChunk
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.cloudburstmc.api.level.chunk.Chunk

    compareTo, getAndSetBlock, getBlock, isFinished, isGenerated, isPopulated, key, setBlock, setDirty
  • Field Details

  • Constructor Details

    • CloudChunk

      public CloudChunk(int x, int z, org.cloudburstmc.api.level.Level level)
  • Method Details

    • init

      public void init()
    • getOrCreateSection

      @Nonnull public org.cloudburstmc.api.level.chunk.ChunkSection getOrCreateSection(int y)
      Specified by:
      getOrCreateSection in interface org.cloudburstmc.api.level.chunk.Chunk
    • getSection

      @Nullable public org.cloudburstmc.api.level.chunk.ChunkSection getSection(int y)
      Specified by:
      getSection in interface org.cloudburstmc.api.level.chunk.Chunk
    • getSections

      @Nonnull public org.cloudburstmc.api.level.chunk.ChunkSection[] getSections()
      Specified by:
      getSections in interface org.cloudburstmc.api.level.chunk.Chunk
    • getBlock

      @Nonnull public org.cloudburstmc.api.block.BlockState getBlock(int x, int y, int z, int layer)
      Specified by:
      getBlock in interface org.cloudburstmc.api.level.chunk.Chunk
    • getAndSetBlock

      @Nonnull public org.cloudburstmc.api.block.BlockState getAndSetBlock(int x, int y, int z, int layer, org.cloudburstmc.api.block.BlockState blockState)
      Specified by:
      getAndSetBlock in interface org.cloudburstmc.api.level.chunk.Chunk
    • setBlock

      public void setBlock(int x, int y, int z, int layer, org.cloudburstmc.api.block.BlockState blockState)
      Specified by:
      setBlock in interface org.cloudburstmc.api.level.chunk.Chunk
    • getBiome

      public int getBiome(int x, int z)
      Specified by:
      getBiome in interface org.cloudburstmc.api.level.chunk.Chunk
    • setBiome

      public void setBiome(int x, int z, int biome)
      Specified by:
      setBiome in interface org.cloudburstmc.api.level.chunk.Chunk
    • getSkyLight

      public byte getSkyLight(int x, int y, int z)
      Specified by:
      getSkyLight in interface org.cloudburstmc.api.level.chunk.Chunk
    • setSkyLight

      public void setSkyLight(int x, int y, int z, int level)
      Specified by:
      setSkyLight in interface org.cloudburstmc.api.level.chunk.Chunk
    • getBlockLight

      public byte getBlockLight(int x, int y, int z)
      Specified by:
      getBlockLight in interface org.cloudburstmc.api.level.chunk.Chunk
    • setBlockLight

      public void setBlockLight(int x, int y, int z, int level)
      Specified by:
      setBlockLight in interface org.cloudburstmc.api.level.chunk.Chunk
    • getHighestBlock

      public int getHighestBlock(int x, int z)
      Specified by:
      getHighestBlock in interface org.cloudburstmc.api.level.chunk.Chunk
    • addEntity

      public void addEntity(@Nonnull org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      addEntity in interface org.cloudburstmc.api.level.chunk.Chunk
    • removeEntity

      public void removeEntity(org.cloudburstmc.api.entity.Entity entity)
      Specified by:
      removeEntity in interface org.cloudburstmc.api.level.chunk.Chunk
    • blockKey

      public static short blockKey(com.nukkitx.math.vector.Vector3i vector)
    • blockKey

      public static short blockKey(int x, int y, int z)
    • fromKey

      public static com.nukkitx.math.vector.Vector3i fromKey(long chunkKey, short blockKey)
    • getX

      public int getX()
      Specified by:
      getX in interface org.cloudburstmc.api.level.chunk.Chunk
    • getZ

      public int getZ()
      Specified by:
      getZ in interface org.cloudburstmc.api.level.chunk.Chunk
    • getLevel

      @Nonnull public org.cloudburstmc.api.level.Level getLevel()
      Specified by:
      getLevel in interface org.cloudburstmc.api.level.chunk.Chunk
    • getBiomeArray

      @Nonnull public byte[] getBiomeArray()
      Specified by:
      getBiomeArray in interface org.cloudburstmc.api.level.chunk.Chunk
    • getHeightMapArray

      @Nonnull public int[] getHeightMapArray()
      Specified by:
      getHeightMapArray in interface org.cloudburstmc.api.level.chunk.Chunk
    • getPlayers

      @Nonnull public Set<CloudPlayer> getPlayers()
      Specified by:
      getPlayers in interface org.cloudburstmc.api.level.chunk.Chunk
    • getEntities

      @Nonnull public Set<BaseEntity> getEntities()
      Specified by:
      getEntities in interface org.cloudburstmc.api.level.chunk.Chunk
    • fromKey

      public static com.nukkitx.math.vector.Vector4i fromKey(long chunkKey, int blockKey)
    • getState

      public int getState()
      Specified by:
      getState in interface org.cloudburstmc.api.level.chunk.Chunk
    • setState

      public int setState(int next)
      Specified by:
      setState in interface org.cloudburstmc.api.level.chunk.Chunk
    • isDirty

      public boolean isDirty()
      Specified by:
      isDirty in interface org.cloudburstmc.api.level.chunk.Chunk
    • clearDirty

      public boolean clearDirty()
      Specified by:
      clearDirty in interface org.cloudburstmc.api.level.chunk.Chunk
    • addLoader

      public void addLoader(org.cloudburstmc.api.level.ChunkLoader chunkLoader)
    • removeLoader

      public void removeLoader(org.cloudburstmc.api.level.ChunkLoader chunkLoader)
    • getLoaders

      @Nonnull public Set<org.cloudburstmc.api.level.ChunkLoader> getLoaders()
      Specified by:
      getLoaders in interface org.cloudburstmc.api.level.chunk.Chunk
    • getPlayerLoaders

      @Nonnull public Set<CloudPlayer> getPlayerLoaders()
      Specified by:
      getPlayerLoaders in interface org.cloudburstmc.api.level.chunk.Chunk
    • tick

      public void tick(int tick)
    • readLockable

      public org.cloudburstmc.api.level.chunk.LockableChunk readLockable()
      Specified by:
      readLockable in interface org.cloudburstmc.api.level.chunk.Chunk
    • writeLockable

      public org.cloudburstmc.api.level.chunk.LockableChunk writeLockable()
      Specified by:
      writeLockable in interface org.cloudburstmc.api.level.chunk.Chunk
    • clear

      public void clear()
      Specified by:
      clear in interface org.cloudburstmc.api.level.chunk.Chunk
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.cloudburstmc.api.level.chunk.Chunk
      Specified by:
      close in interface Closeable
    • addBlockEntity

      public void addBlockEntity(org.cloudburstmc.api.blockentity.BlockEntity blockEntity)
      Specified by:
      addBlockEntity in interface org.cloudburstmc.api.level.chunk.Chunk
    • removeBlockEntity

      public void removeBlockEntity(org.cloudburstmc.api.blockentity.BlockEntity blockEntity)
      Specified by:
      removeBlockEntity in interface org.cloudburstmc.api.level.chunk.Chunk
    • blockKey

      public static int blockKey(int x, int y, int z, int layer)
    • getBlockEntity

      public org.cloudburstmc.api.blockentity.BlockEntity getBlockEntity(int x, int y, int z)
      Specified by:
      getBlockEntity in interface org.cloudburstmc.api.level.chunk.Chunk
    • getBlockEntities

      @Nonnull public Set<BaseBlockEntity> getBlockEntities()
      Specified by:
      getBlockEntities in interface org.cloudburstmc.api.level.chunk.Chunk
    • key

      public static long key(int x, int z)
    • fromKeyX

      public static int fromKeyX(long key)
    • fromKeyZ

      public static int fromKeyZ(long key)
    • setDirty

      public void setDirty(boolean dirty)
      Specified by:
      setDirty in interface org.cloudburstmc.api.level.chunk.Chunk
    • createChunkPacket

      @Nonnull public com.nukkitx.protocol.bedrock.packet.LevelChunkPacket createChunkPacket()