3
0
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:
dordsor21 2024-05-31 20:42:07 +01:00
Ursprung f14df0b63d
Commit 7bf6524a34
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
18 geänderte Dateien mit 132 neuen und 70 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.entity.LazyBaseEntity; 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.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.nbt.FaweCompoundTag; import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;

Datei anzeigen

@ -1,6 +1,6 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R2; 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.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.BlockTypeMask;

Datei anzeigen

@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.entity.LazyBaseEntity; 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.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.nbt.FaweCompoundTag; import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;

Datei anzeigen

@ -1,6 +1,6 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R3; 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.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.BlockTypeMask;

Datei anzeigen

@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.entity.LazyBaseEntity; 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.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.nbt.FaweCompoundTag; import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;

Datei anzeigen

@ -1,6 +1,6 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R4; 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.util.ExtentTraverser;
import com.fastasyncworldedit.core.wrappers.WorldWrapper; import com.fastasyncworldedit.core.wrappers.WorldWrapper;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;

Datei anzeigen

@ -4,7 +4,7 @@ import com.fastasyncworldedit.bukkit.adapter.FaweAdapter;
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.entity.LazyBaseEntity; 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.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.nbt.FaweCompoundTag; import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;

Datei anzeigen

@ -1,6 +1,6 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1; 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.util.ExtentTraverser;
import com.fastasyncworldedit.core.wrappers.WorldWrapper; import com.fastasyncworldedit.core.wrappers.WorldWrapper;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;

Datei anzeigen

@ -21,7 +21,7 @@ package com.sk89q.worldedit.bukkit;
import com.fastasyncworldedit.bukkit.util.MinecraftVersion; import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
import com.fastasyncworldedit.core.configuration.Settings; 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.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;

Datei anzeigen

@ -23,7 +23,7 @@ import com.fastasyncworldedit.bukkit.FaweBukkit;
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter; import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
import com.fastasyncworldedit.core.Fawe; 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.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;
import com.fastasyncworldedit.core.queue.IChunkGet; import com.fastasyncworldedit.core.queue.IChunkGet;

Datei anzeigen

