Class PassthroughExtent

java.lang.Object
com.sk89q.worldedit.extent.AbstractDelegateExtent
com.fastasyncworldedit.core.extent.PassthroughExtent
All Implemented Interfaces:
Extent, InputExtent, OutputExtent
Direct Known Subclasses:
EditSession, ExtentHeightCacher, FuzzyRegionSelector, MemoryCheckingExtent, ParallelQueueExtent, SupplyingExtent, TemporalExtent

public class PassthroughExtent extends AbstractDelegateExtent
  • Constructor Details

    • PassthroughExtent

      public PassthroughExtent(Extent extent)
      Create a new instance.
      Parameters:
      extent - the extent
  • Method Details

    • regenerateChunk

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

      public int getHighestTerrainBlock(int x, int z, int minY, int maxY)
      Description copied from interface: Extent
      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

      public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter)
      Description copied from interface: Extent
      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

      public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY)
      Description copied from interface: Extent
      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

      public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir)
      Description copied from interface: Extent
      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

      public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY)
      Description copied from interface: Extent
      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

      public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax)
      Description copied from interface: Extent
      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

      public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask)
      Description copied from interface: Extent
      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

      public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir)
      Description copied from interface: Extent
      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

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

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

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

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

      public boolean contains(BlockVector3 pt)
      Description copied from interface: Extent
      Returns true if the extent contains the given position
      Parameters:
      pt - position
      Returns:
      if position is contained
    • addOre

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

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

      public List<Countable<BlockType>> getBlockDistribution(Region region)
      Description copied from interface: Extent
      Get the block distribution inside a region.
      Parameters:
      region - a region
      Returns:
      the results
    • getBlockDistributionWithData

      public List<Countable<BlockState>> getBlockDistributionWithData(Region region)
      Description copied from interface: Extent
      Get the block distribution (with data values) inside a region.
      Parameters:
      region - a region
      Returns:
      the results
    • lazyCopy

      public Clipboard lazyCopy(Region region)
      Description copied from interface: Extent
      Lazily copy a region
      Returns:
    • countBlocks

      public int countBlocks(Region region, Set<BaseBlock> searchBlocks)
      Description copied from interface: Extent
      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

      public int countBlocks(Region region, Mask searchMask)
      Description copied from interface: Extent
      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

      public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException
      Description copied from interface: Extent
      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

      public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException
      Description copied from interface: Extent
      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

      public <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException
      Description copied from interface: Extent
      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

      public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException
      Description copied from interface: Extent
      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

      public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException
      Description copied from interface: Extent
      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

      public int center(Region region, Pattern pattern) throws MaxChangedBlocksException
      Description copied from interface: Extent
      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

      public int setBlocks(Set<BlockVector3> vset, Pattern pattern)
    • getBlock

      public BlockState getBlock(BlockVector3 position)
      Description copied from interface: InputExtent
      Get a snapshot of the block at the given location.

      If the given position is out of the bounds of the extent, then the behavior is undefined (an air block could be returned). However, null should not be returned.

      The returned block is immutable and is a snapshot of the block at the time of call. It has no position attached to it, so it could be reused in Patterns and so on.

      Specified by:
      getBlock in interface InputExtent
      Overrides:
      getBlock in class AbstractDelegateExtent
      Parameters:
      position - position of the block
      Returns:
      the block
    • getFullBlock

      public BaseBlock getFullBlock(BlockVector3 position)
      Description copied from interface: InputExtent
      Get an immutable snapshot of the block at the given location.
      Specified by:
      getFullBlock in interface InputExtent
      Overrides:
      getFullBlock in class AbstractDelegateExtent
      Parameters:
      position - position of the block
      Returns:
      the block
    • setBlock

      @Deprecated public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException
      Deprecated.
      Description copied from interface: OutputExtent
      Change the block at the given location to the given block. The operation may not tie the given BlockStateHolder to the world, so future changes to the BlockStateHolder do not affect the world until this method is called again.

      The return value of this method indicates whether the change was probably successful. It may not be successful if, for example, the location is out of the bounds of the extent. It may be unsuccessful if the block passed is the same as the one in the world. However, the return value is only an estimation and it may be incorrect, but it could be used to count, for example, the approximate number of changes.

      Specified by:
      setBlock in interface OutputExtent
      Overrides:
      setBlock in class AbstractDelegateExtent
      Parameters:
      position - position of the block
      block - block to set
      Returns:
      true if the block was successfully set (return value may not be accurate)
      Throws:
      WorldEditException - thrown on an error
    • setTile

      public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException
      Specified by:
      setTile in interface OutputExtent
      Overrides:
      setTile in class AbstractDelegateExtent
      Throws:
      WorldEditException
    • 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.

      Specified by:
      setBiome in interface OutputExtent
      Overrides:
      setBiome in class AbstractDelegateExtent
      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)
    • commit

      @Nullable public 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 Extent
      Specified by:
      commit in interface OutputExtent
      Overrides:
      commit in class AbstractDelegateExtent
      Returns:
      an operation or null if there is none to execute
    • cancel

      public boolean cancel()
      Specified by:
      cancel in interface Extent
      Overrides:
      cancel in class AbstractDelegateExtent
    • isQueueEnabled

      public boolean isQueueEnabled()
      Specified by:
      isQueueEnabled in interface Extent
      Overrides:
      isQueueEnabled in class AbstractDelegateExtent
    • enableQueue

      public void enableQueue()
      Specified by:
      enableQueue in interface Extent
      Overrides:
      enableQueue in class AbstractDelegateExtent
    • disableQueue

      public void disableQueue()
      Specified by:
      disableQueue in interface Extent
      Overrides:
      disableQueue in class AbstractDelegateExtent
    • isWorld

      public boolean isWorld()
    • apply

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

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