Class UnsafeChunk

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

public final class UnsafeChunk extends Object implements org.cloudburstmc.api.level.chunk.Chunk, Closeable
  • Constructor Details

    • UnsafeChunk

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

    • init

      public boolean init()
    • getOrCreateSection

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

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

      @Nonnull public CloudChunkSection[] 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
    • 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
    • getBlockEntity

      @Nullable public org.cloudburstmc.api.blockentity.BlockEntity getBlockEntity(int x, int y, int z)
      Specified by:
      getBlockEntity in interface org.cloudburstmc.api.level.chunk.Chunk
    • 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()
      Gets an immutable copy of players currently in this chunk
      Specified by:
      getPlayers in interface org.cloudburstmc.api.level.chunk.Chunk
      Returns:
      player set
    • getEntities

      @Nonnull public Set<BaseEntity> getEntities()
      Gets an immutable copy of entities currently in this chunk
      Specified by:
      getEntities in interface org.cloudburstmc.api.level.chunk.Chunk
      Returns:
      entity set
    • getBlockEntities

      @Nonnull public Set<BaseBlockEntity> getBlockEntities()
      Gets an immutable copy of all block entities within the current chunk.
      Specified by:
      getBlockEntities in interface org.cloudburstmc.api.level.chunk.Chunk
      Returns:
      block entity collection
    • getState

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

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

      public boolean isDirty()
      Whether the chunk has changed since it was last loaded or saved.
      Specified by:
      isDirty in interface org.cloudburstmc.api.level.chunk.Chunk
      Returns:
      dirty
    • setDirty

      public void setDirty(boolean dirty)
      Sets the chunk's dirty status.
      Specified by:
      setDirty in interface org.cloudburstmc.api.level.chunk.Chunk
    • clearDirty

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

      public void clear()
      Clear chunk to a state as if it was not generated.
      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
    • getLoaders

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

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

      public long key()
      Specified by:
      key in interface org.cloudburstmc.api.level.chunk.Chunk
    • 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