Class CPUOptimizedClipboard

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

public class CPUOptimizedClipboard extends LinearClipboard
  • Constructor Details

    • CPUOptimizedClipboard

      public CPUOptimizedClipboard(Region region)
  • 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(BlockVector2) strongly suggests returning BiomeTypes.OCEAN instead of null if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting to ocean, instead of having biomes explicitly set.
      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:
    • convertTilesToIndex

      public void convertTilesToIndex()
    • getBiomeIndex

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

      public int getIndex(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)
    • getTileEntities

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

      public boolean setTile(int x, int y, int z, CompoundTag tag)
    • 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
    • createEntity

      @Nullable public Entity createEntity(Location location, BaseEntity entity)
      Description copied from interface: Extent
      Create an entity at the given location.
      Parameters:
      location - the location
      entity - the entity
      Returns:
      a reference to the created entity, or null if the entity could not be created
    • getEntities

      public List<? extends Entity> getEntities()
      Description copied from interface: Extent
      Get a list of all entities.

      If the extent is not wholly loaded (i.e. a world being simulated in the game will not have every chunk loaded), then this list may not be incomplete.

      Returns:
      a list of entities
    • removeEntity

      public void removeEntity(Entity entity)
      Description copied from interface: Clipboard
      Remove entity from clipboard.