Class PassthroughExtent
- All Implemented Interfaces:
Extent
,InputExtent
,OutputExtent
- Direct Known Subclasses:
EditSession
,ExtentHeightCacher
,FuzzyRegionSelector
,MemoryCheckingExtent
,ParallelQueueExtent
,SupplyingExtent
,TemporalExtent
-
Field Summary
Fields inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
extent
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addOre
(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) void
void
addSchems
(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) <T extends Filter>
T<T extends Filter>
Tapply
(Iterable<BlockVector3> positions, T filter) boolean
cancel()
int
Sets the blocks at the center of the given region to the given pattern.commit()
Return anOperation
that should be called to tie up loose ends (such as to commit changes in a buffer).boolean
contains
(BlockVector3 pt) Returns true if the extent contains the given positionint
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.void
void
void
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.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.boolean
boolean
isWorld()
Lazily copy a regionboolean
regenerateChunk
(int x, int z, BiomeType type, Long seed) 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
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.<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) boolean
setTile
(int x, int y, int z, CompoundTag tile) void
spawnResource
(Region region, Resource gen, int rarity, int frequency) Methods inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
addPostProcessor, addProcessor, commitBefore, createEntity, createEntity, disableHistory, fullySupports3DBiomes, getBiome, getBiomeType, getBlock, getBrightness, getEmittedLight, getEntities, getEntities, getExtent, getFullBlock, getMaximumPoint, getMaxY, getMinimumPoint, getMinY, getSkyLight, relight, relightBlock, relightSky, removeEntity, setBiome, setBlock, 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
contains, enableHistory
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
-
PassthroughExtent
Create a new instance.- Parameters:
extent
- the extent
-
-
Method Details
-
regenerateChunk
-
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.- 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.- 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.- 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.- 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.- 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.- 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.- 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.- 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
-
addCaves
- Throws:
WorldEditException
-
generate
- 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
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
- Throws:
WorldEditException
-
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
-
lazyCopy
Description copied from interface:Extent
Lazily copy a region- Parameters:
region
-- Returns:
-
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
-
center
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 ofpattern
- the replacement pattern- Returns:
- the number of blocks placed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
setBlocks
- Specified by:
setBlocks
in interfaceExtent
- Overrides:
setBlocks
in classAbstractDelegateExtent
-
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
-
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
-
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
-
setTile
- 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)
-
commit
Description copied from interface:OutputExtent
Return anOperation
that should be called to tie up loose ends (such as to commit changes in a buffer).- Specified by:
commit
in interfaceExtent
- Specified by:
commit
in interfaceOutputExtent
- Overrides:
commit
in classAbstractDelegateExtent
- Returns:
- an operation or null if there is none to execute
-
cancel
public boolean cancel()- Specified by:
cancel
in interfaceExtent
- Overrides:
cancel
in classAbstractDelegateExtent
-
isQueueEnabled
public boolean isQueueEnabled()- Specified by:
isQueueEnabled
in interfaceExtent
- Overrides:
isQueueEnabled
in classAbstractDelegateExtent
-
enableQueue
public void enableQueue()- Specified by:
enableQueue
in interfaceExtent
- Overrides:
enableQueue
in classAbstractDelegateExtent
-
disableQueue
public void disableQueue()- Specified by:
disableQueue
in interfaceExtent
- Overrides:
disableQueue
in classAbstractDelegateExtent
-
isWorld
public boolean isWorld()- Specified by:
isWorld
in interfaceExtent
- Overrides:
isWorld
in classAbstractDelegateExtent
-
apply
- Specified by:
apply
in interfaceExtent
- Overrides:
apply
in classAbstractDelegateExtent
-
apply
-