mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes. Also, extremely minor code changes which have been tested. This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. * Updated PlotSquared URL * Removed plugin acronyms * Fixed a typo * Fixed grammar * Use modern block id's * Update YouTube video URL
This commit is contained in:
@ -176,12 +176,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorder mode for {@link EditSession#setReorderMode(ReorderMode)}.
|
||||
* NOT FUNCTIONAL IN FAWE AS OF June 3,2019
|
||||
* Reorder mode for {@link EditSession#setReorderMode(ReorderMode)}. NOT FUNCTIONAL IN FAWE
|
||||
*
|
||||
* <p>
|
||||
* MULTI_STAGE = Multi stage reorder, may not be great with mods.
|
||||
* FAST = Use the fast mode. Good for mods.
|
||||
* NONE = Place blocks without worrying about placement order.
|
||||
* </p>
|
||||
*/
|
||||
public enum ReorderMode {
|
||||
MULTI_STAGE("multi"),
|
||||
@ -256,7 +257,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* The limit for this specific edit (blocks etc)
|
||||
* The limit for this specific edit (blocks etc).
|
||||
*
|
||||
* @return The limit
|
||||
*/
|
||||
@ -273,7 +274,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new limit representing how much of this edit's limit has been used so far
|
||||
* Returns a new limit representing how much of this edit's limit has been used so far.
|
||||
*
|
||||
* @return Limit remaining
|
||||
*/
|
||||
@ -291,7 +292,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remaining limits
|
||||
* Returns the remaining limits.
|
||||
*
|
||||
* @return remaining limits
|
||||
*/
|
||||
@ -300,7 +301,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* The region extent restricts block placements to allowmaxYed regions
|
||||
* The region extent restricts block placements to allow max Y regions.
|
||||
* TODO This doc needs to be rewritten because it may not actually describe what it does.
|
||||
*
|
||||
* @return FaweRegionExtent (may be null)
|
||||
*/
|
||||
@ -312,6 +314,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
public Extent getBypassAll() {
|
||||
return bypassAll;
|
||||
}
|
||||
|
||||
public Extent getBypassHistory() {
|
||||
return bypassHistory;
|
||||
}
|
||||
@ -321,7 +324,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Player or null
|
||||
* Get the Player or null.
|
||||
*
|
||||
* @return the player
|
||||
*/
|
||||
@ -436,9 +439,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue certain types of block for better reproduction of those blocks.
|
||||
* Queue certain types of block for better reproduction of those blocks. Uses
|
||||
* {@link ReorderMode#MULTI_STAGE}.
|
||||
*
|
||||
* Uses {@link ReorderMode#MULTI_STAGE}
|
||||
* @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@ -480,7 +483,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
new ExtentTraverser(this).setNext(transform);
|
||||
}
|
||||
|
||||
public @Nullable ResettableExtent getTransform() {
|
||||
@Nullable
|
||||
public ResettableExtent getTransform() {
|
||||
ExtentTraverser<ResettableExtent> traverser = new ExtentTraverser<>(getExtent()).find(ResettableExtent.class);
|
||||
if (traverser != null) {
|
||||
return traverser.get();
|
||||
@ -710,8 +714,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable chunk batching. Disabling will
|
||||
* {@linkplain #flushSession() flush the session}.
|
||||
* Enable or disable chunk batching. Disabling will flush the session.
|
||||
*
|
||||
* @param batchingChunks {@code true} to enable, {@code false} to disable
|
||||
*/
|
||||
@ -895,7 +898,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override @Deprecated
|
||||
@Override
|
||||
@Deprecated
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException {
|
||||
if (position.getBlockY() < 0 || position.getBlockY() > 255) {
|
||||
return false;
|
||||
@ -971,6 +975,16 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
|
||||
return this.changes = super.setBlocks(region, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||
return this.changes = super.setBlocks(region, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores all blocks to their initial state.
|
||||
*
|
||||
@ -1023,7 +1037,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Closing an EditSession {@linkplain #flushSession() flushes its buffers}.
|
||||
* Closing an EditSession flushes its buffers to the world, and performs other
|
||||
* cleanup tasks.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
@ -1033,7 +1048,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
/**
|
||||
* Communicate to the EditSession that all block changes are complete,
|
||||
* and that it should apply them to the world.
|
||||
*
|
||||
* @deprecated Replace with {@link #close()} for proper cleanup behavior.
|
||||
*/
|
||||
@Deprecated
|
||||
public void flushSession() {
|
||||
flushQueue();
|
||||
}
|
||||
@ -1048,7 +1066,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
if (used.MAX_FAILS > 0) {
|
||||
if (used.MAX_CHANGES > 0 || used.MAX_ENTITIES > 0) {
|
||||
player.print(Caption.of("fawe.error.worldedit.some.fails", used.MAX_FAILS));
|
||||
} else if (new ExtentTraverser<>(getExtent()).findAndGet(FaweRegionExtent.class) != null){
|
||||
} else if (new ExtentTraverser<>(getExtent()).findAndGet(FaweRegionExtent.class) != null) {
|
||||
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
|
||||
} else {
|
||||
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
|
||||
@ -1096,21 +1114,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
Operations.completeBlindly(visitor);
|
||||
return this.changes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
|
||||
return this.changes = super.setBlocks(region, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||
return this.changes = super.setBlocks(region, pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException {
|
||||
return this.changes = super.replaceBlocks(region, filter, replacement);
|
||||
@ -1198,6 +1206,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
Math.max(origin.getBlockY() - depth + 1, getMinimumPoint().getBlockY()),
|
||||
Math.min(getMaxY(), origin.getBlockY())),
|
||||
Masks.negate(new ExistingBlockMask(this)));
|
||||
|
||||
// Want to replace blocks
|
||||
BlockReplace replace = new BlockReplace(this, pattern);
|
||||
|
||||
@ -1313,7 +1322,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @param block the block to place
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
* @deprecated Use {@link EditSession#makeCuboidFaces(Region, Pattern)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public <B extends BlockStateHolder<B>> int makeCuboidFaces(Region region, B block) throws MaxChangedBlocksException {
|
||||
return makeCuboidFaces(region, block);
|
||||
}
|
||||
@ -1420,7 +1431,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @param block the placed block
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
* @deprecated Use {@link EditSession#overlayCuboidBlocks(Region, Pattern)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public <B extends BlockStateHolder<B>> int overlayCuboidBlocks(Region region, B block) throws MaxChangedBlocksException {
|
||||
checkNotNull(block);
|
||||
|
||||
@ -1573,7 +1586,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(this, region, this, to);
|
||||
|
||||
if (replacement == null) replacement = BlockTypes.AIR.getDefaultState();
|
||||
if (replacement == null) {
|
||||
replacement = BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
BlockReplace remove = replacement instanceof ExistingPattern ? null : new BlockReplace(this, replacement);
|
||||
copy.setSourceFunction(remove); // Remove
|
||||
|
||||
@ -1649,8 +1664,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
|
||||
Mask liquidMask;
|
||||
if (plants) {
|
||||
liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER,
|
||||
BlockTypes.KELP_PLANT, BlockTypes.KELP, BlockTypes.SEAGRASS, BlockTypes.TALL_SEAGRASS);
|
||||
liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER,
|
||||
BlockTypes.KELP_PLANT, BlockTypes.KELP, BlockTypes.SEAGRASS, BlockTypes.TALL_SEAGRASS);
|
||||
} else {
|
||||
liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER);
|
||||
}
|
||||
@ -1660,9 +1675,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
liquidMask = new MaskUnion(liquidMask, new BlockStateMask(this, stateMap, true));
|
||||
}
|
||||
Mask mask = new MaskIntersection(
|
||||
new BoundedHeightMask(0, getWorld().getMaxY()),
|
||||
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
|
||||
liquidMask);
|
||||
new BoundedHeightMask(0, getWorld().getMaxY()),
|
||||
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
|
||||
liquidMask);
|
||||
BlockReplace replace;
|
||||
if (waterlogged) {
|
||||
replace = new BlockReplace(this, new WaterloggedRemover(this));
|
||||
@ -1708,6 +1723,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
|
||||
blockMask
|
||||
);
|
||||
|
||||
BlockReplace replace = new BlockReplace(this, fluid.getDefaultState());
|
||||
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace);
|
||||
|
||||
@ -1787,7 +1803,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
final int ceilRadiusX = (int) Math.ceil(radiusX);
|
||||
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
|
||||
|
||||
double xSqr, zSqr;
|
||||
double xSqr;
|
||||
double zSqr;
|
||||
double distanceSq;
|
||||
double nextXn = 0;
|
||||
|
||||
@ -1910,7 +1927,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
LocalBlockVectorSet set = new LocalBlockVectorSet();
|
||||
|
||||
double nextXn = 0;
|
||||
double dx, dy, dz, dxy, dxyz;
|
||||
double dx;
|
||||
double dy;
|
||||
double dz;
|
||||
double dxy;
|
||||
double dxyz;
|
||||
forX:
|
||||
for (int x = 0; x <= ceilRadiusX; ++x) {
|
||||
final double xn = nextXn;
|
||||
@ -1945,22 +1966,30 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px + x, py - y, pz + z), block);
|
||||
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px - x, py - y, pz + z), block);
|
||||
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px + x, py - y, pz - z), block);
|
||||
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
||||
}
|
||||
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold) {
|
||||
setBlock(mutable.setComponents(px - x, py - y, pz - z), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2050,18 +2079,26 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
yy = py + y;
|
||||
if (yy <= maxY) {
|
||||
this.setBlock(px + x, py + y, pz + z, block);
|
||||
if (x != 0) this.setBlock(px - x, py + y, pz + z, block);
|
||||
if (x != 0) {
|
||||
this.setBlock(px - x, py + y, pz + z, block);
|
||||
}
|
||||
if (z != 0) {
|
||||
this.setBlock(px + x, py + y, pz - z, block);
|
||||
if (x != 0) this.setBlock(px - x, py + y, pz - z, block);
|
||||
if (x != 0) {
|
||||
this.setBlock(px - x, py + y, pz - z, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (y != 0 && (yy = py - y) >= 0) {
|
||||
this.setBlock(px + x, yy, pz + z, block);
|
||||
if (x != 0) this.setBlock(px - x, yy, pz + z, block);
|
||||
if (x != 0) {
|
||||
this.setBlock(px - x, yy, pz + z, block);
|
||||
}
|
||||
if (z != 0) {
|
||||
this.setBlock(px + x, yy, pz - z, block);
|
||||
if (x != 0) this.setBlock(px - x, yy, pz - z, block);
|
||||
if (x != 0) {
|
||||
this.setBlock(px - x, yy, pz - z, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2114,8 +2151,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
@Deprecated
|
||||
public int thaw(BlockVector3 position, double radius)
|
||||
throws MaxChangedBlocksException {
|
||||
throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
double radiusSq = radius * radius;
|
||||
|
||||
@ -2164,6 +2202,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
@Deprecated
|
||||
public int simulateSnow(BlockVector3 position, double radius) throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
double radiusSq = radius * radius;
|
||||
@ -2257,7 +2296,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
final BlockType block = getBlockType(x, y, z);
|
||||
switch (block.getInternalId()) {
|
||||
case BlockID.COARSE_DIRT:
|
||||
if (onlyNormalDirt) break loop;
|
||||
if (onlyNormalDirt) {
|
||||
break loop;
|
||||
}
|
||||
this.setBlock(x, y, z, grass);
|
||||
break loop;
|
||||
case BlockID.DIRT:
|
||||
this.setBlock(x, y, z, grass);
|
||||
break loop;
|
||||
@ -2344,7 +2387,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @return the results
|
||||
*/
|
||||
public List<Countable<BlockState>> getBlockDistribution(Region region, boolean separateStates) {
|
||||
if (separateStates) return getBlockDistributionWithData(region);
|
||||
if (separateStates) {
|
||||
return getBlockDistributionWithData(region);
|
||||
}
|
||||
List<Countable<BlockType>> normalDistr = getBlockDistribution(region);
|
||||
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||
for (Countable<BlockType> count : normalDistr) {
|
||||
@ -2363,8 +2408,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @param expressionString the expression defining the shape
|
||||
* @param hollow whether the shape should be hollow
|
||||
* @return number of blocks changed
|
||||
* @throws ExpressionException Thrown when there's a problem during any stage of the expression compilation or evaluation.
|
||||
* @throws MaxChangedBlocksException Thrown when the block limit has been reached
|
||||
* @throws ExpressionException if there is a problem with the expression
|
||||
* @throws MaxChangedBlocksException if the maximum block change limit is exceeded
|
||||
*/
|
||||
public int makeShape(final Region region, final Vector3 zero, final Vector3 unit,
|
||||
final Pattern pattern, final String expressionString, final boolean hollow)
|
||||
@ -2383,11 +2428,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @param hollow whether the shape should be hollow
|
||||
* @param timeout the time, in milliseconds, to wait for each expression evaluation before halting it. -1 to disable
|
||||
* @return number of blocks changed
|
||||
* @throws ExpressionException Thrown when there's a problem during any stage of the expression compilation or evaluation.
|
||||
* @throws MaxChangedBlocksException Thrown when the block limit has been reached
|
||||
* @throws ExpressionException if there is a problem with the expression
|
||||
* @throws MaxChangedBlocksException if the maximum block change limit is exceeded
|
||||
*/
|
||||
public int makeShape(final Region region, final Vector3 zero, final Vector3 unit,
|
||||
final Pattern pattern, final String expressionString, final boolean hollow, final int timeout)
|
||||
final Pattern pattern, final String expressionString, final boolean hollow, final int timeout)
|
||||
throws ExpressionException, MaxChangedBlocksException {
|
||||
final Expression expression = Expression.compile(expressionString, "x", "y", "z", "type", "data");
|
||||
expression.optimize();
|
||||
@ -2548,63 +2593,64 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
|
||||
public int hollowOutRegion(Region region, int thickness, Pattern pattern, Mask mask) {
|
||||
try {
|
||||
final Set<BlockVector3> outside = new LocalBlockVectorSet();
|
||||
final Set<BlockVector3> outside = new LocalBlockVectorSet();
|
||||
|
||||
final BlockVector3 min = region.getMinimumPoint();
|
||||
final BlockVector3 max = region.getMaximumPoint();
|
||||
final BlockVector3 min = region.getMinimumPoint();
|
||||
final BlockVector3 max = region.getMaximumPoint();
|
||||
|
||||
final int minX = min.getBlockX();
|
||||
final int minY = min.getBlockY();
|
||||
final int minZ = min.getBlockZ();
|
||||
final int maxX = max.getBlockX();
|
||||
final int maxY = max.getBlockY();
|
||||
final int maxZ = max.getBlockZ();
|
||||
final int minX = min.getBlockX();
|
||||
final int minY = min.getBlockY();
|
||||
final int minZ = min.getBlockZ();
|
||||
final int maxX = max.getBlockX();
|
||||
final int maxY = max.getBlockY();
|
||||
final int maxZ = max.getBlockZ();
|
||||
|
||||
for (int x = minX; x <= maxX; ++x) {
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
recurseHollow(region, BlockVector3.at(x, y, minZ), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(x, y, maxZ), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
recurseHollow(region, BlockVector3.at(minX, y, z), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(maxX, y, z), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
for (int x = minX; x <= maxX; ++x) {
|
||||
recurseHollow(region, BlockVector3.at(x, minY, z), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(x, maxY, z), outside, mask);
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
recurseHollow(region, BlockVector3.at(x, y, minZ), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(x, y, maxZ), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
recurseHollow(region, BlockVector3.at(minX, y, z), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(maxX, y, z), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
for (int x = minX; x <= maxX; ++x) {
|
||||
recurseHollow(region, BlockVector3.at(x, minY, z), outside, mask);
|
||||
recurseHollow(region, BlockVector3.at(x, maxY, z), outside, mask);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < thickness; ++i) {
|
||||
final Set<BlockVector3> newOutside = new LocalBlockVectorSet();
|
||||
outer: for (BlockVector3 position : region) {
|
||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
||||
BlockVector3 neighbor = position.add(recurseDirection);
|
||||
|
||||
if (outside.contains(neighbor)) {
|
||||
newOutside.add(position);
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outside.addAll(newOutside);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < thickness; ++i) {
|
||||
final Set<BlockVector3> newOutside = new LocalBlockVectorSet();
|
||||
outer: for (BlockVector3 position : region) {
|
||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
||||
BlockVector3 neighbor = position.add(recurseDirection);
|
||||
|
||||
if (outside.contains(neighbor)) {
|
||||
newOutside.add(position);
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outside.addAll(newOutside);
|
||||
}
|
||||
|
||||
outer: for (BlockVector3 position : region) {
|
||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
||||
BlockVector3 neighbor = position.add(recurseDirection);
|
||||
if (outside.contains(neighbor)) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
this.changes++;
|
||||
this.changes++;
|
||||
pattern.apply(getExtent(), position, position);
|
||||
}
|
||||
} catch (WorldEditException e) {
|
||||
@ -2632,15 +2678,23 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @see #drawLine(Pattern, List, double, boolean)
|
||||
*/
|
||||
public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat)
|
||||
throws MaxChangedBlocksException {
|
||||
throws MaxChangedBlocksException {
|
||||
|
||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||
boolean notdrawn = true;
|
||||
|
||||
int x1 = pos1.getBlockX(), y1 = pos1.getBlockY(), z1 = pos1.getBlockZ();
|
||||
int x2 = pos2.getBlockX(), y2 = pos2.getBlockY(), z2 = pos2.getBlockZ();
|
||||
int tipx = x1, tipy = y1, tipz = z1;
|
||||
int dx = Math.abs(x2 - x1), dy = Math.abs(y2 - y1), dz = Math.abs(z2 - z1);
|
||||
int x1 = pos1.getBlockX();
|
||||
int y1 = pos1.getBlockY();
|
||||
int z1 = pos1.getBlockZ();
|
||||
int x2 = pos2.getBlockX();
|
||||
int y2 = pos2.getBlockY();
|
||||
int z2 = pos2.getBlockZ();
|
||||
int tipx = x1;
|
||||
int tipy = y1;
|
||||
int tipz = z1;
|
||||
int dx = Math.abs(x2 - x1);
|
||||
int dy = Math.abs(y2 - y1);
|
||||
int dz = Math.abs(z2 - z1);
|
||||
|
||||
if (dx + dy + dz == 0) {
|
||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
||||
@ -2667,8 +2721,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
} else if (dMax == dz && notdrawn) {
|
||||
for (int domstep = 0; domstep <= dz; domstep++) {
|
||||
tipz = z1 + domstep * (z2 - z1 > 0 ? 1 : -1);
|
||||
tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dz * (y2-y1>0 ? 1 : -1));
|
||||
tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dz * (x2-x1>0 ? 1 : -1));
|
||||
tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dz * (y2 - y1 > 0 ? 1 : -1));
|
||||
tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dz * (x2 - x1 > 0 ? 1 : -1));
|
||||
|
||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
||||
}
|
||||
@ -2708,10 +2762,18 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
BlockVector3 pos1 = vectors.get(i);
|
||||
BlockVector3 pos2 = vectors.get(i + 1);
|
||||
|
||||
int x1 = pos1.getBlockX(), y1 = pos1.getBlockY(), z1 = pos1.getBlockZ();
|
||||
int x2 = pos2.getBlockX(), y2 = pos2.getBlockY(), z2 = pos2.getBlockZ();
|
||||
int tipx = x1, tipy = y1, tipz = z1;
|
||||
int dx = Math.abs(x2 - x1), dy = Math.abs(y2 - y1), dz = Math.abs(z2 - z1);
|
||||
int x1 = pos1.getBlockX();
|
||||
int y1 = pos1.getBlockY();
|
||||
int z1 = pos1.getBlockZ();
|
||||
int x2 = pos2.getBlockX();
|
||||
int y2 = pos2.getBlockY();
|
||||
int z2 = pos2.getBlockZ();
|
||||
int tipx = x1;
|
||||
int tipy = y1;
|
||||
int tipz = z1;
|
||||
int dx = Math.abs(x2 - x1);
|
||||
int dy = Math.abs(y2 - y1);
|
||||
int dz = Math.abs(z2 - z1);
|
||||
|
||||
if (dx + dy + dz == 0) {
|
||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
||||
@ -2738,8 +2800,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
} else /* if (dMax == dz) */ {
|
||||
for (int domstep = 0; domstep <= dz; domstep++) {
|
||||
tipz = z1 + domstep * (z2 - z1 > 0 ? 1 : -1);
|
||||
tipy = (int) Math.round(y1 + domstep * ((double) dy) / ((double) dz) * (y2-y1>0 ? 1 : -1));
|
||||
tipx = (int) Math.round(x1 + domstep * ((double) dx) / ((double) dz) * (x2-x1>0 ? 1 : -1));
|
||||
tipy = (int) Math.round(y1 + domstep * ((double) dy) / ((double) dz) * (y2 - y1 > 0 ? 1 : -1));
|
||||
tipx = (int) Math.round(x1 + domstep * ((double) dx) / ((double) dz) * (x2 - x1 > 0 ? 1 : -1));
|
||||
|
||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
||||
}
|
||||
@ -2815,7 +2877,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
int ceilrad = (int) Math.ceil(radius);
|
||||
|
||||
for (BlockVector3 v : vset) {
|
||||
int tipx = v.getBlockX(), tipy = v.getBlockY(), tipz = v.getBlockZ();
|
||||
int tipx = v.getBlockX();
|
||||
int tipy = v.getBlockY();
|
||||
int tipz = v.getBlockZ();
|
||||
|
||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||
for (int loopy = tipy - ceilrad; loopy <= tipy + ceilrad; loopy++) {
|
||||
@ -2837,7 +2901,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
final LocalBlockVectorSet returnset = new LocalBlockVectorSet();
|
||||
final int ceilrad = (int) Math.ceil(radius);
|
||||
for (BlockVector3 v : vset) {
|
||||
final int tipx = v.getBlockX(), tipy = v.getBlockY(), tipz = v.getBlockZ();
|
||||
final int tipx = v.getBlockX();
|
||||
final int tipy = v.getBlockY();
|
||||
final int tipz = v.getBlockZ();
|
||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
||||
if (MathMan.hypot(loopx - tipx, 0, loopz - tipz) <= radius) {
|
||||
@ -2854,11 +2920,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
final LocalBlockVectorSet newset = new LocalBlockVectorSet();
|
||||
newset.addAll(vset);
|
||||
for (BlockVector3 v : newset) {
|
||||
final int x = v.getX(), y = v.getY(), z = v.getZ();
|
||||
if (!(newset.contains(x + 1, y, z) &&
|
||||
newset.contains(x - 1, y, z) &&
|
||||
newset.contains(x, y, z + 1) &&
|
||||
newset.contains(x, y, z - 1))) {
|
||||
final int x = v.getX();
|
||||
final int y = v.getY();
|
||||
final int z = v.getZ();
|
||||
if (!(newset.contains(x + 1, y, z)
|
||||
&& newset.contains(x - 1, y, z)
|
||||
&& newset.contains(x, y, z + 1)
|
||||
&& newset.contains(x, y, z - 1))) {
|
||||
returnset.add(v);
|
||||
}
|
||||
}
|
||||
@ -2870,13 +2938,15 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
final LocalBlockVectorSet newset = new LocalBlockVectorSet();
|
||||
newset.addAll(vset);
|
||||
for (BlockVector3 v : newset) {
|
||||
final int x = v.getX(), y = v.getY(), z = v.getZ();
|
||||
if (!(newset.contains(x + 1, y, z) &&
|
||||
newset.contains(x - 1, y, z) &&
|
||||
newset.contains(x, y + 1, z) &&
|
||||
newset.contains(x, y - 1, z) &&
|
||||
newset.contains(x, y, z + 1) &&
|
||||
newset.contains(x, y, z - 1))) {
|
||||
final int x = v.getX();
|
||||
final int y = v.getY();
|
||||
final int z = v.getZ();
|
||||
if (!(newset.contains(x + 1, y, z)
|
||||
&& newset.contains(x - 1, y, z)
|
||||
&& newset.contains(x, y + 1, z)
|
||||
&& newset.contains(x, y - 1, z)
|
||||
&& newset.contains(x, y, z + 1)
|
||||
&& newset.contains(x, y, z - 1))) {
|
||||
returnset.add(v);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user