public class EditSession extends Object
| Modifier and Type | Field and Description |
|---|---|
protected LocalWorld |
world
World.
|
| Constructor and Description |
|---|
EditSession(LocalWorld world,
int maxBlocks)
Construct the object with a maximum number of blocks.
|
EditSession(LocalWorld world,
int maxBlocks,
BlockBag blockBag)
Construct the object with a maximum number of blocks and a block bag.
|
| Modifier and Type | Method and Description |
|---|---|
int |
center(Region region,
Pattern pattern) |
int |
countBlock(Region region,
Set<Integer> searchIDs) |
int |
countBlocks(Region region,
Set<BaseBlock> searchBlocks)
Count the number of blocks of a list of types in a region.
|
int |
deformRegion(Region region,
Vector zero,
Vector unit,
String expressionString) |
void |
disableQueue()
Disable the queue.
|
int |
drainArea(Vector pos,
double radius)
Drain nearby pools of water or lava.
|
int |
drawLine(Pattern pattern,
Vector pos1,
Vector pos2,
double radius,
boolean filled)
Draws a line (out of blocks) between two vectors.
|
int |
drawSpline(Pattern pattern,
List<Vector> nodevectors,
double tension,
double bias,
double continuity,
double quality,
double radius,
boolean filled)
Draws a spline (out of blocks) between specified vectors.
|
void |
enableQueue()
Queue certain types of block for better reproduction of those blocks.
|
int |
fillXZ(Vector origin,
BaseBlock block,
double radius,
int depth,
boolean recursive)
Fills an area recursively in the X/Z directions.
|
int |
fillXZ(Vector origin,
Pattern pattern,
double radius,
int depth,
boolean recursive)
Fills an area recursively in the X/Z directions.
|
int |
fixLiquid(Vector pos,
double radius,
int moving,
int stationary)
Level water.
|
void |
flushQueue()
Finish off the queue.
|
BaseBlock |
getBlock(Vector pt)
Gets the block type at a position x, y, z.
|
BlockBag |
getBlockBag() |
int |
getBlockChangeCount()
Get the number of blocks changed, including repeated block changes.
|
int |
getBlockChangeLimit()
Get the maximum number of blocks that can be changed.
|
int |
getBlockData(Vector pt) |
List<Countable<Integer>> |
getBlockDistribution(Region region)
Get the block distribution inside a region.
|
List<Countable<BaseBlock>> |
getBlockDistributionWithData(Region region)
Get the block distribution (with data values) inside a region.
|
int |
getBlockType(Vector pt)
Gets the block type at a position x, y, z.
|
int |
getHighestTerrainBlock(int x,
int z,
int minY,
int maxY)
Returns the highest solid 'terrain' block which can occur naturally.
|
int |
getHighestTerrainBlock(int x,
int z,
int minY,
int maxY,
boolean naturalOnly)
Returns the highest solid 'terrain' block which can occur naturally.
|
Mask |
getMask()
Get the mask.
|
LocalWorld |
getWorld()
Get the world.
|
int |
green(Vector pos,
double radius)
Deprecated.
|
int |
green(Vector pos,
double radius,
boolean onlyNormalDirt)
Green.
|
boolean |
hasFastMode()
Return fast mode status.
|
int |
hollowOutRegion(Region region,
int thickness,
Pattern pattern)
Hollows out the region (Semi-well-defined for non-cuboid selections).
|
boolean |
isQueueEnabled()
Returns queue status.
|
int |
makeBiomeShape(Region region,
Vector zero,
Vector unit,
BiomeType biomeType,
String expressionString,
boolean hollow) |
int |
makeCuboidFaces(Region region,
BaseBlock block)
Make faces of the region (as if it was a cuboid if it's not).
|
int |
makeCuboidFaces(Region region,
Pattern pattern)
Make faces of the region (as if it was a cuboid if it's not).
|
int |
makeCuboidWalls(Region region,
BaseBlock block)
Make walls of the region (as if it was a cuboid if it's not).
|
int |
makeCuboidWalls(Region region,
Pattern pattern)
Make walls of the region (as if it was a cuboid if it's not).
|
int |
makeCylinder(Vector pos,
Pattern block,
double radiusX,
double radiusZ,
int height,
boolean filled)
Makes a cylinder.
|
int |
makeCylinder(Vector pos,
Pattern block,
double radius,
int height,
boolean filled)
Makes a cylinder.
|
int |
makeFaces(Region region,
Pattern pattern)
Make faces of the region
|
int |
makeForest(Iterable<Vector2D> it,
int upperY,
int lowerY,
double density,
TreeGenerator treeGenerator)
Deprecated.
Use
ForestGenerator with a
FlatRegionApplicator |
int |
makeForest(Vector basePos,
int size,
double density,
TreeGenerator treeGenerator)
Makes a forest.
|
int |
makePumpkinPatches(Vector position,
int apothem)
Makes pumpkin patches randomly in an area around the given position.
|
int |
makePyramid(Vector pos,
Pattern block,
int size,
boolean filled)
Makes a pyramid.
|
int |
makeShape(Region region,
Vector zero,
Vector unit,
Pattern pattern,
String expressionString,
boolean hollow) |
int |
makeSphere(Vector pos,
Pattern block,
double radius,
boolean filled)
Makes a sphere.
|
int |
makeSphere(Vector pos,
Pattern block,
double radiusX,
double radiusY,
double radiusZ,
boolean filled)
Makes a sphere or ellipsoid.
|
int |
makeWalls(Region region,
Pattern pattern)
Make walls of the region
|
int |
moveCuboidRegion(Region region,
Vector dir,
int distance,
boolean copyAir,
BaseBlock replace)
Move a cuboid region.
|
int |
moveRegion(Region region,
Vector dir,
int distance,
boolean copyAir,
BaseBlock replace)
Move a region.
|
int |
naturalizeCuboidBlocks(Region region)
Turns the first 3 layers into dirt/grass and the bottom layers
into rock, like a natural Minecraft mountain.
|
int |
overlayCuboidBlocks(Region region,
BaseBlock block)
Overlays a layer of blocks over a cuboid area.
|
int |
overlayCuboidBlocks(Region region,
Pattern pattern)
Overlays a layer of blocks over a cuboid area.
|
Map<Integer,Integer> |
popMissingBlocks()
Gets the list of missing blocks and clears the list for the next
operation.
|
BaseBlock |
rawGetBlock(Vector pt)
Gets the block type at a position x, y, z.
|
boolean |
rawSetBlock(Vector pt,
BaseBlock block)
Sets a block without changing history.
|
void |
redo(EditSession sess)
Sets to new state.
|
void |
rememberChange(Vector pt,
BaseBlock existing,
BaseBlock block)
Insert a contrived block change into the history.
|
int |
removeAbove(Vector pos,
int size,
int height)
Remove blocks above.
|
int |
removeBelow(Vector pos,
int size,
int height)
Remove blocks below.
|
int |
removeNear(Vector pos,
int blockType,
int size)
Remove nearby blocks of a type.
|
int |
replaceBlocks(Region region,
Set<BaseBlock> fromBlockTypes,
BaseBlock toBlock)
Replaces all the blocks of a type inside a region to another block type.
|
int |
replaceBlocks(Region region,
Set<BaseBlock> fromBlockTypes,
Pattern pattern)
Replaces all the blocks of a type inside a region to another block type.
|
boolean |
setBlock(Vector pt,
BaseBlock block)
Sets the block at position x, y, z with a block type.
|
boolean |
setBlock(Vector pt,
Pattern pat)
Set a block with a pattern.
|
void |
setBlockBag(BlockBag blockBag) |
void |
setBlockChangeLimit(int maxBlocks)
Set the maximum number of blocks that can be changed.
|
boolean |
setBlockIfAir(Vector pt,
BaseBlock block)
Set a block only if there's no block already there.
|
int |
setBlocks(Region region,
BaseBlock block)
Sets all the blocks inside a region to a certain block type.
|
int |
setBlocks(Region region,
Pattern pattern)
Sets all the blocks inside a region to a certain block type.
|
boolean |
setChanceBlockIfAir(Vector pos,
BaseBlock block,
double c)
Set a block by chance.
|
void |
setFastMode(boolean fastMode)
Set fast mode.
|
void |
setMask(Mask mask)
Set a mask.
|
int |
simulateSnow(Vector pos,
double radius)
Make snow.
|
int |
size()
Get the number of changed blocks.
|
boolean |
smartSetBlock(Vector pt,
BaseBlock block)
Actually set the block.
|
int |
stackCuboidRegion(Region region,
Vector dir,
int count,
boolean copyAir)
Stack a cuboid region.
|
int |
thaw(Vector pos,
double radius)
Thaw.
|
void |
undo(EditSession sess)
Restores all blocks to their initial state.
|
protected LocalWorld world
public EditSession(LocalWorld world, int maxBlocks)
world - maxBlocks - public EditSession(LocalWorld world, int maxBlocks, BlockBag blockBag)
world - maxBlocks - blockBag - public boolean rawSetBlock(Vector pt, BaseBlock block)
pt - block - public boolean setBlock(Vector pt, BaseBlock block) throws MaxChangedBlocksException
pt - block - MaxChangedBlocksExceptionpublic void rememberChange(Vector pt, BaseBlock existing, BaseBlock block)
pt - existing - block - public boolean setBlock(Vector pt, Pattern pat) throws MaxChangedBlocksException
pt - pat - MaxChangedBlocksExceptionpublic boolean setBlockIfAir(Vector pt, BaseBlock block) throws MaxChangedBlocksException
pt - block - MaxChangedBlocksExceptionpublic boolean smartSetBlock(Vector pt, BaseBlock block)
pt - block - public BaseBlock getBlock(Vector pt)
pt - public int getBlockType(Vector pt)
pt - public int getBlockData(Vector pt)
public BaseBlock rawGetBlock(Vector pt)
pt - public void undo(EditSession sess)
sess - public void redo(EditSession sess)
sess - public int size()
public int getBlockChangeLimit()
public void setBlockChangeLimit(int maxBlocks)
maxBlocks - -1 to disablepublic boolean isQueueEnabled()
public void enableQueue()
public void disableQueue()
public void setFastMode(boolean fastMode)
fastMode - public boolean hasFastMode()
public boolean setChanceBlockIfAir(Vector pos, BaseBlock block, double c) throws MaxChangedBlocksException
pos - block - c - 0-1 chanceMaxChangedBlocksExceptionpublic int countBlocks(Region region, Set<BaseBlock> searchBlocks)
region - searchBlocks - public int getHighestTerrainBlock(int x,
int z,
int minY,
int maxY)
x - z - minY - minimal heightmaxY - maximal heightpublic int getHighestTerrainBlock(int x,
int z,
int minY,
int maxY,
boolean naturalOnly)
x - z - minY - minimal heightmaxY - maximal heightnaturalOnly - look at natural blocks or all blockspublic Map<Integer,Integer> popMissingBlocks()
public BlockBag getBlockBag()
public void setBlockBag(BlockBag blockBag)
blockBag - the blockBag to setpublic LocalWorld getWorld()
public int getBlockChangeCount()
public Mask getMask()
public void setMask(Mask mask)
mask - mask or nullpublic void flushQueue()
public int fillXZ(Vector origin, BaseBlock block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException
origin - block - radius - depth - recursive - MaxChangedBlocksExceptionpublic int fillXZ(Vector origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException
origin - pattern - radius - depth - recursive - MaxChangedBlocksExceptionpublic int removeAbove(Vector pos, int size, int height) throws MaxChangedBlocksException
pos - size - height - MaxChangedBlocksExceptionpublic int removeBelow(Vector pos, int size, int height) throws MaxChangedBlocksException
pos - size - height - MaxChangedBlocksExceptionpublic int removeNear(Vector pos, int blockType, int size) throws MaxChangedBlocksException
pos - blockType - size - MaxChangedBlocksExceptionpublic int setBlocks(Region region, BaseBlock block) throws MaxChangedBlocksException
region - block - MaxChangedBlocksExceptionpublic int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException
region - pattern - MaxChangedBlocksExceptionpublic int replaceBlocks(Region region, Set<BaseBlock> fromBlockTypes, BaseBlock toBlock) throws MaxChangedBlocksException
region - fromBlockTypes - -1 for non-airtoBlock - MaxChangedBlocksExceptionpublic int replaceBlocks(Region region, Set<BaseBlock> fromBlockTypes, Pattern pattern) throws MaxChangedBlocksException
region - fromBlockTypes - -1 for non-airpattern - MaxChangedBlocksExceptionpublic int center(Region region, Pattern pattern) throws MaxChangedBlocksException
MaxChangedBlocksExceptionpublic int makeCuboidFaces(Region region, BaseBlock block) throws MaxChangedBlocksException
region - block - MaxChangedBlocksExceptionpublic int makeCuboidFaces(Region region, Pattern pattern) throws MaxChangedBlocksException
region - pattern - MaxChangedBlocksExceptionpublic int makeFaces(Region region, Pattern pattern) throws MaxChangedBlocksException
region - pattern - MaxChangedBlocksExceptionpublic int makeCuboidWalls(Region region, BaseBlock block) throws MaxChangedBlocksException
region - block - MaxChangedBlocksExceptionpublic int makeCuboidWalls(Region region, Pattern pattern) throws MaxChangedBlocksException
region - pattern - MaxChangedBlocksExceptionpublic int makeWalls(Region region, Pattern pattern) throws MaxChangedBlocksException
region - pattern - MaxChangedBlocksExceptionpublic int overlayCuboidBlocks(Region region, BaseBlock block) throws MaxChangedBlocksException
region - block - MaxChangedBlocksExceptionpublic int overlayCuboidBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException
region - pattern - MaxChangedBlocksExceptionpublic int naturalizeCuboidBlocks(Region region) throws MaxChangedBlocksException
region - MaxChangedBlocksExceptionpublic int stackCuboidRegion(Region region, Vector dir, int count, boolean copyAir) throws MaxChangedBlocksException
region - dir - count - copyAir - MaxChangedBlocksExceptionpublic int moveRegion(Region region, Vector dir, int distance, boolean copyAir, BaseBlock replace) throws MaxChangedBlocksException, RegionOperationException
region - dir - distance - copyAir - replace - MaxChangedBlocksExceptionRegionOperationExceptionpublic int moveCuboidRegion(Region region, Vector dir, int distance, boolean copyAir, BaseBlock replace) throws MaxChangedBlocksException
region - dir - distance - copyAir - replace - MaxChangedBlocksExceptionpublic int drainArea(Vector pos, double radius) throws MaxChangedBlocksException
pos - radius - MaxChangedBlocksExceptionpublic int fixLiquid(Vector pos, double radius, int moving, int stationary) throws MaxChangedBlocksException
pos - radius - moving - stationary - MaxChangedBlocksExceptionpublic int makeCylinder(Vector 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.MaxChangedBlocksExceptionpublic int makeCylinder(Vector 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.MaxChangedBlocksExceptionpublic int makeSphere(Vector 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.MaxChangedBlocksExceptionpublic int makeSphere(Vector 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.MaxChangedBlocksExceptionpublic int makePyramid(Vector pos, Pattern block, int size, boolean filled) throws MaxChangedBlocksException
pos - block - size - filled - MaxChangedBlocksExceptionpublic int thaw(Vector pos, double radius) throws MaxChangedBlocksException
pos - radius - MaxChangedBlocksExceptionpublic int simulateSnow(Vector pos, double radius) throws MaxChangedBlocksException
pos - radius - MaxChangedBlocksException@Deprecated public int green(Vector pos, double radius) throws MaxChangedBlocksException
green(Vector, double, boolean).pos - radius - MaxChangedBlocksExceptionpublic int green(Vector pos, double radius, boolean onlyNormalDirt) throws MaxChangedBlocksException
pos - radius - onlyNormalDirt - only affect normal dirt (data value 0)MaxChangedBlocksExceptionpublic int makePumpkinPatches(Vector position, int apothem) throws MaxChangedBlocksException
position - the base positionapothem - the apothem of the (square) areaMaxChangedBlocksExceptionpublic int makeForest(Vector basePos, int size, double density, TreeGenerator treeGenerator) throws MaxChangedBlocksException
basePos - size - density - treeGenerator - MaxChangedBlocksException@Deprecated public int makeForest(Iterable<Vector2D> it, int upperY, int lowerY, double density, TreeGenerator treeGenerator) throws WorldEditException
it - an iterator over the points within the regionupperY - the Y to start from (upperY >= lowerY), inclusivelowerY - the Y to end at (upperY >= lowerY), inclusivedensity - density of the foresttreeGenerator - the tree generatorMaxChangedBlocksExceptionWorldEditExceptionpublic List<Countable<Integer>> getBlockDistribution(Region region)
region - public List<Countable<BaseBlock>> getBlockDistributionWithData(Region region)
region - public int makeShape(Region region, Vector zero, Vector unit, Pattern pattern, String expressionString, boolean hollow) throws ExpressionException, MaxChangedBlocksException
public int deformRegion(Region region, Vector zero, Vector unit, String expressionString) throws ExpressionException, MaxChangedBlocksException
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 useMaxChangedBlocksExceptionpublic int drawLine(Pattern pattern, Vector pos1, Vector 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.MaxChangedBlocksExceptionpublic int drawSpline(Pattern pattern, List<Vector> 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.MaxChangedBlocksExceptionpublic int makeBiomeShape(Region region, Vector zero, Vector unit, BiomeType biomeType, String expressionString, boolean hollow) throws ExpressionException, MaxChangedBlocksException
Copyright © 2010-2014. All Rights Reserved.