public class EditSession extends java.lang.Object implements Extent, java.lang.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
.
Modifier and Type | Class and Description |
---|---|
static class |
EditSession.ReorderMode
Reorder mode for
setReorderMode(ReorderMode) . |
static class |
EditSession.Stage
Used by
setBlock(BlockVector3, BlockStateHolder, Stage) to
determine which Extent s should be bypassed. |
Modifier and Type | Method and Description |
---|---|
int |
center(Region region,
Pattern pattern)
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.
|
Operation |
commit()
Return an
Operation that should be called to tie up loose ends
(such as to commit changes in a buffer). |
int |
countBlocks(Region region,
Mask searchMask)
Count the number of blocks of a list of types in a region.
|
int |
countBlocks(Region region,
java.util.Set<BaseBlock> searchBlocks)
Count the number of blocks of a list of types in a region.
|
Entity |
createEntity(Location location,
BaseEntity entity)
Create an entity at the given location.
|
int |
deformRegion(Region region,
Vector3 zero,
Vector3 unit,
Expression expression,
int timeout)
Internal version of
deformRegion(Region, Vector3, Vector3, String, int) . |
int |
deformRegion(Region region,
Vector3 zero,
Vector3 unit,
java.lang.String expressionString)
Deforms the region by a given expression.
|
int |
deformRegion(Region region,
Vector3 zero,
Vector3 unit,
java.lang.String expressionString,
int timeout)
Deforms the region by a given expression.
|
void |
disableBuffering()
Disable all buffering extents.
|
void |
disableQueue()
Deprecated.
Use
setReorderMode(ReorderMode) with another mode instead. |
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 |
drawLine(Pattern pattern,
BlockVector3 pos1,
BlockVector3 pos2,
double radius,
boolean filled)
Draws a line (out of blocks) between two vectors.
|
int |
drawLine(Pattern pattern,
java.util.List<BlockVector3> vectors,
double radius,
boolean filled)
Draws a line (out of blocks) between two or more vectors.
|
int |
drawSpline(Pattern pattern,
java.util.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 |
enableQueue()
Deprecated.
Use
setReorderMode(ReorderMode) with MULTI_STAGE instead. |
void |
enableStandardMode()
Turns on specific features for a normal WorldEdit session, such as
chunk batching . |
<B extends BlockStateHolder<B>> |
fillXZ(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 |
flushSession()
Deprecated.
Replace with
close() for proper cleanup behavior. |
boolean |
fullySupports3DBiomes()
Check if this extent fully supports 3D biomes.
|
BiomeType |
getBiome(BlockVector3 position)
Get the biome at the given location.
|
BlockState |
getBlock(BlockVector3 position)
Get a snapshot of the block at the given location.
|
BlockBag |
getBlockBag()
Get the
BlockBag is used. |
int |
getBlockChangeCount()
Get the number of blocks changed, including repeated block changes.
|
int |
getBlockChangeLimit()
Get the maximum number of blocks that can be changed.
|
java.util.List<Countable<BlockState>> |
getBlockDistribution(Region region,
boolean separateStates)
Get the block distribution inside a region.
|
ChangeSet |
getChangeSet()
Get the underlying
ChangeSet . |
java.util.List<? extends Entity> |
getEntities()
Get a list of all entities.
|
java.util.List<? extends Entity> |
getEntities(Region region)
Get a list of all entities within the given region.
|
BaseBlock |
getFullBlock(BlockVector3 position)
Get a immutable snapshot of the block at the given location.
|
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.
|
Mask |
getMask()
Get the mask.
|
BlockVector3 |
getMaximumPoint()
Get the maximum point in the extent.
|
BlockVector3 |
getMinimumPoint()
Get the minimum point in the extent.
|
EditSession.ReorderMode |
getReorderMode()
Get the reorder mode.
|
SideEffectSet |
getSideEffectApplier() |
SurvivalModeExtent |
getSurvivalExtent()
Get the
SurvivalModeExtent . |
World |
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 |
hasFastMode()
Deprecated.
|
int |
hollowOutRegion(Region region,
int thickness,
Pattern pattern)
Hollows out the region (Semi-well-defined for non-cuboid selections).
|
boolean |
isBatchingChunks()
Returns chunk batching status.
|
boolean |
isQueueEnabled()
Deprecated.
Use
getReorderMode() with MULTI_STAGE instead. |
boolean |
isTickingWatchdog()
Check if this session will tick the watchdog.
|
int |
makeBiomeShape(Region region,
Vector3 zero,
Vector3 unit,
BiomeType biomeType,
java.lang.String expressionString,
boolean hollow) |
int |
makeBiomeShape(Region region,
Vector3 zero,
Vector3 unit,
BiomeType biomeType,
java.lang.String expressionString,
boolean hollow,
int timeout) |
<B extends BlockStateHolder<B>> |
makeCuboidFaces(Region region,
B block)
Deprecated.
|
int |
makeCuboidFaces(Region region,
Pattern pattern)
Make the faces of the given region as if it was a
CuboidRegion . |
<B extends BlockStateHolder<B>> |
makeCuboidWalls(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 a
CuboidRegion . |
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 a
CuboidRegion . |
int |
makeCylinder(BlockVector3 pos,
Pattern block,
double radiusX,
double radiusZ,
int height,
boolean filled)
Makes a cylinder.
|
int |
makeCylinder(BlockVector3 pos,
Pattern block,
double radius,
int height,
boolean filled)
Makes a cylinder.
|
int |
makeFaces(Region region,
Pattern pattern)
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 |
makePumpkinPatches(BlockVector3 position,
int apothem)
Makes pumpkin patches randomly in an area around the given position.
|
int |
makePyramid(BlockVector3 position,
Pattern block,
int size,
boolean filled)
Makes a pyramid.
|
int |
makeShape(Region region,
Vector3 zero,
Vector3 unit,
Pattern pattern,
Expression expression,
boolean hollow,
int timeout)
Internal version of
makeShape(Region, Vector3, Vector3, Pattern, String, boolean, int) . |
int |
makeShape(Region region,
Vector3 zero,
Vector3 unit,
Pattern pattern,
java.lang.String expressionString,
boolean hollow)
Generate a shape for the given expression.
|
int |
makeShape(Region region,
Vector3 zero,
Vector3 unit,
Pattern pattern,
java.lang.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 |
makeWalls(Region region,
Pattern pattern)
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 moveEntities,
boolean copyBiomes,
Mask mask,
Pattern replacement)
Move the blocks in a region a certain direction.
|
int |
moveRegion(Region region,
BlockVector3 offset,
int multiplier,
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>> |
overlayCuboidBlocks(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).
|
java.util.Map<BlockType,java.lang.Integer> |
popMissingBlocks()
Gets the list of missing blocks and clears the list for the next
operation.
|
<B extends BlockStateHolder<B>> |
rawSetBlock(BlockVector3 position,
B block)
Set a block, bypassing both history and block re-ordering.
|
void |
redo(EditSession editSession)
Sets to new state.
|
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.
|
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>> |
replaceBlocks(Region region,
java.util.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,
java.util.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 |
setBatchingChunks(boolean batchingChunks)
Enable or disable chunk batching.
|
boolean |
setBiome(BlockVector3 position,
BiomeType biome)
Set the biome.
|
<B extends BlockStateHolder<B>> |
setBlock(BlockVector3 position,
B block)
Change the block at the given location to the given block.
|
<B extends BlockStateHolder<B>> |
setBlock(BlockVector3 position,
B block,
EditSession.Stage stage)
Set a block, bypassing both history and block re-ordering.
|
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 a
BlockBag to use. |
void |
setBlockChangeLimit(int limit)
Set the maximum number of blocks that can be changed.
|
<B extends BlockStateHolder<B>> |
setBlocks(Region region,
B block)
Sets all the blocks inside a region to a given block type.
|
int |
setBlocks(Region region,
Pattern pattern)
Sets all the blocks inside a region to a given pattern.
|
void |
setFastMode(boolean enabled)
Deprecated.
|
void |
setMask(Mask mask)
Set a mask.
|
void |
setReorderMode(EditSession.ReorderMode reorderMode)
Sets the
EditSession.ReorderMode of this EditSession, and flushes the session. |
void |
setSideEffectApplier(SideEffectSet sideEffectSet)
Set which block updates should occur.
|
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>> |
smartSetBlock(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.
|
void |
undo(EditSession editSession)
Restores all blocks to their initial state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBiome
setBiome
protected final World world
public void enableStandardMode()
chunk batching
.public void setReorderMode(EditSession.ReorderMode reorderMode)
EditSession.ReorderMode
of this EditSession, and flushes the session.reorderMode
- The reorder modepublic EditSession.ReorderMode getReorderMode()
public World getWorld()
public int getBlockChangeLimit()
public void setBlockChangeLimit(int limit)
limit
- the limit (>= 0) or -1 for no limit@Deprecated public boolean isQueueEnabled()
getReorderMode()
with MULTI_STAGE instead.@Deprecated public void enableQueue()
setReorderMode(ReorderMode)
with MULTI_STAGE instead.@Deprecated public void disableQueue()
setReorderMode(ReorderMode)
with another mode instead.public Mask getMask()
public void setMask(Mask mask)
mask
- mask or nullpublic SurvivalModeExtent getSurvivalExtent()
SurvivalModeExtent
.@Deprecated public void setFastMode(boolean enabled)
Fast mode may skip lighting checks or adjacent block notification.
enabled
- true to enablepublic void setSideEffectApplier(SideEffectSet sideEffectSet)
sideEffectSet
- side effects to enable@Deprecated public boolean hasFastMode()
Fast mode may skip lighting checks or adjacent block notification.
public SideEffectSet getSideEffectApplier()
public void setBlockBag(BlockBag blockBag)
BlockBag
to use.blockBag
- the block bag to set, or null to use nonepublic java.util.Map<BlockType,java.lang.Integer> popMissingBlocks()
public boolean isBatchingChunks()
public void setBatchingChunks(boolean batchingChunks)
batchingChunks
- true
to enable, false
to disablepublic void disableBuffering()
public boolean isTickingWatchdog()
true
if any watchdog extent is enabledpublic void setTickingWatchdog(boolean active)
public int getBlockChangeCount()
This number may not be accurate.
public boolean fullySupports3DBiomes()
OutputExtent
If false
, the extent only visually reads biomes from y = 0
.
The biomes will still be set in 3D, but the client will only see the one at
y = 0
. It is up to the caller to determine if they want to set that
biome instead, or simply warn the actor.
fullySupports3DBiomes
in interface OutputExtent
public BiomeType getBiome(BlockVector3 position)
InputExtent
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.
getBiome
in interface InputExtent
position
- the (x, y, z) location to check the biome atpublic boolean setBiome(BlockVector3 position, BiomeType biome)
OutputExtent
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.
setBiome
in interface OutputExtent
position
- the (x, y, z) location to set the biome atbiome
- the biome to set topublic BlockState getBlock(BlockVector3 position)
InputExtent
If the given position is out of the bounds of the extent, then the behavior
is undefined (an air block could be returned). However, null
should not be returned.
The returned block is immutable and is a snapshot of the block at the time
of call. It has no position attached to it, so it could be reused in
Pattern
s and so on.
getBlock
in interface InputExtent
position
- position of the blockpublic BaseBlock getFullBlock(BlockVector3 position)
InputExtent
getFullBlock
in interface InputExtent
position
- position of the blockpublic int getHighestTerrainBlock(int x, int z, int minY, int maxY)
x
- the X coordinatez
- the Z coordinateminY
- minimal heightmaxY
- maximal heightpublic int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter)
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) blockpublic <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, EditSession.Stage stage) throws WorldEditException
position
- the position to set the block atblock
- the blockstage
- the levelWorldEditException
- thrown on a set errorpublic <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block)
position
- the position to set the block atblock
- the blockpublic <B extends BlockStateHolder<B>> boolean smartSetBlock(BlockVector3 position, B block)
position
- the position to set the block atblock
- the blockpublic <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException
OutputExtent
BlockStateHolder
to the world, so future changes to the
BlockStateHolder
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.
setBlock
in interface OutputExtent
position
- position of the blockblock
- block to setMaxChangedBlocksException
public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException
position
- the positionpattern
- a pattern to useMaxChangedBlocksException
- thrown if too many blocks are changed@Nullable public Entity createEntity(Location location, BaseEntity entity)
Extent
createEntity
in interface Extent
location
- the locationentity
- the entitypublic void undo(EditSession editSession)
editSession
- a new EditSession
to perform the undo inpublic void redo(EditSession editSession)
editSession
- a new EditSession
to perform the redo inpublic int size()
public BlockVector3 getMinimumPoint()
Extent
If the extent is unbounded, then a large (negative) value may be returned.
getMinimumPoint
in interface Extent
public BlockVector3 getMaximumPoint()
Extent
If the extent is unbounded, then a large (positive) value may be returned.
getMaximumPoint
in interface Extent
public java.util.List<? extends Entity> getEntities(Region region)
Extent
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.
getEntities
in interface Extent
region
- the region in which entities must be containedpublic java.util.List<? extends Entity> getEntities()
Extent
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.
getEntities
in interface Extent
public void close()
close
in interface java.lang.AutoCloseable
@Deprecated public void flushSession()
close()
for proper cleanup behavior.@Nullable public Operation commit()
OutputExtent
Operation
that should be called to tie up loose ends
(such as to commit changes in a buffer).commit
in interface OutputExtent
public int countBlocks(Region region, java.util.Set<BaseBlock> searchBlocks)
region
- the regionsearchBlocks
- the list of blocks to searchpublic int countBlocks(Region region, Mask searchMask)
region
- the regionsearchMask
- mask to matchpublic <B extends BlockStateHolder<B>> int fillXZ(BlockVector3 origin, B block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException
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 performedMaxChangedBlocksException
- thrown if too many blocks are changedpublic int fillXZ(BlockVector3 origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException
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 performedMaxChangedBlocksException
- thrown if too many blocks are changedpublic int removeAbove(BlockVector3 position, int apothem, int height) throws MaxChangedBlocksException
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 1MaxChangedBlocksException
- thrown if too many blocks are changedpublic int removeBelow(BlockVector3 position, int apothem, int height) throws MaxChangedBlocksException
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 1MaxChangedBlocksException
- thrown if too many blocks are changedpublic int removeNear(BlockVector3 position, Mask mask, int apothem) throws MaxChangedBlocksException
position
- center position of cuboidmask
- the mask to matchapothem
- an apothem of the cuboid, where the minimum is 1MaxChangedBlocksException
- thrown if too many blocks are changedpublic <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException
region
- the regionblock
- the blockMaxChangedBlocksException
- thrown if too many blocks are changedpublic int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException
region
- the regionpattern
- the pattern that provides the replacement blockMaxChangedBlocksException
- thrown if too many blocks are changedpublic <B extends BlockStateHolder<B>> int replaceBlocks(Region region, java.util.Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException
region
- the region to replace the blocks withinfilter
- a list of block types to match, or null to use ExistingBlockMask
replacement
- the replacement blockMaxChangedBlocksException
- thrown if too many blocks are changedpublic int replaceBlocks(Region region, java.util.Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException
region
- the region to replace the blocks withinfilter
- a list of block types to match, or null to use ExistingBlockMask
pattern
- the pattern that provides the new blocksMaxChangedBlocksException
- thrown if too many blocks are changedpublic int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException
region
- the region to replace the blocks withinmask
- the mask that blocks must matchpattern
- the pattern that provides the new blocksMaxChangedBlocksException
- thrown if too many blocks are changedpublic int center(Region region, Pattern pattern) throws MaxChangedBlocksException
region
- the region to find the center ofpattern
- the replacement patternMaxChangedBlocksException
- thrown if too many blocks are changed@Deprecated public <B extends BlockStateHolder<B>> int makeCuboidFaces(Region region, B block) throws MaxChangedBlocksException
makeCuboidFaces(Region, Pattern)
.CuboidRegion
.region
- the regionblock
- the block to placeMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeCuboidFaces(Region region, Pattern pattern) throws MaxChangedBlocksException
CuboidRegion
.region
- the regionpattern
- the pattern to placeMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeFaces(Region region, Pattern pattern) throws MaxChangedBlocksException
region
- the regionpattern
- the pattern to placeMaxChangedBlocksException
- thrown if too many blocks are changedpublic <B extends BlockStateHolder<B>> int makeCuboidWalls(Region region, B block) throws MaxChangedBlocksException
CuboidRegion
.region
- the regionblock
- the block to placeMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeCuboidWalls(Region region, Pattern pattern) throws MaxChangedBlocksException
CuboidRegion
.region
- the regionpattern
- the pattern to placeMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeWalls(Region region, Pattern pattern) throws MaxChangedBlocksException
region
- the regionpattern
- the pattern to placeMaxChangedBlocksException
- thrown if too many blocks are changed@Deprecated public <B extends BlockStateHolder<B>> int overlayCuboidBlocks(Region region, B block) throws MaxChangedBlocksException
overlayCuboidBlocks(Region, Pattern)
.region
- the regionblock
- the placed blockMaxChangedBlocksException
- thrown if too many blocks are changedpublic int overlayCuboidBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException
region
- the regionpattern
- the placed block patternMaxChangedBlocksException
- thrown if too many blocks are changedpublic int naturalizeCuboidBlocks(Region region) throws MaxChangedBlocksException
region
- the region to affectMaxChangedBlocksException
- thrown if too many blocks are changedpublic int stackCuboidRegion(Region region, BlockVector3 dir, int count, boolean copyAir) throws MaxChangedBlocksException
stackCuboidRegion(Region, BlockVector3, int, boolean, boolean, Mask)
to fine tune.region
- the region to stackdir
- the direction to stackcount
- the number of times to stackcopyAir
- true to also copy air blocksMaxChangedBlocksException
- thrown if too many blocks are changedpublic int stackCuboidRegion(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) throws MaxChangedBlocksException
region
- the region to stackoffset
- how far to move the contents each stackcount
- the number of times to stackcopyEntities
- true to copy entitiescopyBiomes
- true to copy biomesmask
- source mask for the operation (only matching blocks are copied)MaxChangedBlocksException
- thrown if too many blocks are changedpublic int stackRegionBlockUnits(Region region, BlockVector3 offset, int count, boolean copyEntities, boolean copyBiomes, Mask mask) throws MaxChangedBlocksException, RegionOperationException
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)MaxChangedBlocksException
- thrown if too many blocks are changedRegionOperationException
- thrown if the region operation is invalidpublic int moveRegion(Region region, BlockVector3 offset, int multiplier, boolean copyAir, Pattern replacement) throws MaxChangedBlocksException
region
- the region to moveoffset
- the offsetmultiplier
- the number to multiply the offset bycopyAir
- true to copy air blocksreplacement
- the replacement pattern to fill in after moving, or null to use airMaxChangedBlocksException
- thrown if too many blocks are changedpublic int moveRegion(Region region, BlockVector3 offset, int multiplier, boolean moveEntities, boolean copyBiomes, Mask mask, Pattern replacement) throws MaxChangedBlocksException
region
- the region to moveoffset
- the offsetmultiplier
- 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 airMaxChangedBlocksException
- thrown if too many blocks are changedjava.lang.IllegalArgumentException
- thrown if the region is not a flat region, but copyBiomes is truepublic int moveCuboidRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) throws MaxChangedBlocksException
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 airMaxChangedBlocksException
- thrown if too many blocks are changedpublic int drainArea(BlockVector3 origin, double radius) throws MaxChangedBlocksException
origin
- the origin to drain from, which will search a 3x3 arearadius
- the radius of the removal, where a value should be 0 or greaterMaxChangedBlocksException
- thrown if too many blocks are changedpublic int drainArea(BlockVector3 origin, double radius, boolean waterlogged) throws MaxChangedBlocksException
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 wellMaxChangedBlocksException
- thrown if too many blocks are changedpublic int fixLiquid(BlockVector3 origin, double radius, BlockType fluid) throws MaxChangedBlocksException
origin
- the original positionradius
- the radius to fixfluid
- the type of the fluidMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeCylinder(BlockVector3 pos, Pattern block, double radius, int height, boolean filled) throws MaxChangedBlocksException
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.MaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled) throws MaxChangedBlocksException
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.MaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeSphere(BlockVector3 pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException
pos
- Center of the sphere or ellipsoidblock
- The block pattern to useradius
- The sphere's radiusfilled
- If false, only a shell will be generated.MaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeSphere(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled) throws MaxChangedBlocksException
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.MaxChangedBlocksException
- thrown if too many blocks are changedpublic int makePyramid(BlockVector3 position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException
position
- a positionblock
- a blocksize
- size of pyramidfilled
- true if filledMaxChangedBlocksException
- thrown if too many blocks are changed@Deprecated public int thaw(BlockVector3 position, double radius) throws MaxChangedBlocksException
thaw(BlockVector3, double, int)
.position
- the positionradius
- the radiusMaxChangedBlocksException
- thrown if too many blocks are changedpublic int thaw(BlockVector3 position, double radius, int height) throws MaxChangedBlocksException
position
- the positionradius
- the radiusheight
- the height (upwards and downwards)MaxChangedBlocksException
- thrown if too many blocks are changed@Deprecated public int simulateSnow(BlockVector3 position, double radius) throws MaxChangedBlocksException
simulateSnow(BlockVector3, double, int)
.position
- a positionradius
- a radiusMaxChangedBlocksException
- thrown if too many blocks are changedpublic int simulateSnow(BlockVector3 position, double radius, int height) throws MaxChangedBlocksException
position
- a positionradius
- a radiusheight
- the height (upwards and downwards)MaxChangedBlocksException
- thrown if too many blocks are changedpublic int simulateSnow(FlatRegion region, boolean stack) throws MaxChangedBlocksException
region
- the region to simulate snow instack
- whether it should stack existing snowMaxChangedBlocksException
- thrown if too many blocks are changed@Deprecated public int green(BlockVector3 position, double radius, boolean onlyNormalDirt) throws MaxChangedBlocksException
green(BlockVector3, double, int, boolean)
.position
- a positionradius
- a radiusonlyNormalDirt
- only affect normal dirt (all default properties)MaxChangedBlocksException
- thrown if too many blocks are changedpublic int green(BlockVector3 position, double radius, int height, boolean onlyNormalDirt) throws MaxChangedBlocksException
position
- the positionradius
- the radiusheight
- the heightonlyNormalDirt
- only affect normal dirt (all default properties)MaxChangedBlocksException
- thrown if too many blocks are changedpublic int makePumpkinPatches(BlockVector3 position, int apothem) throws MaxChangedBlocksException
position
- the base positionapothem
- the apothem of the (square) areaMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeForest(BlockVector3 basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException
basePosition
- a positionsize
- a sizedensity
- between 0 and 1, inclusivetreeType
- the tree typeMaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeForest(Region region, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException
region
- the region to generate trees indensity
- between 0 and 1, inclusivetreeType
- the tree typeMaxChangedBlocksException
- thrown if too many blocks are changedpublic java.util.List<Countable<BlockState>> getBlockDistribution(Region region, boolean separateStates)
region
- a regionpublic int makeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, java.lang.String expressionString, boolean hollow) throws ExpressionException, MaxChangedBlocksException
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 hollowExpressionException
- if there is a problem with the expressionMaxChangedBlocksException
- if the maximum block change limit is exceededpublic int makeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, java.lang.String expressionString, boolean hollow, int timeout) throws ExpressionException, MaxChangedBlocksException
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 disableExpressionException
- if there is a problem with the expressionMaxChangedBlocksException
- if the maximum block change limit is exceededpublic int makeShape(Region region, Vector3 zero, Vector3 unit, Pattern pattern, Expression expression, boolean hollow, int timeout) throws ExpressionException, MaxChangedBlocksException
makeShape(Region, Vector3, Vector3, Pattern, String, boolean, int)
.
The Expression class is subject to change. Expressions should be provided via the string overload.
public int deformRegion(Region region, Vector3 zero, Vector3 unit, java.lang.String expressionString) throws ExpressionException, MaxChangedBlocksException
region
- the region to deformzero
- the origin of the coordinate systemunit
- the scale of the coordinate systemexpressionString
- the expression to evaluate for each blockExpressionException
- thrown on invalid expression inputMaxChangedBlocksException
- thrown if too many blocks are changedpublic int deformRegion(Region region, Vector3 zero, Vector3 unit, java.lang.String expressionString, int timeout) throws ExpressionException, MaxChangedBlocksException
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.ExpressionException
- thrown on invalid expression inputMaxChangedBlocksException
- thrown if too many blocks are changedpublic int deformRegion(Region region, Vector3 zero, Vector3 unit, Expression expression, int timeout) throws ExpressionException, MaxChangedBlocksException
deformRegion(Region, Vector3, Vector3, String, int)
.
The Expression class is subject to change. Expressions should be provided via the string overload.
public int hollowOutRegion(Region region, int thickness, Pattern pattern) throws MaxChangedBlocksException
region
- the region to hollow out.thickness
- the thickness of the shell to leave (manhattan distance)pattern
- The block pattern to useMaxChangedBlocksException
- thrown if too many blocks are changedpublic int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled) throws MaxChangedBlocksException
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.MaxChangedBlocksException
- thrown if too many blocks are changeddrawLine(Pattern, List, double, boolean)
public int drawLine(Pattern pattern, java.util.List<BlockVector3> vectors, double radius, boolean filled) throws MaxChangedBlocksException
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.MaxChangedBlocksException
- thrown if too many blocks are changedpublic int drawSpline(Pattern pattern, java.util.List<BlockVector3> nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) throws MaxChangedBlocksException
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.MaxChangedBlocksException
- thrown if too many blocks are changedpublic int makeBiomeShape(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, java.lang.String expressionString, boolean hollow) throws ExpressionException
ExpressionException
public int makeBiomeShape(Region region, Vector3 zero, Vector3 unit, BiomeType biomeType, java.lang.String expressionString, boolean hollow, int timeout) throws ExpressionException
ExpressionException