Class LimitExtent
- All Implemented Interfaces:
IBatchProcessor
,Extent
,InputExtent
,OutputExtent
-
Field Summary
Fields inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
extent
-
Constructor Summary
ConstructorDescriptionLimitExtent
(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 one.int
countBlocks
(Region region, Mask searchMask) Count the number of blocks of a list of types in a region.int
countBlocks
(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.int
getHighestTerrainBlock
(int x, int z, int minY, int maxY) Returns the highest solid 'terrain' (movement-blocking) block.int
getHighestTerrainBlock
(int x, int z, int minY, int maxY, Mask filter) Returns the highest block matching the given mask.int
getNearestSurfaceLayer
(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.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).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).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).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).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.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.boolean
regenerateChunk
(int x, int z, BiomeType type, Long seed) void
removeEntity
(int x, int y, int z, UUID uuid) Create an entity at the given location.int
replaceBlocks
(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.int
replaceBlocks
(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.boolean
boolean
setBiome
(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.int
Sets all the blocks inside a region to a given pattern.int
setBlocks
(Set<BlockVector3> vset, Pattern pattern) void
setProcessing
(boolean processing) boolean
setTile
(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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.extent.Extent
addCaves, addOre, addOres, addSchems, center, contains, contains, enableHistory, generate, lazyCopy, spawnResource
Methods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
flush, join, joinPost, postProcess, postProcessSet, processGet, remove, trimNBT, trimNBT, trimY
Methods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBrightness, getEmittedLight, getHeightMap, getOpacity, getOpacity, getSkyLight
Methods 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:Extent
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.
- Specified by:
getEntities
in interfaceExtent
- Overrides:
getEntities
in classAbstractDelegateExtent
- Parameters:
region
- the region in which entities must be contained- Returns:
- a list of entities
-
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.
- Specified by:
getEntities
in interfaceExtent
- Overrides:
getEntities
in classAbstractDelegateExtent
- Returns:
- a list of entities
-
createEntity
Description copied from interface:Extent
Create an entity at the given location.- Specified by:
createEntity
in interfaceExtent
- Overrides:
createEntity
in 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:Extent
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.- Specified by:
createEntity
in interfaceExtent
- Overrides:
createEntity
in 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:Extent
Create an entity at the given location.- Specified by:
removeEntity
in interfaceExtent
- Overrides:
removeEntity
in classAbstractDelegateExtent
- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinateuuid
- the unique identifier of the entity
-
regenerateChunk
- Specified by:
regenerateChunk
in interfaceExtent
-
getHighestTerrainBlock
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) Description copied from interface:Extent
Returns the highest solid 'terrain' (movement-blocking) block.- Specified by:
getHighestTerrainBlock
in 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:Extent
Returns the highest block matching the given mask.- Specified by:
getHighestTerrainBlock
in 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:Extent
Returns 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:
getNearestSurfaceLayer
in 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: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.- Specified by:
getNearestSurfaceTerrainBlock
in 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: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.- Specified by:
getNearestSurfaceTerrainBlock
in 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: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.- Specified by:
getNearestSurfaceTerrainBlock
in 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: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.- Specified by:
getNearestSurfaceTerrainBlock
in 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: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.- Specified by:
getNearestSurfaceTerrainBlock
in 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:Extent
Get the block distribution inside a region.- Specified by:
getBlockDistribution
in interfaceExtent
- Overrides:
getBlockDistribution
in classAbstractDelegateExtent
- Parameters:
region
- a region- Returns:
- the results
-
getBlockDistributionWithData
Description copied from interface:Extent
Get the block distribution (with data values) inside a region.- Specified by:
getBlockDistributionWithData
in interfaceExtent
- Overrides:
getBlockDistributionWithData
in classAbstractDelegateExtent
- Parameters:
region
- a region- Returns:
- the results
-
countBlocks
Description copied from interface:Extent
Count the number of blocks of a list of types in a region.- Specified by:
countBlocks
in interfaceExtent
- Overrides:
countBlocks
in 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:Extent
Count the number of blocks of a list of types in a region.- Specified by:
countBlocks
in interfaceExtent
- Overrides:
countBlocks
in 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:Extent
Sets all the blocks inside a region to a given block type.- Specified by:
setBlocks
in interfaceExtent
- Overrides:
setBlocks
in 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:Extent
Sets all the blocks inside a region to a given pattern.- Specified by:
setBlocks
in interfaceExtent
- Overrides:
setBlocks
in 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:Extent
Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocks
in interfaceExtent
- Overrides:
replaceBlocks
in classAbstractDelegateExtent
- Parameters:
region
- the region to replace the blocks withinfilter
- a list of block types to match, or null to useExistingBlockMask
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.- Specified by:
replaceBlocks
in interfaceExtent
- Overrides:
replaceBlocks
in classAbstractDelegateExtent
- Parameters:
region
- the region to replace the blocks withinfilter
- a list of block types to match, or null to useExistingBlockMask
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.- Specified by:
replaceBlocks
in interfaceExtent
- Overrides:
replaceBlocks
in 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:
setBlocks
in interfaceExtent
- Overrides:
setBlocks
in classAbstractDelegateExtent
-
apply
- Specified by:
apply
in interfaceExtent
- Overrides:
apply
in classAbstractDelegateExtent
-
apply
-
getBlock
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
Pattern
s and so on.- Specified by:
getBlock
in interfaceInputExtent
- Overrides:
getBlock
in classAbstractDelegateExtent
- Parameters:
position
- position of the block- Returns:
- the block
-
getBlock
- Specified by:
getBlock
in interfaceInputExtent
- Overrides:
getBlock
in classAbstractDelegateExtent
-
getFullBlock
Description copied from interface:InputExtent
Get an immutable snapshot of the block at the given location.- Specified by:
getFullBlock
in interfaceInputExtent
- Overrides:
getFullBlock
in classAbstractDelegateExtent
- Parameters:
position
- position of the block- Returns:
- the block
-
getFullBlock
- Specified by:
getFullBlock
in interfaceInputExtent
- Overrides:
getFullBlock
in classAbstractDelegateExtent
-
getBiome
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.
- Specified by:
getBiome
in interfaceInputExtent
- Overrides:
getBiome
in classAbstractDelegateExtent
- Parameters:
position
- the (x, y, z) location to check the biome at- Returns:
- the biome at the location
- See Also:
-
getBiomeType
- Specified by:
getBiomeType
in interfaceInputExtent
- Overrides:
getBiomeType
in classAbstractDelegateExtent
-
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 givenBlockStateHolder
to the world, so future changes to theBlockStateHolder
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 interfaceOutputExtent
- Overrides:
setBlock
in 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:
setBlock
in interfaceOutputExtent
- Overrides:
setBlock
in classAbstractDelegateExtent
- Throws:
WorldEditException
-
setTile
- Specified by:
setTile
in interfaceOutputExtent
- Throws:
WorldEditException
-
setBiome
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 interfaceOutputExtent
- Overrides:
setBiome
in 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:
setBiome
in interfaceOutputExtent
- Overrides:
setBiome
in classAbstractDelegateExtent
-
setProcessing
public void setProcessing(boolean processing) -
processSet
Description copied from interface:IBatchProcessor
Process a chunk that has been set.- Specified by:
processSet
in interfaceIBatchProcessor
-
construct
Description copied from interface:IBatchProcessor
Convert this processor into an Extent based processor instead of a queue batch based one.- Specified by:
construct
in interfaceIBatchProcessor
-
getScope
Description copied from interface:IBatchProcessor
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.- Specified by:
getScope
in interfaceIBatchProcessor
-
LimitExtent(Extent, FaweLimit, Consumer, boolean)