Class EditSession
- All Implemented Interfaces:
Extent
,InputExtent
,OutputExtent
,AutoCloseable
Extent
that handles history, BlockBag
s, change limits,
block re-ordering, and much more. Most operations in WorldEdit use this class.
Most of the actual functionality is implemented with a number of other
Extent
s that are chained together. For example, history is logged
using the ChangeSetExtent
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Reorder mode forsetReorderMode(ReorderMode)
.static enum
Used bysetBlock(BlockVector3, BlockStateHolder, Stage)
to determine whichExtent
s should be bypassed. -
Field Summary
Fields inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
extent
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addOre
(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) void
addSchems
(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) void
addSourceMask
(Mask mask) void
addTransform
(ResettableExtent transform) int
Sets the blocks at the center of the given region to the given pattern.void
close()
Closing an EditSession flushes its buffers to the world, and performs other cleanup tasks.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.int
deformRegion
(Region region, Vector3 zero, Vector3 unit, Expression expression, int timeout) Internal version ofdeformRegion(Region, Vector3, Vector3, String, int)
.int
deformRegion
(Region region, Vector3 zero, Vector3 unit, String expressionString) Deforms the region by a given expression.int
deformRegion
(Region region, Vector3 zero, Vector3 unit, String expressionString, int timeout) Deforms the region by a given expression.void
Disable all buffering extents.void
disableHistory
(boolean disableHistory) Deprecated.void
Deprecated.int
drainArea
(BlockVector3 origin, double radius) Drain nearby pools of water or lava.int
drainArea
(BlockVector3 origin, double radius, boolean waterlogged) Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.int
drainArea
(BlockVector3 origin, double radius, boolean waterlogged, boolean plants) Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.int
drawLine
(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled) int
drawLine
(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat) Draws a line (out of blocks) between two vectors.int
drawLine
(Pattern pattern, List<BlockVector3> vectors, double radius, boolean filled) Draws a line (out of blocks) between two or more vectors.int
drawSpline
(Pattern pattern, List<BlockVector3> nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) Draws a spline (out of blocks) between specified vectors.void
Deprecated.void
Turns on specific features for a normal WorldEdit session, such aschunk batching
.<B extends BlockStateHolder<B>>
intint
fillDirection
(BlockVector3 origin, Pattern pattern, double radius, int depth, BlockVector3 direction) Fills an area recursively in the X/Z directions.<B extends BlockStateHolder<B>>
intfillXZ
(BlockVector3 origin, B block, double radius, int depth, boolean recursive) Fills an area recursively in the X/Z directions.int
fillXZ
(BlockVector3 origin, Pattern pattern, double radius, int depth, boolean recursive) Fills an area recursively in the X/Z directions.int
fixLiquid
(BlockVector3 origin, double radius, BlockType fluid) Fix liquids so that they turn into stationary blocks and extend outward.void
Finish off the queue.void
Deprecated.Replace withclose()
for proper cleanup behavior.boolean
Check if this extent fully supports 3D biomes.void
getActor()
Get the Actor or null.Region[]
getBiome
(BlockVector3 position) Get the biome at the given location.Get theBlockBag
is used.int
Get the number of blocks changed, including repeated block changes.long
Deprecated.getBlockDistribution
(Region region, boolean separateStates) Get the block distribution inside a region.getBlockType
(int x, int y, int z) Get the underlyingChangeSet
.Get a list of all entities.getEntities
(Region region) Get a list of all entities within the given region.int
getHighestTerrainBlock
(int x, int z, int minY, int maxY) Returns the highest solid 'terrain' block.int
getHighestTerrainBlock
(int x, int z, int minY, int maxY, Mask filter) Returns the highest solid 'terrain' block.getHollowed
(Set<BlockVector3> vset) getLimit()
The limit for this specific edit (blocks etc).Returns the remaining limits.Returns a new limit representing how much of this edit's limit has been used so far.getMask()
Get the mask.Get the maximum point in the extent.Get the minimum point in the extent.getOutline
(Set<BlockVector3> vset) Returns the RegionExtent that will restrict an edit, or null.Get the reorder mode.Get the source mask.static Set
<BlockVector3> getStretched
(Set<BlockVector3> vset, double radius) Get theSurvivalModeExtent
.getWorld()
Get the world.int
green
(BlockVector3 position, double radius, boolean onlyNormalDirt) Deprecated.int
green
(BlockVector3 position, double radius, int height, boolean onlyNormalDirt) Make dirt green in a cylinder.boolean
Deprecated.int
hollowOutRegion
(Region region, int thickness, Pattern pattern, Mask mask) Hollows out the region (Semi-well-defined for non-cuboid selections).boolean
Returns chunk batching status.boolean
Deprecated.UsegetReorderMode()
with MULTI_STAGE instead.boolean
Check if this session will tick the watchdog.Lazily copy a regionint
makeBiomeShape
(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, String expressionString, boolean hollow) int
makeBiomeShape
(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, String expressionString, boolean hollow, int timeout) int
makeBlob
(BlockVector3 position, Pattern pattern, double size, double frequency, double amplitude, Vector3 radius, double sphericity) Makes a distorted sphere.int
makeCircle
(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled, Vector3 normal) int
makeCone
(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled, double thickness) Makes a cone.<B extends BlockStateHolder<B>>
intmakeCuboidFaces
(Region region, B block) Deprecated.int
makeCuboidFaces
(Region region, Pattern pattern) Make the faces of the given region as if it was aCuboidRegion
.<B extends BlockStateHolder<B>>
intmakeCuboidWalls
(Region region, B block) Make the walls (all faces but those parallel to the X-Z plane) of the given region as if it was aCuboidRegion
.int
makeCuboidWalls
(Region region, Pattern pattern) Make the walls (all faces but those parallel to the X-Z plane) of the given region as if it was aCuboidRegion
.int
makeCylinder
(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled) Makes a cylinder.int
makeCylinder
(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness, boolean filled) int
makeCylinder
(BlockVector3 pos, Pattern block, double radius, int height, boolean filled) Makes a cylinder.int
Make the faces of the given region.int
makeForest
(BlockVector3 basePosition, int size, double density, TreeGenerator.TreeType treeType) Makes a forest.int
makeForest
(Region region, double density, TreeGenerator.TreeType treeType) Makes a forest.int
makeHollowCylinder
(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness) int
makePumpkinPatches
(BlockVector3 position, int apothem) Makes pumpkin patches randomly in an area around the given position.int
makePumpkinPatches
(BlockVector3 position, int apothem, double density) int
makePyramid
(BlockVector3 position, Pattern block, int size, boolean filled) Makes a pyramid.int
makeShape
(Region region, Vector3 zero, Vector3 unit, Pattern pattern, String expressionString, boolean hollow) Generate a shape for the given expression.int
makeShape
(Region region, Vector3 zero, Vector3 unit, Pattern pattern, String expressionString, boolean hollow, int timeout) Generate a shape for the given expression.int
makeSphere
(BlockVector3 pos, Pattern block, double radius, boolean filled) Makes a sphere.int
makeSphere
(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled) Makes a sphere or ellipsoid.int
Make the walls of the given region.int
moveCuboidRegion
(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) Move the blocks in a region a certain direction.int
moveRegion
(Region region, BlockVector3 offset, int multiplier, boolean copyAir, boolean moveEntities, boolean copyBiomes, Pattern replacement) Move the blocks in a region a certain direction.int
moveRegion
(Region region, BlockVector3 offset, int multiplier, boolean moveEntities, boolean copyBiomes, Mask mask, Pattern replacement) Move the blocks in a region a certain direction.int
moveRegion
(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) Move the blocks in a region a certain direction.int
naturalizeCuboidBlocks
(Region region) Turns the first 3 layers into dirt/grass and the bottom layers into rock, like a natural Minecraft mountain.<B extends BlockStateHolder<B>>
intoverlayCuboidBlocks
(Region region, B block) Deprecated.int
overlayCuboidBlocks
(Region region, Pattern pattern) Places a layer of blocks on top of ground blocks in the given region (as if it were a cuboid).Gets the list of missing blocks and clears the list for the next operation.<B extends BlockStateHolder<B>>
booleanrawSetBlock
(BlockVector3 position, B block) Deprecated.Deprecated as may perform differently in FAWE.void
redo
(EditSession editSession) Sets to new state.boolean
regenerate
(Region region) boolean
regenerate
(Region region, EditSession session) boolean
regenerate
(Region region, BiomeType biome, Long seed) int
removeAbove
(BlockVector3 position, int apothem, int height) Remove a cuboid above the given position with a given apothem and a given height.int
removeBelow
(BlockVector3 position, int apothem, int height) Remove a cuboid below the given position with a given apothem and a given height.void
removeEntity
(int x, int y, int z, UUID uuid) Create an entity at the given location.int
removeNear
(BlockVector3 position, Mask mask, int apothem) Remove blocks of a certain type nearby a given position.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.void
void
setBatchingChunks
(boolean batchingChunks) Enable or disable chunk batching.boolean
boolean
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.<B extends BlockStateHolder<B>>
booleansetBlock
(int x, int y, int z, B block) boolean
Sets the block at a position, subject to both history and block re-ordering.<B extends BlockStateHolder<B>>
booleansetBlock
(BlockVector3 position, B block) Deprecated.<B extends BlockStateHolder<B>>
booleansetBlock
(BlockVector3 position, B block, EditSession.Stage stage) Deprecated.Deprecated as may perform differently in FAWE.boolean
setBlock
(BlockVector3 position, Pattern pattern) Sets the block at a position, subject to both history and block re-ordering.void
setBlockBag
(BlockBag blockBag) Set aBlockBag
to use.void
setBlockChangeLimit
(long limit) Set the maximum number of blocks that can be changed.void
setBlocks
(ChangeSet changeSet, ChangeSetExecutor.Type type) <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
setExtent
(AbstractDelegateExtent extent) void
setFastMode
(boolean enabled) Deprecated.void
Set a mask.void
Set the ChangeSet without hooking into any recording mechanism or triggering any actions.
Used internally to set the ChangeSet during completion to record custom changes which aren't normally recordedvoid
setReorderMode
(EditSession.ReorderMode reorderMode) Sets theEditSession.ReorderMode
of this EditSession, and flushes the session.void
setSideEffectApplier
(SideEffectSet sideEffectSet) Set which block updates should occur.void
setSize
(int size) void
setSourceMask
(Mask mask) Set a mask.void
setTickingWatchdog
(boolean active) Set all watchdog extents to the given mode.int
simulateSnow
(BlockVector3 position, double radius) Deprecated.int
simulateSnow
(BlockVector3 position, double radius, int height) Make snow in a cylinder.int
simulateSnow
(FlatRegion region, boolean stack) Make snow in a region.int
size()
Get the number of changed blocks.<B extends BlockStateHolder<B>>
booleansmartSetBlock
(BlockVector3 position, B block) Set a block, bypassing history but still utilizing block re-ordering.int
stackCuboidRegion
(Region region, BlockVector3 dir, int count, boolean copyAir) Stack a cuboid region.int
stackCuboidRegion
(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) Stack a cuboid region.int
stackRegionBlockUnits
(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) Stack a region using block units.int
thaw
(BlockVector3 position, double radius) Deprecated.int
thaw
(BlockVector3 position, double radius, int height) Thaw blocks in a cylinder.toString()
void
undo
(EditSession editSession) Restores all blocks to their initial state.Methods inherited from class com.fastasyncworldedit.core.extent.PassthroughExtent
addCaves, addOres, apply, apply, cancel, commit, contains, countBlocks, countBlocks, getBlock, getBlockDistribution, getBlockDistributionWithData, getFullBlock, getNearestSurfaceLayer, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, isWorld, regenerateChunk, setTile, spawnResource
Methods inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
addPostProcessor, addProcessor, commitBefore, disableHistory, getBiomeType, getBlock, getBrightness, getEmittedLight, getExtent, getFullBlock, getMaxY, getMinY, getSkyLight, relight, relightBlock, relightSky, setBlockLight, setChangeSet, setSkyLight, tile
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
-
Field Details
-
world
-
-
Method Details
-
getLimit
The limit for this specific edit (blocks etc).- Returns:
- The limit
-
resetLimit
public void resetLimit() -
getLimitUsed
Returns a new limit representing how much of this edit's limit has been used so far.- Returns:
- Limit remaining
-
getLimitLeft
Returns the remaining limits.- Returns:
- remaining limits
-
getRegionExtent
Returns the RegionExtent that will restrict an edit, or null.- Returns:
- FaweRegionExtent (may be null)
-
getBypassAll
-
getBypassHistory
-
setExtent
-
getActor
Get the Actor or null.- Returns:
- the actor
-
enableStandardMode
public void enableStandardMode()Turns on specific features for a normal WorldEdit session, such aschunk batching
. -
setReorderMode
Sets theEditSession.ReorderMode
of this EditSession, and flushes the session.- Parameters:
reorderMode
- The reorder mode
-
getReorderMode
Get the reorder mode.- Returns:
- the reorder mode
-
getWorld
Get the world.- Returns:
- the world
-
getChangeSet
Get the underlyingChangeSet
.- Returns:
- the change set
-
setRawChangeSet
Set the ChangeSet without hooking into any recording mechanism or triggering any actions.
Used internally to set the ChangeSet during completion to record custom changes which aren't normally recorded- Parameters:
set
- The ChangeSet to set
-
getBlockChangeLimit
Deprecated.Get the maximum number of blocks that can be changed. -1 will be returned if it the limit disabled.- Returns:
- the limit (>= 0) or -1 for no limit
- See Also:
-
setBlockChangeLimit
public void setBlockChangeLimit(long limit) Set the maximum number of blocks that can be changed.- Parameters:
limit
- the limit (>= 0) or -1 for no limit
-
isQueueEnabled
Deprecated.UsegetReorderMode()
with MULTI_STAGE instead.Returns queue status.- Specified by:
isQueueEnabled
in interfaceExtent
- Overrides:
isQueueEnabled
in classPassthroughExtent
- Returns:
- whether the queue is enabled
-
enableQueue
Deprecated.UsesetReorderMode(ReorderMode)
with MULTI_STAGE instead.Queue certain types of block for better reproduction of those blocks. UsesEditSession.ReorderMode.MULTI_STAGE
.- Specified by:
enableQueue
in interfaceExtent
- Overrides:
enableQueue
in classPassthroughExtent
-
disableQueue
Deprecated.Disable the queue. This will close the queue.- Specified by:
disableQueue
in interfaceExtent
- Overrides:
disableQueue
in classPassthroughExtent
-
getMask
Get the mask.- Returns:
- mask, may be null
-
getSourceMask
Get the source mask.- Returns:
- source mask, may be null
-
getAllowedRegions
-
addTransform
-
getTransform
-
setSourceMask
Set a mask.- Parameters:
mask
- mask or null
-
addSourceMask
-
setMask
Set a mask. Combines with any existing masks, set null to clear existing masks.- Parameters:
mask
- mask or null
-
getSurvivalExtent
Get theSurvivalModeExtent
.- Returns:
- the survival simulation extent
-
setFastMode
Deprecated.Set whether fast mode is enabled.Fast mode may skip lighting checks or adjacent block notification.
- Parameters:
enabled
- true to enable
-
setSideEffectApplier
Set which block updates should occur.- Parameters:
sideEffectSet
- side effects to enable
-
getSideEffectApplier
-
disableHistory
Deprecated.Disable history (or re-enable)- Parameters:
disableHistory
- whether to enable or disable.
-
hasFastMode
Deprecated.Return fast mode status.Fast mode may skip lighting checks or adjacent block notification.
- Returns:
- true if enabled
-
getBlockBag
Get theBlockBag
is used.- Returns:
- a block bag or null
-
setBlockBag
Set aBlockBag
to use.- Parameters:
blockBag
- the block bag to set, or null to use none
-
toString
- Overrides:
toString
in classAbstractDelegateExtent
-
popMissingBlocks
Gets the list of missing blocks and clears the list for the next operation.- Returns:
- a map of missing blocks
-
isBatchingChunks
public boolean isBatchingChunks()Returns chunk batching status.- Returns:
- whether chunk batching is enabled
-
setBatchingChunks
public void setBatchingChunks(boolean batchingChunks) Enable or disable chunk batching. Disabling will flush the session.- Parameters:
batchingChunks
-true
to enable,false
to disable
-
disableBuffering
public void disableBuffering()Disable all buffering extents.- See Also:
-
isTickingWatchdog
public boolean isTickingWatchdog()Check if this session will tick the watchdog.- Returns:
true
if any watchdog extent is enabled
-
setTickingWatchdog
public void setTickingWatchdog(boolean active) Set all watchdog extents to the given mode. -
getBlockChangeCount
public int getBlockChangeCount()Get the number of blocks changed, including repeated block changes.This number may not be accurate.
- Returns:
- the number of block changes
-
fullySupports3DBiomes
public boolean fullySupports3DBiomes()Description copied from interface:OutputExtent
Check if this extent fully supports 3D biomes.If
false
, the extent only visually reads biomes fromy = 0
. The biomes will still be set in 3D, but the client will only see the one aty = 0
. It is up to the caller to determine if they want to set that biome instead, or simply warn the actor.- Specified by:
fullySupports3DBiomes
in interfaceOutputExtent
- Overrides:
fullySupports3DBiomes
in classAbstractDelegateExtent
- Returns:
- if the extent fully supports 3D biomes
-
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:
-
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 classPassthroughExtent
- 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
-
getHighestTerrainBlock
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) Returns the highest solid 'terrain' block.- Specified by:
getHighestTerrainBlock
in interfaceExtent
- Overrides:
getHighestTerrainBlock
in classPassthroughExtent
- Parameters:
x
- the X coordinatez
- the Z coordinateminY
- minimal heightmaxY
- maximal height- Returns:
- height of highest block found or 'minY'
-
getHighestTerrainBlock
Returns the highest solid 'terrain' block.- Specified by:
getHighestTerrainBlock
in interfaceExtent
- Overrides:
getHighestTerrainBlock
in classPassthroughExtent
- 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'
-
getBlockType
-
setBlock
@Deprecated public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, EditSession.Stage stage) throws WorldEditException Deprecated.Deprecated as may perform differently in FAWE.Set a block, bypassing both history and block re-ordering.- Parameters:
position
- the position to set the block atblock
- the blockstage
- the level- Returns:
- whether the block changed
- Throws:
WorldEditException
- thrown on a set error
-
rawSetBlock
@Deprecated public <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block) Deprecated.Deprecated as may perform differently in FAWE.Set a block, bypassing both history and block re-ordering.- Parameters:
position
- the position to set the block atblock
- the block- Returns:
- whether the block changed
-
smartSetBlock
Set a block, bypassing history but still utilizing block re-ordering.- Parameters:
position
- the position to set the block atblock
- the block- Returns:
- whether the block changed
-
setBlock
@Deprecated public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException 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 classPassthroughExtent
- Parameters:
position
- position of the blockblock
- block to set- Returns:
- true if the block was successfully set (return value may not be accurate)
- Throws:
MaxChangedBlocksException
-
setBlock
- Specified by:
setBlock
in interfaceOutputExtent
- Overrides:
setBlock
in classAbstractDelegateExtent
-
setBlock
Sets the block at a position, subject to both history and block re-ordering.- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinatepattern
- a pattern to use- Returns:
- Whether the block changed -- not entirely dependable
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
setBlock
Sets the block at a position, subject to both history and block re-ordering.- Parameters:
position
- the positionpattern
- a pattern to use- Returns:
- Whether the block changed -- not entirely dependable
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
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 classPassthroughExtent
- 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 classPassthroughExtent
- 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
-
setBlocks
- Specified by:
setBlocks
in interfaceExtent
- Overrides:
setBlocks
in classPassthroughExtent
-
undo
Restores all blocks to their initial state.- Parameters:
editSession
- a newEditSession
to perform the undo in
-
setBlocks
-
redo
Sets to new state.- Parameters:
editSession
- a newEditSession
to perform the redo in
-
size
public int size()Get the number of changed blocks.- Returns:
- the number of changes
-
getMinimumPoint
Description copied from interface:Extent
Get the minimum point in the extent.If the extent is unbounded, then a large (negative) value may be returned.
- Specified by:
getMinimumPoint
in interfaceExtent
- Overrides:
getMinimumPoint
in classAbstractDelegateExtent
- Returns:
- the minimum point
-
getMaximumPoint
Description copied from interface:Extent
Get the maximum point in the extent.If the extent is unbounded, then a large (positive) value may be returned.
- Specified by:
getMaximumPoint
in interfaceExtent
- Overrides:
getMaximumPoint
in classAbstractDelegateExtent
- Returns:
- the maximum point
-
setSize
public void setSize(int size) -
close
public void close()Closing an EditSession flushes its buffers to the world, and performs other cleanup tasks.- Specified by:
close
in interfaceAutoCloseable
-
flushSession
Deprecated.Replace withclose()
for proper cleanup behavior.Communicate to the EditSession that all block changes are complete, and that it should apply them to the world. -
flushQueue
public void flushQueue()Finish off the queue. -
fall
-
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 classPassthroughExtent
- 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 classPassthroughExtent
- 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 classPassthroughExtent
- 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
-
fillDirection
public int fillDirection(BlockVector3 origin, Pattern pattern, double radius, int depth, BlockVector3 direction) throws MaxChangedBlocksException Fills an area recursively in the X/Z directions.- Parameters:
origin
- the location to start frompattern
- the block to fill withradius
- the radius of the spherical area to filldepth
- the maximum depth, starting from the origindirection
- the direction to fill- Returns:
- the number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
fillXZ
public <B extends BlockStateHolder<B>> int fillXZ(BlockVector3 origin, B block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException Fills an area recursively in the X/Z directions.- Parameters:
origin
- the location to start fromblock
- the block to fill withradius
- the radius of the spherical area to filldepth
- the maximum depth, starting from the originrecursive
- whether a breadth-first search should be performed- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
fillXZ
public int fillXZ(BlockVector3 origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException Fills an area recursively in the X/Z directions.- Parameters:
origin
- the origin to start the fill frompattern
- the pattern to fill withradius
- the radius of the spherical area to fill, with 0 as the smallest radiusdepth
- the maximum depth, starting from the origin, with 1 as the smallest depthrecursive
- whether a breadth-first search should be performed- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
removeAbove
public int removeAbove(BlockVector3 position, int apothem, int height) throws MaxChangedBlocksException Remove a cuboid above the given position with a given apothem and a given height.- Parameters:
position
- base positionapothem
- an apothem of the cuboid (on the XZ plane), where the minimum is 1height
- the height of the cuboid, where the minimum is 1- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
removeBelow
public int removeBelow(BlockVector3 position, int apothem, int height) throws MaxChangedBlocksException Remove a cuboid below the given position with a given apothem and a given height.- Parameters:
position
- base positionapothem
- an apothem of the cuboid (on the XZ plane), where the minimum is 1height
- the height of the cuboid, where the minimum is 1- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
removeNear
public int removeNear(BlockVector3 position, Mask mask, int apothem) throws MaxChangedBlocksException Remove blocks of a certain type nearby a given position.- Parameters:
position
- center position of cuboidmask
- the mask to matchapothem
- an apothem of the cuboid, where the minimum is 1- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
center
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.- Specified by:
center
in interfaceExtent
- Overrides:
center
in classPassthroughExtent
- 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
-
makeCuboidFaces
@Deprecated public <B extends BlockStateHolder<B>> int makeCuboidFaces(Region region, B block) throws MaxChangedBlocksException Deprecated.Make the faces of the given region as if it was aCuboidRegion
.- Parameters:
region
- the regionblock
- the block to place- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeCuboidFaces
Make the faces of the given region as if it was aCuboidRegion
.- Parameters:
region
- the regionpattern
- the pattern to place- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeFaces
Make the faces of the given region. The method by which the faces are found may be inefficient, because there may not be an efficient implementation supported for that specific shape.- Parameters:
region
- the regionpattern
- the pattern to place- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeCuboidWalls
public <B extends BlockStateHolder<B>> int makeCuboidWalls(Region region, B block) throws MaxChangedBlocksException Make the walls (all faces but those parallel to the X-Z plane) of the given region as if it was aCuboidRegion
.- Parameters:
region
- the regionblock
- the block to place- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeCuboidWalls
Make the walls (all faces but those parallel to the X-Z plane) of the given region as if it was aCuboidRegion
.- Parameters:
region
- the regionpattern
- the pattern to place- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeWalls
Make the walls of the given region. The method by which the walls are found may be inefficient, because there may not be an efficient implementation supported for that specific shape.- Parameters:
region
- the regionpattern
- the pattern to place- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
overlayCuboidBlocks
@Deprecated public <B extends BlockStateHolder<B>> int overlayCuboidBlocks(Region region, B block) throws MaxChangedBlocksException Deprecated.Places a layer of blocks on top of ground blocks in the given region (as if it were a cuboid).- Parameters:
region
- the regionblock
- the placed block- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
overlayCuboidBlocks
Places a layer of blocks on top of ground blocks in the given region (as if it were a cuboid).- Parameters:
region
- the regionpattern
- the placed block pattern- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
naturalizeCuboidBlocks
Turns the first 3 layers into dirt/grass and the bottom layers into rock, like a natural Minecraft mountain.- Parameters:
region
- the region to affect- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
stackCuboidRegion
public int stackCuboidRegion(Region region, BlockVector3 dir, int count, boolean copyAir) throws MaxChangedBlocksException Stack a cuboid region. For compatibility, entities are copied by biomes are not. UsestackCuboidRegion(Region, BlockVector3, int, boolean, boolean, Mask)
to fine tune.- Parameters:
region
- the region to stackdir
- the direction to stackcount
- the number of times to stackcopyAir
- true to also copy air blocks- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
stackCuboidRegion
public int stackCuboidRegion(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) throws MaxChangedBlocksException Stack a cuboid region.- Parameters:
region
- the region to stackoffset
- how far to move the contents each stack. Is directional.count
- the number of times to stackcopyEntities
- true to copy entitiescopyBiomes
- true to copy biomesmask
- source mask for the operation (only matching blocks are copied)- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
stackRegionBlockUnits
public int stackRegionBlockUnits(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) throws MaxChangedBlocksException, RegionOperationException Stack a region using block units.- Parameters:
region
- the region to stackoffset
- how far to move the contents each stack in block unitscount
- the number of times to stackcopyEntities
- true to copy entitiescopyBiomes
- true to copy biomesmask
- source mask for the operation (only matching blocks are copied)- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changedRegionOperationException
- thrown if the region operation is invalid
-
moveRegion
public int moveRegion(Region region, BlockVector3 offset, int multiplier, boolean copyAir, boolean moveEntities, boolean copyBiomes, Pattern replacement) throws MaxChangedBlocksException Move the blocks in a region a certain direction.- Parameters:
region
- the region to moveoffset
- the offset. Is directional.multiplier
- the number to multiply the offset bycopyAir
- true to copy air blocksmoveEntities
- true to move entitiescopyBiomes
- true to copy biomesreplacement
- the replacement pattern to fill in after moving, or null to use air- Returns:
- number of blocks moved
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
moveRegion
public int moveRegion(Region region, BlockVector3 offset, int multiplier, boolean moveEntities, boolean copyBiomes, Mask mask, Pattern replacement) throws MaxChangedBlocksException Move the blocks in a region a certain direction.- Parameters:
region
- the region to moveoffset
- the offset. Is directional.multiplier
- the number to multiply the offset bymoveEntities
- true to move entitiescopyBiomes
- true to copy biomes (source biome is unchanged)mask
- source mask for the operation (only matching blocks are moved)replacement
- the replacement pattern to fill in after moving, or null to use air- Returns:
- number of blocks moved
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changedIllegalArgumentException
- thrown if the region is not a flat region, but copyBiomes is true
-
moveCuboidRegion
public int moveCuboidRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) throws MaxChangedBlocksException Move the blocks in a region a certain direction.- Parameters:
region
- the region to movedir
- the directiondistance
- the distance to movecopyAir
- true to copy air blocksreplacement
- the replacement pattern to fill in after moving, or null to use air- Returns:
- number of blocks moved
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
drainArea
Drain nearby pools of water or lava.- Parameters:
origin
- the origin to drain from, which will search a 3x3 arearadius
- the radius of the removal, where a value should be 0 or greater- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
drainArea
public int drainArea(BlockVector3 origin, double radius, boolean waterlogged) throws MaxChangedBlocksException Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.- Parameters:
origin
- the origin to drain from, which will search a 3x3 arearadius
- the radius of the removal, where a value should be 0 or greaterwaterlogged
- true to make waterlogged blocks non-waterlogged as well- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
drainArea
public int drainArea(BlockVector3 origin, double radius, boolean waterlogged, boolean plants) throws MaxChangedBlocksException Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.- Parameters:
origin
- the origin to drain from, which will search a 3x3 arearadius
- the radius of the removal, where a value should be 0 or greaterwaterlogged
- true to make waterlogged blocks non-waterlogged as wellplants
- true to remove underwater plants- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
fixLiquid
public int fixLiquid(BlockVector3 origin, double radius, BlockType fluid) throws MaxChangedBlocksException Fix liquids so that they turn into stationary blocks and extend outward.- Parameters:
origin
- the original positionradius
- the radius to fixfluid
- the type of the fluid- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeCylinder
public int makeCylinder(BlockVector3 pos, Pattern block, double radius, int height, boolean filled) throws MaxChangedBlocksException Makes a cylinder.- Parameters:
pos
- Center of the cylinderblock
- The block pattern to useradius
- The cylinder's radiusheight
- The cylinder's up/down extent. If negative, extend downward.filled
- If false, only a shell will be generated.- Returns:
- number of blocks changed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeCylinder
public int makeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled) throws MaxChangedBlocksException Makes a cylinder.- Parameters:
pos
- Center of the cylinderblock
- The block pattern to useradiusX
- The cylinder's largest north/south extentradiusZ
- The cylinder's largest east/west extentheight
- The cylinder's up/down extent. If negative, extend downward.filled
- If false, only a shell will be generated.- Returns:
- number of blocks changed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeHollowCylinder
public int makeHollowCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness) throws MaxChangedBlocksException - Throws:
MaxChangedBlocksException
-
makeCylinder
public int makeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness, boolean filled) throws MaxChangedBlocksException - Throws:
MaxChangedBlocksException
-
makeCone
public int makeCone(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled, double thickness) throws MaxChangedBlocksException Makes a cone.- Parameters:
pos
- Center of the coneblock
- The block pattern to useradiusX
- The cone's largest north/south extentradiusZ
- The cone's largest east/west extentheight
- The cone's up/down extent. If negative, extend downward.filled
- If false, only a shell will be generated.thickness
- The cone's wall thickness, if it's hollow.- Returns:
- number of blocks changed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
moveRegion
public int moveRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) throws MaxChangedBlocksException Move the blocks in a region a certain direction.- Parameters:
region
- the region to movedir
- the directiondistance
- the distance to movecopyAir
- true to copy air blocksreplacement
- the replacement pattern to fill in after moving, or null to use air- Returns:
- number of blocks moved
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeCircle
public int makeCircle(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled, Vector3 normal) throws MaxChangedBlocksException - Throws:
MaxChangedBlocksException
-
makeSphere
public int makeSphere(BlockVector3 pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException Makes a sphere.- Parameters:
pos
- Center of the sphere or ellipsoidblock
- The block pattern to useradius
- The sphere's radiusfilled
- If false, only a shell will be generated.- Returns:
- number of blocks changed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeSphere
public int makeSphere(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled) throws MaxChangedBlocksException Makes a sphere or ellipsoid.- Parameters:
pos
- Center of the sphere or ellipsoidblock
- The block pattern to useradiusX
- The sphere/ellipsoid's largest north/south extentradiusY
- The sphere/ellipsoid's largest up/down extentradiusZ
- The sphere/ellipsoid's largest east/west extentfilled
- If false, only a shell will be generated.- Returns:
- number of blocks changed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makePyramid
public int makePyramid(BlockVector3 position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException Makes a pyramid.- Parameters:
position
- a positionblock
- a blocksize
- size of pyramidfilled
- true if filled- Returns:
- number of blocks changed
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
thaw
Deprecated.Thaw blocks in a radius.- Parameters:
position
- the positionradius
- the radius- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
thaw
Thaw blocks in a cylinder.- Parameters:
position
- the positionradius
- the radiusheight
- the height (upwards and downwards)- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
simulateSnow
@Deprecated public int simulateSnow(BlockVector3 position, double radius) throws MaxChangedBlocksException Deprecated.Make snow in a radius.- Parameters:
position
- a positionradius
- a radius- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
simulateSnow
public int simulateSnow(BlockVector3 position, double radius, int height) throws MaxChangedBlocksException Make snow in a cylinder.- Parameters:
position
- a positionradius
- a radiusheight
- the height (upwards and downwards)- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
simulateSnow
Make snow in a region.- Parameters:
region
- the region to simulate snow instack
- whether it should stack existing snow- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
green
@Deprecated public int green(BlockVector3 position, double radius, boolean onlyNormalDirt) throws MaxChangedBlocksException Deprecated.Make dirt green.- Parameters:
position
- a positionradius
- a radiusonlyNormalDirt
- only affect normal dirt (all default properties)- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
green
public int green(BlockVector3 position, double radius, int height, boolean onlyNormalDirt) throws MaxChangedBlocksException Make dirt green in a cylinder.- Parameters:
position
- the positionradius
- the radiusheight
- the heightonlyNormalDirt
- only affect normal dirt (all default properties)- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makePumpkinPatches
Makes pumpkin patches randomly in an area around the given position.- Parameters:
position
- the base positionapothem
- the apothem of the (square) area- Returns:
- number of patches created
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makePumpkinPatches
public int makePumpkinPatches(BlockVector3 position, int apothem, double density) throws MaxChangedBlocksException - Throws:
MaxChangedBlocksException
-
makeForest
public int makeForest(BlockVector3 basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException Makes a forest.- Parameters:
basePosition
- a positionsize
- a sizedensity
- between 0 and 1, inclusivetreeType
- the tree type- Returns:
- number of trees created
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
makeForest
public int makeForest(Region region, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException Makes a forest.- Parameters:
region
- the region to generate trees indensity
- between 0 and 1, inclusivetreeType
- the tree type- Returns:
- number of trees created
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
getBlockDistribution
Get the block distribution inside a region.- Parameters:
region
- a region- Returns:
- the results
-
makeShape
public int makeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, String expressionString, boolean hollow) throws ExpressionException, MaxChangedBlocksException Generate a shape for the given expression.- Parameters:
region
- the region to generate the shape inzero
- the coordinate origin for x/y/z variablesunit
- the scale of the x/y/z/ variablespattern
- the default material to make the shape fromexpressionString
- the expression defining the shapehollow
- whether the shape should be hollow- Returns:
- number of blocks changed
- Throws:
ExpressionException
- if there is a problem with the expressionMaxChangedBlocksException
- if the maximum block change limit is exceeded
-
makeShape
public int makeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, String expressionString, boolean hollow, int timeout) throws ExpressionException, MaxChangedBlocksException Generate a shape for the given expression.- Parameters:
region
- the region to generate the shape inzero
- the coordinate origin for x/y/z variablesunit
- the scale of the x/y/z/ variablespattern
- the default material to make the shape fromexpressionString
- the expression defining the shapehollow
- whether the shape should be hollowtimeout
- the time, in milliseconds, to wait for each expression evaluation before halting it. -1 to disable- Returns:
- number of blocks changed
- Throws:
ExpressionException
- if there is a problem with the expressionMaxChangedBlocksException
- if the maximum block change limit is exceeded
-
deformRegion
public int deformRegion(Region region, Vector3 zero, Vector3 unit, String expressionString) throws ExpressionException, MaxChangedBlocksException Deforms the region by a given expression. A deform provides a block's x, y, and z coordinates (possibly scaled) to an expression, and then sets the block to the block given by the resulting values of the variables, if they have changed.- Parameters:
region
- the region to deformzero
- the origin of the coordinate systemunit
- the scale of the coordinate systemexpressionString
- the expression to evaluate for each block- Returns:
- number of blocks changed
- Throws:
ExpressionException
- thrown on invalid expression inputMaxChangedBlocksException
- thrown if too many blocks are changed
-
deformRegion
public int deformRegion(Region region, Vector3 zero, Vector3 unit, String expressionString, int timeout) throws ExpressionException, MaxChangedBlocksException Deforms the region by a given expression. A deform provides a block's x, y, and z coordinates (possibly scaled) to an expression, and then sets the block to the block given by the resulting values of the variables, if they have changed.- Parameters:
region
- the region to deformzero
- the origin of the coordinate systemunit
- the scale of the coordinate systemexpressionString
- the expression to evaluate for each blocktimeout
- maximum time for the expression to evaluate for each block. -1 for unlimited.- Returns:
- number of blocks changed
- Throws:
ExpressionException
- thrown on invalid expression inputMaxChangedBlocksException
- thrown if too many blocks are changed
-
deformRegion
public int deformRegion(Region region, Vector3 zero, Vector3 unit, Expression expression, int timeout) throws ExpressionException, MaxChangedBlocksException Internal version ofdeformRegion(Region, Vector3, Vector3, String, int)
.The Expression class is subject to change. Expressions should be provided via the string overload.
-
hollowOutRegion
Hollows out the region (Semi-well-defined for non-cuboid selections).- Parameters:
region
- the region to hollow out.thickness
- the thickness of the shell to leave (manhattan distance)pattern
- The block pattern to use- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
drawLine
public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled) throws MaxChangedBlocksException - Throws:
MaxChangedBlocksException
-
drawLine
public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat) throws MaxChangedBlocksException Draws a line (out of blocks) between two vectors.- Parameters:
pattern
- The block pattern used to draw the line.pos1
- One of the points that define the line.pos2
- The other point that defines the line.radius
- The radius (thickness) of the line.filled
- If false, only a shell will be generated.- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed- See Also:
-
drawLine
public int drawLine(Pattern pattern, List<BlockVector3> vectors, double radius, boolean filled) throws MaxChangedBlocksException Draws a line (out of blocks) between two or more vectors.- Parameters:
pattern
- The block pattern used to draw the line.vectors
- the list of vectors to draw the line betweenradius
- The radius (thickness) of the line.filled
- If false, only a shell will be generated.- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
drawSpline
public int drawSpline(Pattern pattern, List<BlockVector3> nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) throws MaxChangedBlocksException Draws a spline (out of blocks) between specified vectors.- Parameters:
pattern
- The block pattern used to draw the spline.nodevectors
- The list of vectors to draw through.tension
- The tension of every node.bias
- The bias of every node.continuity
- The continuity of every node.quality
- The quality of the spline. Must be greater than 0.radius
- The radius (thickness) of the spline.filled
- If false, only a shell will be generated.- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException
- thrown if too many blocks are changed
-
getStretched
-
getOutline
-
getHollowed
-
makeBiomeShape
public int makeBiomeShape(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, String expressionString, boolean hollow) throws ExpressionException - Throws:
ExpressionException
-
makeBiomeShape
public int makeBiomeShape(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, String expressionString, boolean hollow, int timeout) throws ExpressionException - Throws:
ExpressionException
-
regenerate
-
regenerate
-
regenerate
-
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
-
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
-
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
-
generate
- Specified by:
generate
in interfaceExtent
- Overrides:
generate
in classPassthroughExtent
- Throws:
WorldEditException
-
addSchems
public void addSchems(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException - Specified by:
addSchems
in interfaceExtent
- Overrides:
addSchems
in classPassthroughExtent
- Throws:
WorldEditException
-
addOre
public void addOre(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException - Specified by:
addOre
in interfaceExtent
- Overrides:
addOre
in classPassthroughExtent
- Throws:
WorldEditException
-
lazyCopy
Description copied from interface:Extent
Lazily copy a region- Specified by:
lazyCopy
in interfaceExtent
- Overrides:
lazyCopy
in classPassthroughExtent
- Parameters:
region
-- Returns:
-
makeBlob
public int makeBlob(BlockVector3 position, Pattern pattern, double size, double frequency, double amplitude, Vector3 radius, double sphericity) Makes a distorted sphere.- Parameters:
position
- Center of blobpattern
- pattern to usesize
- overall size of the blobfrequency
- distortion amount (0 to 1)amplitude
- distortion amplitude (0 to 1)radius
- radii to multiply x/y/z bysphericity
- how spherical to make the blob. 1 = very spherical, 0 = not- Returns:
- changes
-
setReorderMode(ReorderMode)
with MULTI_STAGE instead.