Interface IBlocks

All Superinterfaces:
Trimable
All Known Subinterfaces:
IChunk, IChunkGet, IChunkSet, IQueueChunk<T>
All Known Implementing Classes:
BitSetBlocks, CharBlocks, CharGetBlocks, CharSetBlocks, ChunkHolder, NullChunk, NullChunkGet, ThreadUnsafeCharBlocks

public interface IBlocks extends Trimable
A shared interface for IGetBlocks and ISetBlocks.
  • Method Details

    • hasSection

      boolean hasSection(int layer)
      Returns if the chunk has a BLOCKS section at the given layer. May not be indicative of presence of entities, tile entites, biomes, etc.
      Parameters:
      layer - chunk section layer
      Returns:
      if blocks/a block section is present
    • load

      char[] load(int layer)
      Obtain the specified chunk section stored as an array of ordinals. Uses normal minecraft chunk-section position indices (length 4096). Operations synchronises on the section and will load the section into memory if not present. For chunk GET operations, this will load the data from the world. For chunk SET, this will create a new empty array.
      Parameters:
      layer - chunk section layer (may be negative)
      Returns:
      char array of ordinals of the chunk section
    • loadIfPresent

      @Nullable char[] loadIfPresent(int layer)
      Obtain the specified chunk section stored as an array of ordinals if present or null. Uses normal minecraft chunk-section position indices (length 4096). Does not synchronise to the section layer as it will not attempt to load into memory.
      Parameters:
      layer - chunk section layer (may be negative)
      Returns:
      char array of ordinals of the chunk section if present
    • getBlock

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

      @Deprecated(forRemoval=true, since="2.11.2") default Map<BlockVector3,CompoundTag> getTiles()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • tiles

    • getTile

      @Deprecated(forRemoval=true, since="2.11.2") default CompoundTag getTile(int x, int y, int z)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • tile

      @Nullable FaweCompoundTag tile(int x, int y, int z)
    • getEntities

      @Deprecated(forRemoval=true, since="2.11.2") default Set<CompoundTag> getEntities()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • entities

    • getBiomeType

      BiomeType getBiomeType(int x, int y, int z)
    • getBitMask

      default int getBitMask()
    • removeSectionLighting

      void removeSectionLighting(int layer, boolean sky)
    • trim

      boolean trim(boolean aggressive, int layer)
    • reset

      IBlocks reset()
    • getSectionCount

      int getSectionCount()
      Get the number of stored sections
    • getMaxSectionPosition

      int getMaxSectionPosition()
      Get the highest layer position stored in the internal chunk. For 1.16 and below, always returns 15. For 1.17 and above, may not return a value correct to the world if this is a IChunkSet instance, which defaults to 15. For extended height worlds, this will only return over 15 if blocks are stored outside the default range.
    • getMinSectionPosition

      int getMinSectionPosition()
      Get the lowest layer position stored in the internal chunk. For 1.16 and below, always returns 0. For 1.17 and above, may not return a value correct to the world if this is a IChunkSet instance, which defaults to 0. For extended height worlds, this will only return under 0 if blocks are stored outside the default range.
    • toByteArray

      default byte[] toByteArray(boolean full, boolean stretched)
    • toByteArray

      default byte[] toByteArray(byte[] buffer, int bitMask, boolean full, boolean stretched)