Class EditSession
- All Implemented Interfaces:
Extent,InputExtent,OutputExtent,AutoCloseable
Extent that handles history, BlockBags, 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
Extents that are chained together. For example, history is logged
using the ChangeSetExtent.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeprecated.static enumUsed bysetBlock(BlockVector3, BlockStateHolder, Stage)to determine whichExtents should be bypassed. -
Field Summary
FieldsFields inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
extent -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOre(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) voidaddSchems(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) voidaddSourceMask(Mask mask) voidaddTransform(ResettableExtent transform) intSets the blocks at the center of the given region to the given pattern.voidclose()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.intdeformRegion(Region region, Vector3 zero, Vector3 unit, Expression expression, int timeout) Internal version ofdeformRegion(Region, Vector3, Vector3, String, int).intdeformRegion(Region region, Vector3 zero, Vector3 unit, String expressionString) Deforms the region by a given expression.intdeformRegion(Region region, Vector3 zero, Vector3 unit, String expressionString, int timeout) Deforms the region by a given expression.voidDisable all buffering extents.voiddisableHistory(boolean disableHistory) Deprecated.voidDeprecated.intdrainArea(BlockVector3 origin, double radius) Drain nearby pools of water or lava.intdrainArea(BlockVector3 origin, double radius, boolean waterlogged) Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.intdrainArea(BlockVector3 origin, double radius, boolean waterlogged, boolean plants) Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.intdrawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled) intdrawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat) Draws a line (out of blocks) between two vectors.intdrawLine(Pattern pattern, List<BlockVector3> vectors, double radius, boolean filled) Draws a line (out of blocks) between two or more vectors.intdrawSpline(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.voidDeprecated.There is no specific replacement, instead enable what you want specifically.voidTurns on specific features for a normal WorldEdit session, such aschunk batching.<B extends BlockStateHolder<B>>
intintfillDirection(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.intfillXZ(BlockVector3 origin, Pattern pattern, double radius, int depth, boolean recursive) Fills an area recursively in the X/Z directions.intfixLiquid(BlockVector3 origin, double radius, BlockType fluid) Fix liquids so that they turn into stationary blocks and extend outward.voidFinish off the queue.voidDeprecated.Replace withclose()for proper cleanup behavior.booleanCheck if this extent fully supports 3D biomes.voidgetActor()Get the Actor or null.Region[]getBiome(BlockVector3 position) Get the biome at the given location.Get theBlockBagis used.intGet the number of blocks changed, including repeated block changes.longDeprecated.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.intgetHighestTerrainBlock(int x, int z, int minY, int maxY) Returns the highest solid 'terrain' block.intgetHighestTerrainBlock(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.Deprecated.Get the source mask.static Set<BlockVector3> getStretched(Set<BlockVector3> vset, double radius) Get theSurvivalModeExtent.getWorld()Get the world.intgreen(BlockVector3 position, double radius, boolean onlyNormalDirt) Deprecated.intgreen(BlockVector3 position, double radius, int height, boolean onlyNormalDirt) Make dirt green in a cylinder.booleanDeprecated.inthollowOutRegion(Region region, int thickness, Pattern pattern, Mask mask) Hollows out the region (Semi-well-defined for non-cuboid selections).booleanReturns chunk batching status.booleanCheck if this session has any buffering extents enabled.booleanDeprecated.UseisBufferingEnabled()instead.booleanCheck if this session will tick the watchdog.booleanGets whether this EditSession will track history.Lazily copy a regionintmakeBiomeShape(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, String expressionString, boolean hollow) intmakeBiomeShape(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, String expressionString, boolean hollow, int timeout) intmakeBlob(BlockVector3 position, Pattern pattern, double size, double frequency, double amplitude, Vector3 radius, double sphericity) Makes a distorted sphere.intmakeCircle(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled, Vector3 normal) intmakeCone(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.intmakeCuboidFaces(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.intmakeCuboidWalls(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.intmakeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled) Makes a cylinder.intmakeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness, boolean filled) intmakeCylinder(BlockVector3 pos, Pattern block, double radius, int height, boolean filled) Makes a cylinder.intMake the faces of the given region.intmakeForest(BlockVector3 basePosition, int size, double density, TreeGenerator.TreeType treeType) Makes a forest.intmakeForest(Region region, double density, TreeGenerator.TreeType treeType) Makes a forest.intmakeHollowCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness) intmakePumpkinPatches(BlockVector3 position, int apothem) Makes pumpkin patches randomly in an area around the given position.intmakePumpkinPatches(BlockVector3 position, int apothem, double density) intmakePyramid(BlockVector3 position, Pattern block, int size, boolean filled) Makes a pyramid.intmakeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, String expressionString, boolean hollow) Generate a shape for the given expression.intmakeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, String expressionString, boolean hollow, int timeout) Generate a shape for the given expression.intmakeSphere(BlockVector3 pos, Pattern block, double radius, boolean filled) Makes a sphere.intmakeSphere(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled) Makes a sphere or ellipsoid.intMake the walls of the given region.intmorph(BlockVector3 position, double brushSize, int minErodeFaces, int numErodeIterations, int minDilateFaces, int numDilateIterations) intmoveCuboidRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) Move the blocks in a region a certain direction.intmoveRegion(Region region, BlockVector3 offset, int multiplier, boolean copyAir, boolean moveEntities, boolean copyBiomes, Pattern replacement) Move the blocks in a region a certain direction.intmoveRegion(Region region, BlockVector3 offset, int multiplier, boolean moveEntities, boolean copyBiomes, Mask mask, Pattern replacement) Move the blocks in a region a certain direction.intmoveRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) Move the blocks in a region a certain direction.intnaturalizeCuboidBlocks(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.intoverlayCuboidBlocks(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.voidredo(EditSession editSession) Sets to new state.booleanregenerate(Region region) booleanregenerate(Region region, EditSession session) booleanregenerate(Region region, BiomeType biome, Long seed) intremoveAbove(BlockVector3 position, int apothem, int height) Remove a cuboid above the given position with a given apothem and a given height.intremoveBelow(BlockVector3 position, int apothem, int height) Remove a cuboid below the given position with a given apothem and a given height.voidremoveEntity(int x, int y, int z, UUID uuid) Create an entity at the given location.intremoveNear(BlockVector3 position, Mask mask, int apothem) Remove blocks of a certain type nearby a given position.intreplaceBlocks(Region region, Mask mask, Pattern pattern) Replaces all the blocks matching a given mask, within a given region, to a block returned by a given pattern.<B extends BlockStateHolder<B>>
intreplaceBlocks(Region region, Set<BaseBlock> filter, B replacement) Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.intreplaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) Replaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.voidvoidsetBatchingChunks(boolean batchingChunks) Enable or disable chunk batching.booleanbooleansetBiome(BlockVector3 position, BiomeType biome) Set the biome.<B extends BlockStateHolder<B>>
booleansetBlock(int x, int y, int z, B block) booleanSets 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.booleansetBlock(BlockVector3 position, Pattern pattern) Sets the block at a position, subject to both history and block re-ordering.voidsetBlockBag(BlockBag blockBag) Set aBlockBagto use.voidsetBlockChangeLimit(long limit) Set the maximum number of blocks that can be changed.voidsetBlocks(ChangeSet changeSet, ChangeSetExecutor.Type type) <B extends BlockStateHolder<B>>
intSets all the blocks inside a region to a given block type.intSets all the blocks inside a region to a given pattern.intsetBlocks(Set<BlockVector3> vset, Pattern pattern) voidsetExtent(AbstractDelegateExtent extent) voidsetFastMode(boolean enabled) Deprecated.voidSet a mask.voidSet 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 recordedvoidsetReorderMode(EditSession.ReorderMode reorderMode) Deprecated.voidsetSideEffectApplier(SideEffectSet sideEffectSet) Set which block updates should occur.voidsetSize(int size) voidsetSourceMask(Mask mask) Set a mask.voidsetTickingWatchdog(boolean active) Set all watchdog extents to the given mode.voidsetTrackingHistory(boolean trackHistory) Sets whether this EditSession will track history.intsimulateSnow(BlockVector3 position, double radius) Deprecated.intsimulateSnow(BlockVector3 position, double radius, int height) Make snow in a cylinder.intsimulateSnow(FlatRegion region, boolean stack) Make snow in a region.intsize()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.intstackCuboidRegion(Region region, BlockVector3 dir, int count, boolean copyAir) Stack a cuboid region.intstackCuboidRegion(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) Stack a cuboid region.intstackRegionBlockUnits(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) Stack a region using block units.intthaw(BlockVector3 position, double radius) Deprecated.intthaw(BlockVector3 position, double radius, int height) Thaw blocks in a cylinder.toString()voidundo(EditSession editSession) Restores all blocks to their initial state.Methods inherited from class com.fastasyncworldedit.core.extent.PassthroughExtent
addCaves, addOres, apply, apply, cancel, contains, countBlocks, countBlocks, getBiomeType, getBlock, getBlock, getBlockDistribution, getBlockDistributionWithData, getFullBlock, getFullBlock, getNearestSurfaceLayer, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, isWorld, regenerateChunk, setTile, spawnResourceMethods inherited from class com.sk89q.worldedit.extent.AbstractDelegateExtent
addPostProcessor, addProcessor, commit, commitBefore, disableHistory, getBrightness, getEmittedLight, getExtent, getMaxY, getMinY, getSkyLight, relight, relightBlock, relightSky, setBlockLight, setChangeSet, setSkyLight, tileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.sk89q.worldedit.extent.Extent
contains, enableHistoryMethods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBrightness, getEmittedLight, getHeightMap, getOpacity, getOpacity, getSkyLightMethods inherited from interface com.sk89q.worldedit.extent.OutputExtent
setBiome, setBlockLight, setHeightMap, setSkyLight
-
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
Deprecated.Sets theEditSession.ReorderModeof this EditSession, and flushes the session.- Parameters:
reorderMode- The reorder mode
-
getReorderMode
Deprecated.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.UseisBufferingEnabled()instead.Returns queue status.- Specified by:
isQueueEnabledin interfaceExtent- Overrides:
isQueueEnabledin classPassthroughExtent- Returns:
- whether the queue is enabled
-
enableQueue
Deprecated.There is no specific replacement, instead enable what you want specifically.Queue certain types of block for better reproduction of those blocks. UsesEditSession.ReorderMode.MULTI_STAGE.- Specified by:
enableQueuein interfaceExtent- Overrides:
enableQueuein classPassthroughExtent
-
disableQueue
Deprecated.UsedisableBuffering()instead.Disable the queue. This will flush the session.- Specified by:
disableQueuein interfaceExtent- Overrides:
disableQueuein 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 theBlockBagis used.- Returns:
- a block bag or null
-
setBlockBag
Set aBlockBagto use.- Parameters:
blockBag- the block bag to set, or null to use none
-
toString
- Overrides:
toStringin 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-trueto enable,falseto disable
-
isBufferingEnabled
public boolean isBufferingEnabled()Check if this session has any buffering extents enabled.- Returns:
trueif any extents are buffering
-
disableBuffering
public void disableBuffering()Disable all buffering extents.- See Also:
-
isTickingWatchdog
public boolean isTickingWatchdog()Check if this session will tick the watchdog.- Returns:
trueif 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:OutputExtentCheck 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:
fullySupports3DBiomesin interfaceOutputExtent- Overrides:
fullySupports3DBiomesin classAbstractDelegateExtent- Returns:
- if the extent fully supports 3D biomes
-
getBiome
Description copied from interface:InputExtentGet the biome at the given location.If there is no biome available, then the ocean biome should be returned.
As implementation varies per Minecraft version, this may not exactly get this positions biome. On versions prior to 1.15, this will get the entire column. On later versions it will get the 4x4x4 cube's biome.
- Specified by:
getBiomein interfaceInputExtent- Overrides:
getBiomein classPassthroughExtent- 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:OutputExtentSet the biome.As implementation varies per Minecraft version, this may set more than this position's biome. On versions prior to 1.15, this will set the entire column. On later versions it will set the 4x4x4 cube.
- Specified by:
setBiomein interfaceOutputExtent- Overrides:
setBiomein 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:
setBiomein interfaceOutputExtent- Overrides:
setBiomein classPassthroughExtent
-
getHighestTerrainBlock
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) Returns the highest solid 'terrain' block.- Specified by:
getHighestTerrainBlockin interfaceExtent- Overrides:
getHighestTerrainBlockin 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:
getHighestTerrainBlockin interfaceExtent- Overrides:
getHighestTerrainBlockin 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:OutputExtentChange the block at the given location to the given block. The operation may not tie the givenBlockStateHolderto the world, so future changes to theBlockStateHolderdo not affect the world until this method is called again.The return value of this method indicates whether the change was probably successful. It may not be successful if, for example, the location is out of the bounds of the extent. It may be unsuccessful if the block passed is the same as the one in the world. However, the return value is only an estimation and it may be incorrect, but it could be used to count, for example, the approximate number of changes.
- Specified by:
setBlockin interfaceOutputExtent- Overrides:
setBlockin 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:
setBlockin interfaceOutputExtent- Overrides:
setBlockin classPassthroughExtent
-
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:ExtentSets all the blocks inside a region to a given block type.- Specified by:
setBlocksin interfaceExtent- Overrides:
setBlocksin 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:ExtentSets all the blocks inside a region to a given pattern.- Specified by:
setBlocksin interfaceExtent- Overrides:
setBlocksin 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:
setBlocksin interfaceExtent- Overrides:
setBlocksin classPassthroughExtent
-
undo
Restores all blocks to their initial state.- Parameters:
editSession- a newEditSessionto perform the undo in
-
setBlocks
-
redo
Sets to new state.- Parameters:
editSession- a newEditSessionto perform the redo in
-
isTrackingHistory
public boolean isTrackingHistory()Gets whether this EditSession will track history.- Returns:
- whether history is tracked
-
setTrackingHistory
public void setTrackingHistory(boolean trackHistory) Sets whether this EditSession will track history.- Parameters:
trackHistory- whether to track history
-
size
public int size()Get the number of changed blocks.- Returns:
- the number of changes
-
getMinimumPoint
Description copied from interface:ExtentGet the minimum point in the extent.If the extent is unbounded, then a large (negative) value may be returned.
- Specified by:
getMinimumPointin interfaceExtent- Overrides:
getMinimumPointin classAbstractDelegateExtent- Returns:
- the minimum point
-
getMaximumPoint
Description copied from interface:ExtentGet the maximum point in the extent.If the extent is unbounded, then a large (positive) value may be returned.
- Specified by:
getMaximumPointin interfaceExtent- Overrides:
getMaximumPointin 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:
closein 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:ExtentReplaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocksin interfaceExtent- Overrides:
replaceBlocksin classPassthroughExtent- Parameters:
region- the region to replace the blocks withinfilter- a list of block types to match, or null to useExistingBlockMaskreplacement- the replacement block- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException- thrown if too many blocks are changed
-
replaceBlocks
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException Description copied from interface:ExtentReplaces all the blocks matching a given filter, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocksin interfaceExtent- Overrides:
replaceBlocksin classPassthroughExtent- Parameters:
region- the region to replace the blocks withinfilter- a list of block types to match, or null to useExistingBlockMaskpattern- the pattern that provides the new blocks- Returns:
- number of blocks affected
- Throws:
MaxChangedBlocksException- thrown if too many blocks are changed
-
replaceBlocks
public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException Description copied from interface:ExtentReplaces all the blocks matching a given mask, within a given region, to a block returned by a given pattern.- Specified by:
replaceBlocksin interfaceExtent- Overrides:
replaceBlocksin 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:
centerin interfaceExtent- Overrides:
centerin 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
-
morph
public int morph(BlockVector3 position, double brushSize, int minErodeFaces, int numErodeIterations, int minDilateFaces, int numDilateIterations) throws MaxChangedBlocksException - Throws:
MaxChangedBlocksException
-
regenerate
-
regenerate
-
regenerate
-
getEntities
Description copied from interface:ExtentGet a list of all entities.If the extent is not wholly loaded (i.e. a world being simulated in the game will not have every chunk loaded), then this list may not be incomplete.
- Specified by:
getEntitiesin interfaceExtent- Overrides:
getEntitiesin classPassthroughExtent- Returns:
- a list of entities
-
getEntities
Description copied from interface:ExtentGet a list of all entities within the given region.If the extent is not wholly loaded (i.e. a world being simulated in the game will not have every chunk loaded), then this list may not be incomplete.
- Specified by:
getEntitiesin interfaceExtent- Overrides:
getEntitiesin classPassthroughExtent- Parameters:
region- the region in which entities must be contained- Returns:
- a list of entities
-
createEntity
Description copied from interface:ExtentCreate an entity at the given location.- Specified by:
createEntityin interfaceExtent- Overrides:
createEntityin classPassthroughExtent- Parameters:
location- the locationentity- the entity- Returns:
- a reference to the created entity, or null if the entity could not be created
-
createEntity
Description copied from interface:ExtentCreate an entity at the given location, forcing a UUID onto the entity Only use if you are aware of the consequences of forcing a UUID to an entity.- Specified by:
createEntityin interfaceExtent- Overrides:
createEntityin classPassthroughExtent- Parameters:
location- the locationentity- the entityuuid- UUID to force the entity to have- Returns:
- a reference to the created entity, or null if the entity could not be created
-
removeEntity
Description copied from interface:ExtentCreate an entity at the given location.- Specified by:
removeEntityin interfaceExtent- Overrides:
removeEntityin classPassthroughExtent- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinateuuid- the unique identifier of the entity
-
generate
- Specified by:
generatein interfaceExtent- Overrides:
generatein classPassthroughExtent- Throws:
WorldEditException
-
addSchems
public void addSchems(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException - Specified by:
addSchemsin interfaceExtent- Overrides:
addSchemsin 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:
addOrein interfaceExtent- Overrides:
addOrein classPassthroughExtent- Throws:
WorldEditException
-
lazyCopy
Description copied from interface:ExtentLazily copy a region- Specified by:
lazyCopyin interfaceExtent- Overrides:
lazyCopyin 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
-
disableBuffering()instead.