Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-19 17:30:08 +01:00
Minor refactor, add various javadocs
Dieser Commit ist enthalten in:
Ursprung
f14df0b63d
Commit
7bf6524a34
@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
|
||||
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.entity.LazyBaseEntity;
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R2;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
|
@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
|
||||
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.entity.LazyBaseEntity;
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R3;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
|
@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
|
||||
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.entity.LazyBaseEntity;
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R4;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.util.ExtentTraverser;
|
||||
import com.fastasyncworldedit.core.wrappers.WorldWrapper;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
|
@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
|
||||
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.entity.LazyBaseEntity;
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.util.ExtentTraverser;
|
||||
import com.fastasyncworldedit.core.wrappers.WorldWrapper;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
|
@ -21,7 +21,7 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
|
||||
import com.fastasyncworldedit.core.configuration.Settings;
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
import com.google.common.collect.Sets;
|
||||
|
@ -23,7 +23,7 @@ import com.fastasyncworldedit.bukkit.FaweBukkit;
|
||||
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
|
||||
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
||||
import com.fastasyncworldedit.core.Fawe;
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.fastasyncworldedit.core.extent;
|
||||
package com.fastasyncworldedit.core.extent.processor;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.filter.block.FilterBlock;
|
||||
import com.fastasyncworldedit.core.extent.processor.ProcessorScope;
|
||||
import com.fastasyncworldedit.core.function.mask.AdjacentAny2DMask;
|
||||
import com.fastasyncworldedit.core.math.BlockVector3ChunkMap;
|
||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||
@ -37,6 +36,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Processor/pattern that uses Minecraft internal methods to determine the shape of blocks, e.g. stairs and fences
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public abstract class PlacementStateProcessor extends AbstractDelegateExtent implements IBatchProcessor, Pattern {
|
||||
|
||||
private static final Direction[] NESW = new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST};
|
||||
@ -62,7 +66,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
private int processChunkZ;
|
||||
|
||||
/**
|
||||
* Process/extent/pattern for performing block updates, e.g. stair shape and glass pane connections
|
||||
* Processor/pattern for performing block updates, e.g. stair shape and glass pane connections
|
||||
*
|
||||
* @param extent Extent to use
|
||||
* @param mask Mask of blocks to perform updates on
|
||||
@ -208,7 +212,13 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
return processChunkSet;
|
||||
}
|
||||
|
||||
private void checkAndPerformUpdate(Map<BlockVector3, CompoundTag> setTiles, char[] set, int index, int blockY, boolean firstPass) {
|
||||
private void checkAndPerformUpdate(
|
||||
Map<BlockVector3, CompoundTag> setTiles,
|
||||
char[] set,
|
||||
int index,
|
||||
int blockY,
|
||||
boolean firstPass
|
||||
) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int blockZ = processChunkZ + z;
|
||||
for (int x = 0; x < 16; x++, index++) {
|
@ -5,6 +5,11 @@ import com.sk89q.worldedit.function.mask.AbstractMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
/**
|
||||
* Mask that tests adjacency only in 2D/the same y-level
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public class Adjacent2DMask extends AbstractMask {
|
||||
|
||||
private final int min;
|
||||
@ -12,6 +17,14 @@ public class Adjacent2DMask extends AbstractMask {
|
||||
private final Mask mask;
|
||||
private final MutableBlockVector3 vector;
|
||||
|
||||
/**
|
||||
* Mask that tests adjacency only in 2D/the same y-level
|
||||
*
|
||||
* @param mask Mask required to be adjacent
|
||||
* @param requiredMin Minimum number of positive adjacency matches required
|
||||
* @param requiredMax Maximum number of positive adjacency matches required
|
||||
* @since TODO
|
||||
*/
|
||||
public Adjacent2DMask(Mask mask, int requiredMin, int requiredMax) {
|
||||
this.mask = mask;
|
||||
this.min = requiredMin;
|
||||
|
@ -8,17 +8,32 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
/**
|
||||
* Just an optimized version of the Adjacent Mask for single adjacency.
|
||||
* Optimized version of {@link Adjacent2DMask} for testing for any single adjacency
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public class AdjacentAny2DMask extends AbstractMask {
|
||||
|
||||
private final Mask mask;
|
||||
private final MutableBlockVector3 mutable;
|
||||
|
||||
/**
|
||||
* Optimized version of {@link Adjacent2DMask} for testing for any single adjacency. Caches results of the adjacent mask
|
||||
*
|
||||
* @param mask Mask required to be adjacent
|
||||
* @since TODO
|
||||
*/
|
||||
public AdjacentAny2DMask(Mask mask) {
|
||||
this(mask, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimized version of {@link Adjacent2DMask} for testing for any single adjacency
|
||||
*
|
||||
* @param mask Mask required to be adjacent
|
||||
* @param cache If the result of the adjacency mask should be cached
|
||||
* @since TODO
|
||||
*/
|
||||
public AdjacentAny2DMask(Mask mask, boolean cache) {
|
||||
this.mask = cache ? CachedMask.cache(mask) : mask;
|
||||
mutable = new MutableBlockVector3();
|
||||
@ -41,11 +56,20 @@ public class AdjacentAny2DMask extends AbstractMask {
|
||||
return mask.test(mutable.setComponents(x, y, z - 1));
|
||||
}
|
||||
|
||||
public boolean test(Extent extent, BlockVector3 v) {
|
||||
AbstractExtentMask extentMask = (AbstractExtentMask) mask;
|
||||
int x = v.x();
|
||||
int y = v.y();
|
||||
int z = v.z();
|
||||
/**
|
||||
* Test this mask for the given extent
|
||||
*
|
||||
* @param extent extent to test in
|
||||
* @param position position to test at
|
||||
* @since TODO
|
||||
*/
|
||||
public boolean test(Extent extent, BlockVector3 position) {
|
||||
if (!(mask instanceof AbstractExtentMask extentMask)) {
|
||||
throw new UnsupportedOperationException("Adjacency mask must inherit from AbstractExtentMask");
|
||||
}
|
||||
int x = position.x();
|
||||
int y = position.y();
|
||||
int z = position.z();
|
||||
if (extentMask.test(extent, mutable.setComponents(x + 1, y, z))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -421,6 +421,8 @@ public final class EditSessionBuilder {
|
||||
|
||||
/**
|
||||
* Set the side effects to be used with this edit
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public EditSessionBuilder setSideEffectSet(@Nullable SideEffectSet sideEffectSet) {
|
||||
this.sideEffectSet = sideEffectSet;
|
||||
@ -752,6 +754,8 @@ public final class EditSessionBuilder {
|
||||
|
||||
/**
|
||||
* Get the SideEffectSet that will be used
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public SideEffectSet getSideEffectSet() {
|
||||
return sideEffectSet;
|
||||
|
@ -118,7 +118,7 @@ public class RegionCommands {
|
||||
Actor actor, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern
|
||||
Pattern pattern
|
||||
) {
|
||||
int affected = editSession.setBlocks(region, pattern);
|
||||
if (affected != 0) {
|
||||
@ -233,11 +233,11 @@ public class RegionCommands {
|
||||
Actor actor, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern pattern,
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The thickness of the line", def = "0")
|
||||
int thickness,
|
||||
int thickness,
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell
|
||||
boolean shell
|
||||
) throws WorldEditException {
|
||||
if (!(region instanceof CuboidRegion cuboidregion)) {
|
||||
actor.print(Caption.of("worldedit.line.cuboid-only"));
|
||||
@ -266,11 +266,11 @@ public class RegionCommands {
|
||||
Actor actor, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern pattern,
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The thickness of the curve", def = "0")
|
||||
int thickness,
|
||||
int thickness,
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell
|
||||
boolean shell
|
||||
) throws WorldEditException {
|
||||
if (!(region instanceof ConvexPolyhedralRegion cpregion)) {
|
||||
actor.print(Caption.of("worldedit.curve.invalid-type"));
|
||||
@ -298,9 +298,9 @@ public class RegionCommands {
|
||||
public int replace(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The mask representing blocks to replace", def = "")
|
||||
Mask from,
|
||||
Mask from,
|
||||
@Arg(desc = "The pattern of blocks to replace with")
|
||||
Pattern to
|
||||
Pattern to
|
||||
) throws WorldEditException {
|
||||
if (from == null) {
|
||||
from = new ExistingBlockMask(editSession);
|
||||
@ -324,7 +324,7 @@ public class RegionCommands {
|
||||
public int overlay(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to overlay")
|
||||
Pattern pattern
|
||||
Pattern pattern
|
||||
) throws WorldEditException {
|
||||
int affected = editSession.overlayCuboidBlocks(region, pattern);
|
||||
actor.print(Caption.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
|
||||
@ -380,7 +380,7 @@ public class RegionCommands {
|
||||
public int center(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern
|
||||
Pattern pattern
|
||||
) throws WorldEditException {
|
||||
int affected = editSession.center(region, pattern);
|
||||
actor.print(Caption.of("worldedit.center.changed", TextComponent.of(affected)));
|
||||
@ -412,7 +412,7 @@ public class RegionCommands {
|
||||
public int walls(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern
|
||||
Pattern pattern
|
||||
) throws WorldEditException {
|
||||
int affected = editSession.makeWalls(region, pattern);
|
||||
actor.print(Caption.of("worldedit.walls.changed", TextComponent.of(affected)));
|
||||
@ -431,7 +431,7 @@ public class RegionCommands {
|
||||
public int faces(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern
|
||||
Pattern pattern
|
||||
) throws WorldEditException {
|
||||
int affected = editSession.makeFaces(region, pattern);
|
||||
actor.print(Caption.of("worldedit.faces.changed", TextComponent.of(affected)));
|
||||
@ -451,9 +451,9 @@ public class RegionCommands {
|
||||
public int smooth(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "# of iterations to perform", def = "1")
|
||||
int iterations,
|
||||
int iterations,
|
||||
@Arg(desc = "The mask of blocks to use as the height map", def = "")
|
||||
Mask mask
|
||||
Mask mask
|
||||
) throws WorldEditException {
|
||||
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow)
|
||||
new MaskTraverser(mask).setNewExtent(editSession);
|
||||
@ -526,11 +526,11 @@ public class RegionCommands {
|
||||
public int snowSmooth(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "# of iterations to perform", def = "1")
|
||||
int iterations,
|
||||
int iterations,
|
||||
@ArgFlag(name = 'l', desc = "Set the amount of snow blocks under the snow", def = "1")
|
||||
int snowBlockCount,
|
||||
int snowBlockCount,
|
||||
@ArgFlag(name = 'm', desc = "The mask of blocks to use as the height map")
|
||||
Mask mask
|
||||
Mask mask
|
||||
) throws WorldEditException {
|
||||
SnowHeightMap heightMap = new SnowHeightMap(editSession, region, mask);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
@ -554,22 +554,22 @@ public class RegionCommands {
|
||||
Actor actor, World world, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of blocks to move", def = "1")
|
||||
int count,
|
||||
int count,
|
||||
@Arg(desc = "The direction to move", def = Direction.AIM)
|
||||
@Direction(includeDiagonals = true)
|
||||
BlockVector3 direction,
|
||||
BlockVector3 direction,
|
||||
@Arg(desc = "The pattern of blocks to leave", def = "air")
|
||||
Pattern replace,
|
||||
Pattern replace,
|
||||
@Switch(name = 's', desc = "Shift the selection to the target location")
|
||||
boolean moveSelection,
|
||||
boolean moveSelection,
|
||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name = 'e', desc = "Also copy entities")
|
||||
boolean copyEntities,
|
||||
boolean copyEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes,
|
||||
boolean copyBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air")
|
||||
Mask mask
|
||||
Mask mask
|
||||
) throws WorldEditException {
|
||||
checkCommandArgument(count >= 1, "Multiplier must be >= 1");
|
||||
|
||||
@ -618,9 +618,9 @@ public class RegionCommands {
|
||||
Actor actor, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "BlockStateHolder", def = "air")
|
||||
BlockStateHolder replace,
|
||||
BlockStateHolder replace,
|
||||
@Switch(name = 'm', desc = "Only fall within the vertical selection")
|
||||
boolean notFullHeight
|
||||
boolean notFullHeight
|
||||
) throws WorldEditException {
|
||||
int affected = editSession.fall(region, !notFullHeight, replace);
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
@ -639,20 +639,20 @@ public class RegionCommands {
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of copies to stack", def = "1")
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
int count,
|
||||
int count,
|
||||
@Arg(desc = "How far to move the contents each stack", def = Offset.FORWARD)
|
||||
@Offset
|
||||
BlockVector3 direction,
|
||||
BlockVector3 direction,
|
||||
@Switch(name = 's', desc = "Shift the selection to the last stacked copy")
|
||||
boolean moveSelection,
|
||||
boolean moveSelection,
|
||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name = 'e', desc = "Also copy entities")
|
||||
boolean copyEntities,
|
||||
boolean copyEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes,
|
||||
boolean copyBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air")
|
||||
Mask mask
|
||||
Mask mask
|
||||
) throws WorldEditException {
|
||||
checkCommandArgument(count >= 1, "Count must be >= 1");
|
||||
|
||||
@ -704,13 +704,13 @@ public class RegionCommands {
|
||||
Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The seed to regenerate with, otherwise uses world seed", def = "")
|
||||
Long seed,
|
||||
Long seed,
|
||||
@Switch(name = 'b', desc = "Regenerate biomes as well")
|
||||
boolean regenBiomes,
|
||||
boolean regenBiomes,
|
||||
@Switch(name = 'r', desc = "If the seed should be randomized")
|
||||
boolean randomSeed,
|
||||
boolean randomSeed,
|
||||
@Arg(desc = "Biome to apply for this regeneration (only works in overworld)", def = "")
|
||||
BiomeType biomeType
|
||||
BiomeType biomeType
|
||||
) throws WorldEditException {
|
||||
Mask mask = session.getMask();
|
||||
boolean success;
|
||||
@ -759,13 +759,13 @@ public class RegionCommands {
|
||||
Actor actor, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The expression to use", variable = true)
|
||||
List<String> expression,
|
||||
List<String> expression,
|
||||
@Switch(name = 'r', desc = "Use the game's coordinate origin")
|
||||
boolean useRawCoords,
|
||||
boolean useRawCoords,
|
||||
@Switch(name = 'o', desc = "Use the placement's coordinate origin")
|
||||
boolean offset,
|
||||
boolean offset,
|
||||
@Switch(name = 'c', desc = "Use the selection's center as origin")
|
||||
boolean offsetCenter
|
||||
boolean offsetCenter
|
||||
) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
@ -837,11 +837,11 @@ public class RegionCommands {
|
||||
Actor actor, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "Thickness of the shell to leave", def = "0")
|
||||
int thickness,
|
||||
int thickness,
|
||||
@Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air")
|
||||
Pattern pattern,
|
||||
Pattern pattern,
|
||||
@ArgFlag(name = 'm', desc = "Mask to hollow with")
|
||||
Mask mask
|
||||
Mask mask
|
||||
) throws WorldEditException {
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow)
|
||||
@ -871,9 +871,9 @@ public class RegionCommands {
|
||||
public int forest(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The type of tree to place", def = "tree")
|
||||
TreeType type,
|
||||
TreeType type,
|
||||
@Arg(desc = "The density of the forest", def = "5")
|
||||
double density
|
||||
double density
|
||||
) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
int affected = editSession.makeForest(region, density / 100, type);
|
||||
@ -893,7 +893,7 @@ public class RegionCommands {
|
||||
public int flora(
|
||||
Actor actor, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The density of the forest", def = "5")
|
||||
double density
|
||||
double density
|
||||
) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
density = density / 100;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.platform;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.PlacementStateProcessor;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.Relighter;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
|
@ -142,6 +142,11 @@ public class BlockTypeMask extends AbstractExtentMask {
|
||||
return types[block.getInternalId()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a block state against this block type mask
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public <B extends BlockStateHolder<B>> boolean test(B blockStateHolder) {
|
||||
return types[blockStateHolder.getBlockType().getInternalId()];
|
||||
}
|
||||
|
@ -359,6 +359,12 @@ public enum Direction {
|
||||
}
|
||||
|
||||
//FAWE start - utility methods for block states
|
||||
|
||||
/**
|
||||
* Get the directions associated with the given block state, e.g. the connections a fence makes or the direction stairs face
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public static EnumSet<Direction> getDirections(BlockState state) {
|
||||
Set<Direction> directions = new HashSet<>();
|
||||
for (Property<?> property : state.getBlockType().getProperties()) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren