Class LimitExtent
- All Implemented Interfaces:
IBatchProcessor,Extent,InputExtent,OutputExtent
-
Field Summary
Fields inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
extent -
Constructor Summary
ConstructorsConstructorDescriptionLimitExtent(Extent extent, FaweLimit limit) Deprecated, for removal: This API element is subject to removal in a future version.LimitExtent(Extent extent, FaweLimit limit, Consumer<com.sk89q.worldedit.util.formatting.text.Component> onErrorMessage) Deprecated, for removal: This API element is subject to removal in a future version.LimitExtent(Extent extent, FaweLimit limit, Consumer<com.sk89q.worldedit.util.formatting.text.Component> onErrorMessage, boolean processing) Create a new instance. -
Method Summary
Modifier and TypeMethodDescription<T extends Filter>
T<T extends Filter>
Tapply(Iterable<BlockVector3> positions, T filter) Convert this processor into an Extent based processor instead of a queue batch based on.intcountBlocks(Region region, Mask searchMask) Count the number of blocks of a list of types in a region.intcountBlocks(Region region, Set<BaseBlock> searchBlocks) Count the number of blocks of a list of types in a region.createEntity(Location location, BaseEntity entity) Create an entity at the given location.createEntity(Location location, BaseEntity entity, UUID uuid) Create an entity at the given location, forcing a UUID onto the entity Only use if you are aware of the consequences of forcing a UUID to an entity.getBiome(BlockVector3 position) Get the biome at the given location.getBiomeType(int x, int y, int z) getBlock(int x, int y, int z) getBlock(BlockVector3 position) Get a snapshot of the block at the given location.getBlockDistribution(Region region) Get the block distribution inside a region.getBlockDistributionWithData(Region region) Get the block distribution (with data values) inside a region.Get a list of all entities.getEntities(Region region) Get a list of all entities within the given region.getFullBlock(int x, int y, int z) getFullBlock(BlockVector3 position) Get an immutable snapshot of the block at the given location.intgetHighestTerrainBlock(int x, int z, int minY, int maxY) Returns the highest solid 'terrain' (movement-blocking) block.intgetHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) Returns the highest block matching the given mask.intgetNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) Returns the nearest surface layer (up/down from start), where a layer is 1/16th of a block to allow for snow, liquid, etc.intgetNearestSurfaceTerrainBlock(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).intgetNearestSurfaceTerrainBlock(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).intgetNearestSurfaceTerrainBlock(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).intgetNearestSurfaceTerrainBlock(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).intgetNearestSurfaceTerrainBlock(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.getScope()Default to CUSTOM ProcessorScope as we want custom processors people add to be before we write history, but after FAWE does it's own stuff.processSet(IChunk chunk, IChunkGet get, IChunkSet set) Process a chunk that has been set.booleanregenerateChunk(int x, int z, BiomeType type, Long seed) voidremoveEntity(int x, int y, int z, UUID uuid) Create an entity at the given location.intreplaceBlocks(Region region, Mask mask, Pattern pattern) Replaces all the blocks matching a given mask, within a given region, to a block returned by a given pattern.<B extends BlockStateHolder<B>>
intreplaceBlocks(Region region, Set<BaseBlock> filter, B replacement) Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.intreplaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.booleanbooleansetBiome(BlockVector3 position, BiomeType biome) Set the biome.<T extends BlockStateHolder<T>>
booleansetBlock(int x, int y, int z, T block) <T extends BlockStateHolder<T>>
booleansetBlock(BlockVector3 position, T block) Deprecated.<B extends BlockStateHolder<B>>
intSets all the blocks inside a region to a given block type.intSets all the blocks inside a region to a given pattern.intsetBlocks(Set<BlockVector3> vset, Pattern pattern) voidsetProcessing(boolean processing) booleansetTile(int x, int y, int z, CompoundTag tile) Methods inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
addPostProcessor, addProcessor, cancel, commit, commitBefore, disableHistory, disableQueue, enableQueue, fullySupports3DBiomes, getBrightness, getEmittedLight, getExtent, getMaximumPoint, getMaxY, getMinimumPoint, getMinY, getSkyLight, isQueueEnabled, isWorld, relight, relightBlock, relightSky, setBlockLight, setChangeSet, setSkyLight, tile, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.sk89q.worldedit.extent.Extent
addCaves, addOre, addOres, addSchems, center, contains, contains, enableHistory, generate, lazyCopy, spawnResourceMethods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
flush, join, joinPost, postProcess, postProcessSet, processGet, processGet, remove, trimNBT, trimNBT, trimYMethods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBrightness, getEmittedLight, getHeightMap, getOpacity, getOpacity, getSkyLightMethods inherited from interface com.sk89q.worldedit.extent.OutputExtent
setBiome, setBlockLight, setHeightMap, setSkyLight
-
Constructor Details
-
LimitExtent
Deprecated, for removal: This API element is subject to removal in a future version.Create a new instance.- Parameters:
extent- the extentlimit- the limit
-
LimitExtent
@Deprecated(forRemoval=true, since="2.12.0") public LimitExtent(Extent extent, FaweLimit limit, Consumer<com.sk89q.worldedit.util.formatting.text.Component> onErrorMessage) Deprecated, for removal: This API element is subject to removal in a future version.Create a new instance.- Parameters:
extent- the extentlimit- the limitonErrorMessage- consumer to handle a component generated by exceptions
-
LimitExtent
public LimitExtent(Extent extent, FaweLimit limit, Consumer<com.sk89q.worldedit.util.formatting.text.Component> onErrorMessage, boolean processing) Create a new instance.- Parameters:
extent- the extentlimit- the limitonErrorMessage- consumer to handle a component generated by exceptionsprocessing- if this limit extent is expected to be processing- Since:
- 2.12.0
-
-
Method Details
-
getEntities
Description copied from interface:ExtentGet 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.
- Specified by:
getEntitiesin interfaceExtent- Overrides:
getEntitiesin classAbstractDelegateExtent- Parameters:
region- the region in which entities must be contained- Returns:
- a list of entities
-
getEntities
Description copied from interface:ExtentGet 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.
- Specified by:
getEntitiesin interfaceExtent- Overrides:
getEntitiesin classAbstractDelegateExtent- Returns:
- a list of entities
-
createEntity
Description copied from interface:ExtentCreate an entity at the given location.- Specified by:
createEntityin interfaceExtent- Overrides:
createEntityin classAbstractDelegateExtent- Parameters:
location- the locationentity- the entity- Returns:
- a reference to the created entity, or null if the entity could not be created
-
createEntity
Description copied from interface:ExtentCreate an entity at the given location, forcing a UUID onto the entity Only use if you are aware of the consequences of forcing a UUID to an entity.- Specified by:
createEntityin interfaceExtent- Overrides:
createEntityin classAbstractDelegateExtent- Parameters:
location- the locationentity- the entityuuid- UUID to force the entity to have- Returns:
- a reference to the created entity, or null if the entity could not be created
-
removeEntity
Description copied from interface:ExtentCreate an entity at the given location.- Specified by:
removeEntityin interfaceExtent- Overrides:
removeEntityin classAbstractDelegateExtent- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinateuuid- the unique identifier of the entity
-
regenerateChunk
- Specified by:
regenerateChunkin interfaceExtent
-
getHighestTerrainBlock
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) Description copied from interface:ExtentReturns the highest solid 'terrain' (movement-blocking) block.- Specified by:
getHighestTerrainBlockin interfaceExtent- Parameters:
x- the X coordinatez- the Z coordinateminY- minimal heightmaxY- maximal height- Returns:
- height of highest block found or 'minY'
-
getHighestTerrainBlock
Description copied from interface:ExtentReturns the highest block matching the given mask.- Specified by:
getHighestTerrainBlockin interfaceExtent- Parameters:
x- the X coordinatez- the Z coordinateminY- minimal heightmaxY- maximal heightfilter- 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:ExtentReturns the nearest surface layer (up/down from start), where a layer is 1/16th of a block to allow for snow, liquid, etc.- Specified by:
getNearestSurfaceLayerin interfaceExtent- Parameters:
x- x to search fromz- y to search fromy- z to search fromminY- 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:ExtentGets 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.- Specified by:
getNearestSurfaceTerrainBlockin interfaceExtent- Parameters:
x- column xz- column zy- start yminY- 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:ExtentGets 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.- Specified by:
getNearestSurfaceTerrainBlockin interfaceExtent- Parameters:
x- column xz- column zy- start yminY- 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:ExtentGets 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.- Specified by:
getNearestSurfaceTerrainBlockin interfaceExtent- Parameters:
x- column xz- column zy- start yminY- 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 minfailedMax- 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:ExtentGets 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.- Specified by:
getNearestSurfaceTerrainBlockin interfaceExtent- Parameters:
x- column xz- column zy- start yminY- 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 minfailedMax- if nothing found, the maximum y value to return if returning maxmask- 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:ExtentGets 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.- Specified by:
getNearestSurfaceTerrainBlockin interfaceExtent- Parameters:
x- column xz- column zy- start yminY- 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 minfailedMax- if nothing found, the maximum y value to return if returning maxignoreAir- 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
-
getBlockDistribution
Description copied from interface:ExtentGet the block distribution inside a region.- Specified by:
getBlockDistributionin interfaceExtent- Overrides:
getBlockDistributionin classAbstractDelegateExtent- Parameters:
region- a region- Returns:
- the results
-
getBlockDistributionWithData
Description copied from interface:ExtentGet the block distribution (with data values) inside a region.- Specified by:
getBlockDistributionWithDatain interfaceExtent- Overrides:
getBlockDistributionWithDatain classAbstractDelegateExtent- Parameters:
region- a region- Returns:
- the results
-
countBlocks
Description copied from interface:ExtentCount the number of blocks of a list of types in a region.- Specified by:
countBlocksin interfaceExtent- Overrides:
countBlocksin classAbstractDelegateExtent- Parameters:
region- the regionsearchBlocks- the list of blocks to search- Returns:
- the number of blocks that matched the block
-
countBlocks
Description copied from interface:ExtentCount the number of blocks of a list of types in a region.- Specified by:
countBlocksin interfaceExtent- Overrides:
countBlocksin classAbstractDelegateExtent- Parameters:
region- the regionsearchMask- 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:ExtentSets all the blocks inside a region to a given block type.- Specified by:
setBlocksin interfaceExtent- Overrides:
setBlocksin classAbstractDelegateExtent- Parameters:
region- the regionblock- the block- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException- thrown if too many blocks are changed
-
setBlocks
Description copied from interface:ExtentSets all the blocks inside a region to a given pattern.- Specified by:
setBlocksin interfaceExtent- Overrides:
setBlocksin classAbstractDelegateExtent- Parameters:
region- the regionpattern- 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:ExtentReplaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocksin interfaceExtent- Overrides:
replaceBlocksin classAbstractDelegateExtent- Parameters:
region- the region to replace the blocks withinfilter- a list of block types to match, or null to useExistingBlockMaskreplacement- 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:ExtentReplaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocksin interfaceExtent- Overrides:
replaceBlocksin classAbstractDelegateExtent- Parameters:
region- the region to replace the blocks withinfilter- a list of block types to match, or null to useExistingBlockMaskpattern- 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:ExtentReplaces all the blocks matching a given mask, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocksin interfaceExtent- Overrides:
replaceBlocksin classAbstractDelegateExtent- Parameters:
region- the region to replace the blocks withinmask- the mask that blocks must matchpattern- the pattern that provides the new blocks- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException- thrown if too many blocks are changed
-
setBlocks
- Specified by:
setBlocksin interfaceExtent- Overrides:
setBlocksin classAbstractDelegateExtent
-
apply
- Specified by:
applyin interfaceExtent- Overrides:
applyin classAbstractDelegateExtent
-
apply
-
getBlock
Description copied from interface:InputExtentGet 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,
nullshould 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:
getBlockin interfaceInputExtent- Overrides:
getBlockin classAbstractDelegateExtent- Parameters:
position- position of the block- Returns:
- the block
-
getBlock
- Specified by:
getBlockin interfaceInputExtent- Overrides:
getBlockin classAbstractDelegateExtent
-
getFullBlock
Description copied from interface:InputExtentGet an immutable snapshot of the block at the given location.- Specified by:
getFullBlockin interfaceInputExtent- Overrides:
getFullBlockin classAbstractDelegateExtent- Parameters:
position- position of the block- Returns:
- the block
-
getFullBlock
- Specified by:
getFullBlockin interfaceInputExtent- Overrides:
getFullBlockin classAbstractDelegateExtent
-
getBiome
Description copied from interface:InputExtentGet 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.
- Specified by:
getBiomein interfaceInputExtent- Overrides:
getBiomein classAbstractDelegateExtent- Parameters:
position- the (x, y, z) location to check the biome at- Returns:
- the biome at the location
- See Also:
-
getBiomeType
- Specified by:
getBiomeTypein interfaceInputExtent- Overrides:
getBiomeTypein classAbstractDelegateExtent
-
setBlock
@Deprecated public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException Deprecated.Description copied from interface:OutputExtentChange the block at the given location to the given block. The operation may not tie the givenBlockStateHolderto the world, so future changes to theBlockStateHolderdo 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:
setBlockin interfaceOutputExtent- Overrides:
setBlockin classAbstractDelegateExtent- Parameters:
position- position of the blockblock- block to set- Returns:
- true if the block was successfully set (return value may not be accurate)
- Throws:
WorldEditException- thrown on an error
-
setBlock
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException - Specified by:
setBlockin interfaceOutputExtent- Overrides:
setBlockin classAbstractDelegateExtent- Throws:
WorldEditException
-
setTile
- Specified by:
setTilein interfaceOutputExtent- Throws:
WorldEditException
-
setBiome
Description copied from interface:OutputExtentSet 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:
setBiomein interfaceOutputExtent- Overrides:
setBiomein classAbstractDelegateExtent- Parameters:
position- the (x, y, z) location to set the biome atbiome- the biome to set to- Returns:
- true if the biome was successfully set (return value may not be accurate)
-
setBiome
- Specified by:
setBiomein interfaceOutputExtent- Overrides:
setBiomein classAbstractDelegateExtent
-
setProcessing
public void setProcessing(boolean processing) -
processSet
Description copied from interface:IBatchProcessorProcess a chunk that has been set.- Specified by:
processSetin interfaceIBatchProcessor
-
construct
Description copied from interface:IBatchProcessorConvert this processor into an Extent based processor instead of a queue batch based on.- Specified by:
constructin interfaceIBatchProcessor
-
getScope
Description copied from interface:IBatchProcessorDefault to CUSTOM ProcessorScope as we want custom processors people add to be before we write history, but after FAWE does it's own stuff.- Specified by:
getScopein interfaceIBatchProcessor
-
LimitExtent(Extent, FaweLimit, Consumer, boolean)