Class MemoryOptimizedClipboard

All Implemented Interfaces:
Clipboard, Extent, InputExtent, OutputExtent, Closeable, Flushable, AutoCloseable, Iterable<BlockVector3>

public class MemoryOptimizedClipboard extends LinearClipboard
  • Constructor Details

    • MemoryOptimizedClipboard

      public MemoryOptimizedClipboard(Region region)
    • MemoryOptimizedClipboard

      public MemoryOptimizedClipboard(Region region, int compressionLevel)
  • Method Details

    • hasBiomes

      public boolean hasBiomes()
      Description copied from interface: Clipboard
      Returns true if the clipboard has biome data. This can be checked since InputExtent.getBiome(BlockVector3) strongly suggests returning BiomeTypes.OCEAN instead of null if biomes aren't present.
      Returns:
      true if the clipboard has biome data set
    • setBiome

      public boolean setBiome(BlockVector3 position, BiomeType biome)
      Description copied from interface: OutputExtent
      Set the biome.

      As implementation varies per Minecraft version, this may set more than this position's biome. On versions prior to 1.15, this will set the entire column. On later versions it will set the 4x4x4 cube.

      Parameters:
      position - the (x, y, z) location to set the biome at
      biome - the biome to set to
      Returns:
      true if the biome was successfully set (return value may not be accurate)
    • setBiome

      public boolean setBiome(int x, int y, int z, BiomeType biome)
    • setBiome

      public void setBiome(int index, BiomeType biome)
      Specified by:
      setBiome in class LinearClipboard
    • streamBiomes

      public void streamBiomes(IntValueReader task)
      Description copied from class: LinearClipboard
      The locations provided are relative to the clipboard min
      Specified by:
      streamBiomes in class LinearClipboard
    • getBiome

      public BiomeType getBiome(int index)
      Specified by:
      getBiome in class LinearClipboard
    • getBiomeType

      public BiomeType getBiomeType(int x, int y, int z)
    • getBiome

      public BiomeType getBiome(BlockVector3 position)
      Description copied from interface: InputExtent
      Get the biome at the given location.

      If there is no biome available, then the ocean biome should be returned.

      As implementation varies per Minecraft version, this may not exactly get this positions biome. On versions prior to 1.15, this will get the entire column. On later versions it will get the 4x4x4 cube's biome.

      Parameters:
      position - the (x, y, z) location to check the biome at
      Returns:
      the biome at the location
      See Also:
    • getTileEntities

      public Collection<CompoundTag> getTileEntities()
      Specified by:
      getTileEntities in class LinearClipboard
    • getIndex

      public int getIndex(int x, int y, int z)
    • getBiomeIndex

      public int getBiomeIndex(int x, int y, int z)
    • getFullBlock

      public BaseBlock getFullBlock(int x, int y, int z)
    • getFullBlock

      public BaseBlock getFullBlock(int index)
      Specified by:
      getFullBlock in class LinearClipboard
    • getBlock

      public BlockState getBlock(int index)
      Specified by:
      getBlock in class LinearClipboard
    • getBlock

      public BlockState getBlock(int x, int y, int z)
    • size

      public int size()
    • setTile

      public boolean setTile(int x, int y, int z, CompoundTag tag)
    • tile

      public boolean tile(int x, int y, int z, FaweCompoundTag tile) throws WorldEditException
      Description copied from interface: OutputExtent
      Sets a tile/block entity at the given location.
      Parameters:
      x - the x position
      y - the y position
      z - the z position
      tile - the tile/block entity to set
      Returns:
      true if the tile/block entity was placed
      Throws:
      WorldEditException
    • setBlock

      public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block)
    • setBlock

      public <B extends BlockStateHolder<B>> boolean setBlock(int index, B block)
      Specified by:
      setBlock in class LinearClipboard