@ -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.filter.block.FilterBlock;
import com.fastasyncworldedit.core.extent.processor.ProcessorScope;
import com.fastasyncworldedit.core.function.mask.AdjacentAny2DMask; import com.fastasyncworldedit.core.function.mask.AdjacentAny2DMask;
import com.fastasyncworldedit.core.math.BlockVector3ChunkMap; import com.fastasyncworldedit.core.math.BlockVector3ChunkMap;
import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.fastasyncworldedit.core.math.MutableBlockVector3;
@ -37,6 +36,11 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; 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 { public abstract class PlacementStateProcessor extends AbstractDelegateExtent implements IBatchProcessor, Pattern {
private static final Direction[] NESW = new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}; 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; 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 extent Extent to use
* @param mask Mask of blocks to perform updates on * @param mask Mask of blocks to perform updates on
@ -208,7 +212,13 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
return processChunkSet; 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++) { for (int z = 0; z < 16; z++) {
int blockZ = processChunkZ + z; int blockZ = processChunkZ + z;
for (int x = 0; x < 16; x++, index++) { for (int x = 0; x < 16; x++, index++) {

Datei anzeigen

@ -5,6 +5,11 @@ import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
/**
* Mask that tests adjacency only in 2D/the same y-level
*
* @since TODO
*/
public class Adjacent2DMask extends AbstractMask { public class Adjacent2DMask extends AbstractMask {
private final int min; private final int min;
@ -12,6 +17,14 @@ public class Adjacent2DMask extends AbstractMask {
private final Mask mask; private final Mask mask;
private final MutableBlockVector3 vector; 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) { public Adjacent2DMask(Mask mask, int requiredMin, int requiredMax) {
this.mask = mask; this.mask = mask;
this.min = requiredMin; this.min = requiredMin;

Datei anzeigen

@ -8,17 +8,32 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3; 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 { public class AdjacentAny2DMask extends AbstractMask {
private final Mask mask; private final Mask mask;
private final MutableBlockVector3 mutable; 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) { public AdjacentAny2DMask(Mask mask) {
this(mask, true); 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) { public AdjacentAny2DMask(Mask mask, boolean cache) {
this.mask = cache ? CachedMask.cache(mask) : mask; this.mask = cache ? CachedMask.cache(mask) : mask;
mutable = new MutableBlockVector3(); mutable = new MutableBlockVector3();
@ -41,11 +56,20 @@ public class AdjacentAny2DMask extends AbstractMask {
return mask.test(mutable.setComponents(x, y, z - 1)); return mask.test(mutable.setComponents(x, y, z - 1));
} }
public boolean test(Extent extent, BlockVector3 v) { /**
AbstractExtentMask extentMask = (AbstractExtentMask) mask; * Test this mask for the given extent
int x = v.x(); *
int y = v.y(); * @param extent extent to test in
int z = v.z(); * @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))) { if (extentMask.test(extent, mutable.setComponents(x + 1, y, z))) {
return true; return true;
} }

Datei anzeigen

@ -421,6 +421,8 @@ public final class EditSessionBuilder {
/** /**
* Set the side effects to be used with this edit * Set the side effects to be used with this edit
*
* @since TODO
*/ */
public EditSessionBuilder setSideEffectSet(@Nullable SideEffectSet sideEffectSet) { public EditSessionBuilder setSideEffectSet(@Nullable SideEffectSet sideEffectSet) {
this.sideEffectSet = sideEffectSet; this.sideEffectSet = sideEffectSet;
@ -752,6 +754,8 @@ public final class EditSessionBuilder {
/** /**
* Get the SideEffectSet that will be used * Get the SideEffectSet that will be used
*
* @since TODO
*/ */
public SideEffectSet getSideEffectSet() { public SideEffectSet getSideEffectSet() {
return sideEffectSet; return sideEffectSet;

Datei anzeigen

@ -118,7 +118,7 @@ public class RegionCommands {
Actor actor, EditSession editSession, Actor actor, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern Pattern pattern
) { ) {
int affected = editSession.setBlocks(region, pattern); int affected = editSession.setBlocks(region, pattern);
if (affected != 0) { if (affected != 0) {
@ -233,11 +233,11 @@ public class RegionCommands {
Actor actor, EditSession editSession, Actor actor, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The pattern of blocks to place") @Arg(desc = "The pattern of blocks to place")
Pattern pattern, Pattern pattern,
@Arg(desc = "The thickness of the line", def = "0") @Arg(desc = "The thickness of the line", def = "0")
int thickness, int thickness,
@Switch(name = 'h', desc = "Generate only a shell") @Switch(name = 'h', desc = "Generate only a shell")
boolean shell boolean shell
) throws WorldEditException { ) throws WorldEditException {
if (!(region instanceof CuboidRegion cuboidregion)) { if (!(region instanceof CuboidRegion cuboidregion)) {
actor.print(Caption.of("worldedit.line.cuboid-only")); actor.print(Caption.of("worldedit.line.cuboid-only"));
@ -266,11 +266,11 @@ public class RegionCommands {
Actor actor, EditSession editSession, Actor actor, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The pattern of blocks to place") @Arg(desc = "The pattern of blocks to place")
Pattern pattern, Pattern pattern,
@Arg(desc = "The thickness of the curve", def = "0") @Arg(desc = "The thickness of the curve", def = "0")
int thickness, int thickness,
@Switch(name = 'h', desc = "Generate only a shell") @Switch(name = 'h', desc = "Generate only a shell")
boolean shell boolean shell
) throws WorldEditException { ) throws WorldEditException {
if (!(region instanceof ConvexPolyhedralRegion cpregion)) { if (!(region instanceof ConvexPolyhedralRegion cpregion)) {
actor.print(Caption.of("worldedit.curve.invalid-type")); actor.print(Caption.of("worldedit.curve.invalid-type"));
@ -298,9 +298,9 @@ public class RegionCommands {
public int replace( public int replace(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The mask representing blocks to replace", def = "") @Arg(desc = "The mask representing blocks to replace", def = "")
Mask from, Mask from,
@Arg(desc = "The pattern of blocks to replace with") @Arg(desc = "The pattern of blocks to replace with")
Pattern to Pattern to
) throws WorldEditException { ) throws WorldEditException {
if (from == null) { if (from == null) {
from = new ExistingBlockMask(editSession); from = new ExistingBlockMask(editSession);
@ -324,7 +324,7 @@ public class RegionCommands {
public int overlay( public int overlay(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to overlay") @Arg(desc = "The pattern of blocks to overlay")
Pattern pattern Pattern pattern
) throws WorldEditException { ) throws WorldEditException {
int affected = editSession.overlayCuboidBlocks(region, pattern); int affected = editSession.overlayCuboidBlocks(region, pattern);
actor.print(Caption.of("worldedit.overlay.overlaid", TextComponent.of(affected))); actor.print(Caption.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
@ -380,7 +380,7 @@ public class RegionCommands {
public int center( public int center(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern Pattern pattern
) throws WorldEditException { ) throws WorldEditException {
int affected = editSession.center(region, pattern); int affected = editSession.center(region, pattern);
actor.print(Caption.of("worldedit.center.changed", TextComponent.of(affected))); actor.print(Caption.of("worldedit.center.changed", TextComponent.of(affected)));
@ -412,7 +412,7 @@ public class RegionCommands {
public int walls( public int walls(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern Pattern pattern
) throws WorldEditException { ) throws WorldEditException {
int affected = editSession.makeWalls(region, pattern); int affected = editSession.makeWalls(region, pattern);
actor.print(Caption.of("worldedit.walls.changed", TextComponent.of(affected))); actor.print(Caption.of("worldedit.walls.changed", TextComponent.of(affected)));
@ -431,7 +431,7 @@ public class RegionCommands {
public int faces( public int faces(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern Pattern pattern
) throws WorldEditException { ) throws WorldEditException {
int affected = editSession.makeFaces(region, pattern); int affected = editSession.makeFaces(region, pattern);
actor.print(Caption.of("worldedit.faces.changed", TextComponent.of(affected))); actor.print(Caption.of("worldedit.faces.changed", TextComponent.of(affected)));
@ -451,9 +451,9 @@ public class RegionCommands {
public int smooth( public int smooth(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "# of iterations to perform", def = "1") @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 = "") @Arg(desc = "The mask of blocks to use as the height map", def = "")
Mask mask Mask mask
) throws WorldEditException { ) throws WorldEditException {
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow) //FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow)
new MaskTraverser(mask).setNewExtent(editSession); new MaskTraverser(mask).setNewExtent(editSession);
@ -526,11 +526,11 @@ public class RegionCommands {
public int snowSmooth( public int snowSmooth(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "# of iterations to perform", def = "1") @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") @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") @ArgFlag(name = 'm', desc = "The mask of blocks to use as the height map")
Mask mask Mask mask
) throws WorldEditException { ) throws WorldEditException {
SnowHeightMap heightMap = new SnowHeightMap(editSession, region, mask); SnowHeightMap heightMap = new SnowHeightMap(editSession, region, mask);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
@ -554,22 +554,22 @@ public class RegionCommands {
Actor actor, World world, EditSession editSession, LocalSession session, Actor actor, World world, EditSession editSession, LocalSession session,
@Selection Region region, @Selection Region region,
@Arg(desc = "# of blocks to move", def = "1") @Arg(desc = "# of blocks to move", def = "1")
int count, int count,
@Arg(desc = "The direction to move", def = Direction.AIM) @Arg(desc = "The direction to move", def = Direction.AIM)
@Direction(includeDiagonals = true) @Direction(includeDiagonals = true)
BlockVector3 direction, BlockVector3 direction,
@Arg(desc = "The pattern of blocks to leave", def = "air") @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") @Switch(name = 's', desc = "Shift the selection to the target location")
boolean moveSelection, boolean moveSelection,
@Switch(name = 'a', desc = "Ignore air blocks") @Switch(name = 'a', desc = "Ignore air blocks")
boolean ignoreAirBlocks, boolean ignoreAirBlocks,
@Switch(name = 'e', desc = "Also copy entities") @Switch(name = 'e', desc = "Also copy entities")
boolean copyEntities, boolean copyEntities,
@Switch(name = 'b', desc = "Also copy biomes") @Switch(name = 'b', desc = "Also copy biomes")
boolean copyBiomes, boolean copyBiomes,
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air") @ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air")
Mask mask Mask mask
) throws WorldEditException { ) throws WorldEditException {
checkCommandArgument(count >= 1, "Multiplier must be >= 1"); checkCommandArgument(count >= 1, "Multiplier must be >= 1");
@ -618,9 +618,9 @@ public class RegionCommands {
Actor actor, EditSession editSession, Actor actor, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "BlockStateHolder", def = "air") @Arg(desc = "BlockStateHolder", def = "air")
BlockStateHolder replace, BlockStateHolder replace,
@Switch(name = 'm', desc = "Only fall within the vertical selection") @Switch(name = 'm', desc = "Only fall within the vertical selection")
boolean notFullHeight boolean notFullHeight
) throws WorldEditException { ) throws WorldEditException {
int affected = editSession.fall(region, !notFullHeight, replace); int affected = editSession.fall(region, !notFullHeight, replace);
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected)); actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
@ -639,20 +639,20 @@ public class RegionCommands {
@Selection Region region, @Selection Region region,
@Arg(desc = "# of copies to stack", def = "1") @Arg(desc = "# of copies to stack", def = "1")
@Confirm(Confirm.Processor.REGION) @Confirm(Confirm.Processor.REGION)
int count, int count,
@Arg(desc = "How far to move the contents each stack", def = Offset.FORWARD) @Arg(desc = "How far to move the contents each stack", def = Offset.FORWARD)
@Offset @Offset
BlockVector3 direction, BlockVector3 direction,
@Switch(name = 's', desc = "Shift the selection to the last stacked copy") @Switch(name = 's', desc = "Shift the selection to the last stacked copy")
boolean moveSelection, boolean moveSelection,
@Switch(name = 'a', desc = "Ignore air blocks") @Switch(name = 'a', desc = "Ignore air blocks")
boolean ignoreAirBlocks, boolean ignoreAirBlocks,
@Switch(name = 'e', desc = "Also copy entities") @Switch(name = 'e', desc = "Also copy entities")
boolean copyEntities, boolean copyEntities,
@Switch(name = 'b', desc = "Also copy biomes") @Switch(name = 'b', desc = "Also copy biomes")
boolean copyBiomes, boolean copyBiomes,
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air") @ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air")
Mask mask Mask mask
) throws WorldEditException { ) throws WorldEditException {
checkCommandArgument(count >= 1, "Count must be >= 1"); checkCommandArgument(count >= 1, "Count must be >= 1");
@ -704,13 +704,13 @@ public class RegionCommands {
Actor actor, World world, LocalSession session, EditSession editSession, Actor actor, World world, LocalSession session, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The seed to regenerate with, otherwise uses world seed", def = "") @Arg(desc = "The seed to regenerate with, otherwise uses world seed", def = "")
Long seed, Long seed,
@Switch(name = 'b', desc = "Regenerate biomes as well") @Switch(name = 'b', desc = "Regenerate biomes as well")
boolean regenBiomes, boolean regenBiomes,
@Switch(name = 'r', desc = "If the seed should be randomized") @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 = "") @Arg(desc = "Biome to apply for this regeneration (only works in overworld)", def = "")
BiomeType biomeType BiomeType biomeType
) throws WorldEditException { ) throws WorldEditException {
Mask mask = session.getMask(); Mask mask = session.getMask();
boolean success; boolean success;
@ -759,13 +759,13 @@ public class RegionCommands {
Actor actor, LocalSession session, EditSession editSession, Actor actor, LocalSession session, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The expression to use", variable = true) @Arg(desc = "The expression to use", variable = true)
List<String> expression, List<String> expression,
@Switch(name = 'r', desc = "Use the game's coordinate origin") @Switch(name = 'r', desc = "Use the game's coordinate origin")
boolean useRawCoords, boolean useRawCoords,
@Switch(name = 'o', desc = "Use the placement's coordinate origin") @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") @Switch(name = 'c', desc = "Use the selection's center as origin")
boolean offsetCenter boolean offsetCenter
) throws WorldEditException { ) throws WorldEditException {
final Vector3 zero; final Vector3 zero;
Vector3 unit; Vector3 unit;
@ -837,11 +837,11 @@ public class RegionCommands {
Actor actor, EditSession editSession, Actor actor, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "Thickness of the shell to leave", def = "0") @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") @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") @ArgFlag(name = 'm', desc = "Mask to hollow with")
Mask mask Mask mask
) throws WorldEditException { ) throws WorldEditException {
checkCommandArgument(thickness >= 0, "Thickness must be >= 0"); checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow) //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( public int forest(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The type of tree to place", def = "tree") @Arg(desc = "The type of tree to place", def = "tree")
TreeType type, TreeType type,
@Arg(desc = "The density of the forest", def = "5") @Arg(desc = "The density of the forest", def = "5")
double density double density
) throws WorldEditException { ) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]"); checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
int affected = editSession.makeForest(region, density / 100, type); int affected = editSession.makeForest(region, density / 100, type);
@ -893,7 +893,7 @@ public class RegionCommands {
public int flora( public int flora(
Actor actor, EditSession editSession, @Selection Region region, Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The density of the forest", def = "5") @Arg(desc = "The density of the forest", def = "5")
double density double density
) throws WorldEditException { ) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]"); checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
density = density / 100; density = density / 100;

Datei anzeigen

@ -19,7 +19,7 @@
package com.sk89q.worldedit.extension.platform; 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.Relighter;
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;

Datei anzeigen

@ -142,6 +142,11 @@ public class BlockTypeMask extends AbstractExtentMask {
return types[block.getInternalId()]; return types[block.getInternalId()];
} }
/**
* Test a block state against this block type mask
*
* @since TODO
*/
public <B extends BlockStateHolder<B>> boolean test(B blockStateHolder) { public <B extends BlockStateHolder<B>> boolean test(B blockStateHolder) {
return types[blockStateHolder.getBlockType().getInternalId()]; return types[blockStateHolder.getBlockType().getInternalId()];
} }

Datei anzeigen

@ -359,6 +359,12 @@ public enum Direction {
} }
//FAWE start - utility methods for block states //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) { public static EnumSet<Direction> getDirections(BlockState state) {
Set<Direction> directions = new HashSet<>(); Set<Direction> directions = new HashSet<>();
for (Property<?> property : state.getBlockType().getProperties()) { for (Property<?> property : state.getBlockType().getProperties()) {