Interface Extent

All Superinterfaces:
InputExtent, OutputExtent
All Known Subinterfaces:
Clipboard, IChunkExtent<T>, IQueueExtent<T>, ReorderingExtent, SimpleWorld, World
All Known Implementing Classes:
AbstractBufferingExtent, AbstractDelegateExtent, AbstractExtentFilterBlock, AbstractFilterBlock, AbstractSingleFilterBlock, AbstractWorld, ArrayFilterBlock, BiomeQuirkExtent, BlockArrayClipboard, BlockBagExtent, BlockChangeLimiter, BlockQuirkExtent, BlockTransformExtent, BlockTranslateExtent, ChangeSetExtent, CharFilterBlock, ChunkBatchingExtent, ChunkFilterBlock, ChunkLoadingExtent, CPUOptimizedClipboard, DataValidatorExtent, DisallowedBlocksExtent, DiskOptimizedClipboard, EditSession, EmptyClipboard, ExtentBatchProcessorHolder, ExtentBuffer, ExtentFilterBlock, ExtentHeightCacher, FaweRegionExtent, FilterBlock, ForgetfulExtentBuffer, FuzzyRegionSelector, HeightBoundExtent, HistoryExtent, LastAccessExtentCache, LimitExtent, Linear3DTransform, LinearClipboard, LinearTransform, MaskingExtent, MemoryCheckingExtent, MemoryOptimizedClipboard, MultiRegionExtent, MultiStageReorder, MultiTransform, NullExtent, NullExtent, NullWorld, OffsetTransform, ParallelQueueExtent, PassthroughExtent, PatternTransform, PositionTransformExtent, ProcessedWEExtent, RandomOffsetTransform, RandomTransform, ReadOnlyClipboard, RequestExtent, ResettableExtent, ScaleTransform, SelectTransform, SideEffectExtent, SimpleClipboard, SingleFilterBlock, SingleRegionExtent, SingleThreadQueueExtent, SlowExtent, SourceMaskExtent, StripNBTExtent, SupplyingExtent, SurvivalModeExtent, TemporalExtent, TracingExtent, TransformExtent, WatchdogTickingExtent, WorldCopyClipboard, WorldWrapper

public interface Extent extends InputExtent, OutputExtent
A world, portion of a world, clipboard, or other object that can have blocks set or entities placed.
See Also:
  • Method Details

    • getMinimumPoint

      BlockVector3 getMinimumPoint()
      Get the minimum point in the extent.

      If the extent is unbounded, then a large (negative) value may be returned.

      Returns:
      the minimum point
    • getMaximumPoint

      BlockVector3 getMaximumPoint()
      Get the maximum point in the extent.

      If the extent is unbounded, then a large (positive) value may be returned.

      Returns:
      the maximum point
    • getEntities

      default List<? extends Entity> getEntities(Region region)
      Get a list of all entities within the given region.

      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.

      Parameters:
      region - the region in which entities must be contained
      Returns:
      a list of entities
    • getEntities

      default List<? extends Entity> getEntities()
      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
    • createEntity

      @Nullable default Entity createEntity(Location location, BaseEntity entity)
      Create an entity at the given location.
      Parameters:
      entity - the entity
      location - the location
      Returns:
      a reference to the created entity, or null if the entity could not be created
    • removeEntity

      default void removeEntity(int x, int y, int z, UUID uuid)
      Create an entity at the given location.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
      uuid - the unique identifier of the entity
    • isQueueEnabled

      default boolean isQueueEnabled()
    • enableQueue

      default void enableQueue()
    • disableQueue

      default void disableQueue()
    • isWorld

      default boolean isWorld()
    • regenerateChunk

      default boolean regenerateChunk(int x, int z, @Nullable BiomeType type, @Nullable Long seed)
    • getHighestTerrainBlock

      default int getHighestTerrainBlock(int x, int z, int minY, int maxY)
      Returns the highest solid 'terrain' block.
      Parameters:
      x - the X coordinate
      z - the Z coordinate
      minY - minimal height
      maxY - maximal height
      Returns:
      height of highest block found or 'minY'
    • getHighestTerrainBlock

      default int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter)
      Returns the highest solid 'terrain' block.
      Parameters:
      x - the X coordinate
      z - the Z coordinate
      minY - minimal height
      maxY - maximal height
      filter - a mask of blocks to consider, or null to consider any solid (movement-blocking) block
      Returns:
      height of highest block found or 'minY'
    • getNearestSurfaceLayer

      default int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY)
      Returns the nearest surface layer (up/down from start)

      TODO: Someone understand this..?

      Parameters:
      x - x to search from
      z - y to search from
      y - z to search from
      minY - min y to search (inclusive)
      maxY - max y to search (inclusive)
      Returns:
      nearest surface layer
    • getNearestSurfaceTerrainBlock

      default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask)
      Gets y value for the nearest block that is considered the surface of the terrain (cave roof/floor, mountain surface, etc) where the block conforms to a given mask. Searches in the x,z column given.
      Parameters:
      x - column x
      z - column z
      y - start y
      minY - minimum y height to consider. Inclusive.
      maxY - maximum y height to consider. Inclusive.
      failedMin - if nothing found, the minimum y value to return if returning min
      failedMax - if nothing found, the maximum y value to return if returning max
      mask - mask to test blocks against
      Returns:
      The y value of the nearest terrain block
    • getNearestSurfaceTerrainBlock

      default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir)
      Gets y value for the nearest block that is considered the surface of the terrain (cave roof/floor, mountain surface, etc). Searches in the x,z column given.
      Parameters:
      x - column x
      z - column z
      y - start y
      minY - minimum y height to consider. Inclusive.
      maxY - maximum y height to consider. Inclusive.
      ignoreAir - if air at the final value if no block found should be considered for return, else return -1
      Returns:
      The y value of the nearest terrain block
    • getNearestSurfaceTerrainBlock

      default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY)
      Gets y value for the nearest block that is considered the surface of the terrain (cave roof/floor, mountain surface, etc). Searches in the x,z column given.
      Parameters:
      x - column x
      z - column z
      y - start y
      minY - minimum y height to consider. Inclusive.
      maxY - maximum y height to consider. Inclusive.
      Returns:
      The y value of the nearest terrain block
    • getNearestSurfaceTerrainBlock

      default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax)
      Gets y value for the nearest block that is considered the surface of the terrain (cave roof/floor, mountain surface, etc). Searches in the x,z column given.
      Parameters:
      x - column x
      z - column z
      y - start y
      minY - minimum y height to consider. Inclusive.
      maxY - maximum y height to consider. Inclusive.
      failedMin - if nothing found, the minimum y value to return if returning min
      failedMax - if nothing found, the maximum y value to return if returning max
      Returns:
      The y value of the nearest terrain block
    • getNearestSurfaceTerrainBlock

      default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir)
      Gets y value for the nearest block that is considered the surface of the terrain (cave roof/floor, mountain surface, etc). Searches in the x,z column given.
      Parameters:
      x - column x
      z - column z
      y - start y
      minY - minimum y height to consider. Inclusive.
      maxY - maximum y height to consider. Inclusive.
      failedMin - if nothing found, the minimum y value to return if returning min
      failedMax - if nothing found, the maximum y value to return if returning max
      ignoreAir - if air at the final value if no block found should be considered for return, else return -1
      Returns:
      The y value of the nearest terrain block
    • addCaves

      default void addCaves(Region region) throws WorldEditException
      Throws:
      WorldEditException
    • generate

      default void generate(Region region, GenBase gen) throws WorldEditException
      Throws:
      WorldEditException
    • addSchems

      default void addSchems(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException
      Throws:
      WorldEditException
    • spawnResource

      default void spawnResource(Region region, Resource gen, int rarity, int frequency) throws WorldEditException
      Throws:
      WorldEditException
    • contains

      default boolean contains(BlockVector3 pt)
      Returns true if the extent contains the given position
      Parameters:
      pt - position
      Returns:
      if position is contained
    • contains

      default boolean contains(int x, int y, int z)
      Returns true if the extent contains the given position
      Parameters:
      x - position x
      y - position y
      z - position z
      Returns:
      if position is contained
    • addOre

      default void addOre(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException
      Throws:
      WorldEditException
    • addOres

      default void addOres(Region region, Mask mask) throws WorldEditException
      Throws:
      WorldEditException
    • getBlockDistribution

      default List<Countable<BlockType>> getBlockDistribution(Region region)
      Get the block distribution inside a region.
      Parameters:
      region - a region
      Returns:
      the results
    • getBlockDistributionWithData

      default List<Countable<BlockState>> getBlockDistributionWithData(Region region)
      Get the block distribution (with data values) inside a region.
      Parameters:
      region - a region
      Returns:
      the results
    • commit

      @Nullable default Operation commit()
      Description copied from interface: OutputExtent
      Return an Operation that should be called to tie up loose ends (such as to commit changes in a buffer).
      Specified by:
      commit in interface OutputExtent
      Returns:
      an operation or null if there is none to execute
    • cancel

      default boolean cancel()
    • getMinY

      default int getMinY()
    • getMaxY

      default int getMaxY()
    • lazyCopy

      default Clipboard lazyCopy(Region region)
      Lazily copy a region
      Parameters:
      region -
      Returns:
    • countBlocks

      default int countBlocks(Region region, Set<BaseBlock> searchBlocks)
      Count the number of blocks of a list of types in a region.
      Parameters:
      region - the region
      searchBlocks - the list of blocks to search
      Returns:
      the number of blocks that matched the block
    • countBlocks

      default int countBlocks(Region region, Mask searchMask)
      Count the number of blocks of a list of types in a region.
      Parameters:
      region - the region
      searchMask - mask to match
      Returns:
      the number of blocks that matched the mask
    • setBlocks

      default <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException
      Sets all the blocks inside a region to a given block type.
      Parameters:
      region - the region
      block - the block
      Returns:
      number of blocks affected
      Throws:
      MaxChangedBlocksException - thrown if too many blocks are changed
    • setBlocks

      default int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException
      Sets all the blocks inside a region to a given pattern.
      Parameters:
      region - the region
      pattern - the pattern that provides the replacement block
      Returns:
      number of blocks affected
      Throws:
      MaxChangedBlocksException - thrown if too many blocks are changed
    • replaceBlocks

      default <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException
      Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.
      Parameters:
      region - the region to replace the blocks within
      filter - a list of block types to match, or null to use ExistingBlockMask
      replacement - the replacement block
      Returns:
      number of blocks affected
      Throws:
      MaxChangedBlocksException - thrown if too many blocks are changed
    • replaceBlocks

      default int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException
      Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.
      Parameters:
      region - the region to replace the blocks within
      filter - a list of block types to match, or null to use ExistingBlockMask
      pattern - the pattern that provides the new blocks
      Returns:
      number of blocks affected
      Throws:
      MaxChangedBlocksException - thrown if too many blocks are changed
    • replaceBlocks

      default int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException
      Replaces all the blocks matching a given mask, within a given region, to a block returned by a given pattern.
      Parameters:
      region - the region to replace the blocks within
      mask - the mask that blocks must match
      pattern - the pattern that provides the new blocks
      Returns:
      number of blocks affected
      Throws:
      MaxChangedBlocksException - thrown if too many blocks are changed
    • center

      default int center(Region region, Pattern pattern) throws MaxChangedBlocksException
      Sets the blocks at the center of the given region to the given pattern. If the center sits between two blocks on a certain axis, then two blocks will be placed to mark the center.
      Parameters:
      region - the region to find the center of
      pattern - the replacement pattern
      Returns:
      the number of blocks placed
      Throws:
      MaxChangedBlocksException - thrown if too many blocks are changed
    • setBlocks

      default int setBlocks(Set<BlockVector3> vset, Pattern pattern)
    • relight

      default boolean relight(int x, int y, int z)
    • relightBlock

      default boolean relightBlock(int x, int y, int z)
    • relightSky

      default boolean relightSky(int x, int y, int z)
    • addProcessor

      default Extent addProcessor(IBatchProcessor processor)
      Have an extent processed - Either block (Extent) processing or chunk processing
      Parameters:
      processor -
      Returns:
      processed Extent
    • addPostProcessor

      default Extent addPostProcessor(IBatchProcessor processor)
    • enableHistory

      default Extent enableHistory(AbstractChangeSet changeSet)
    • disableHistory

      default Extent disableHistory()
    • apply

      default <T extends Filter> T apply(Region region, T filter, boolean full)
    • apply

      default <T extends Filter> T apply(Iterable<BlockVector3> positions, T filter)