From 45aaade039e4ac563f2f818f3e7905955ce7e36f Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 31 May 2024 20:42:07 +0100 Subject: [PATCH] Minor refactor, add various javadocs --- .../fawe/v1_19_R3/PaperweightFaweAdapter.java | 2 +- .../PaperweightPlacementStateProcessor.java | 2 +- .../fawe/v1_20_R1/PaperweightFaweAdapter.java | 2 +- .../PaperweightPlacementStateProcessor.java | 2 +- .../fawe/v1_20_R2/PaperweightFaweAdapter.java | 2 +- .../PaperweightPlacementStateProcessor.java | 2 +- .../fawe/v1_20_R3/PaperweightFaweAdapter.java | 2 +- .../PaperweightPlacementStateProcessor.java | 2 +- .../fawe/v1_20_R4/PaperweightFaweAdapter.java | 2 +- .../PaperweightPlacementStateProcessor.java | 2 +- .../bukkit/BukkitServerInterface.java | 2 +- .../bukkit/adapter/BukkitImplAdapter.java | 2 +- .../PlacementStateProcessor.java | 18 +++- .../core/function/mask/Adjacent2DMask.java | 13 +++ .../core/function/mask/AdjacentAny2DMask.java | 36 +++++-- .../sk89q/worldedit/EditSessionBuilder.java | 4 + .../worldedit/command/RegionCommands.java | 98 +++++++++---------- .../extension/platform/Platform.java | 2 +- .../function/mask/BlockTypeMask.java | 5 + .../com/sk89q/worldedit/util/Direction.java | 6 ++ 20 files changed, 134 insertions(+), 72 deletions(-) rename worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/{ => processor}/PlacementStateProcessor.java (97%) diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java index 106f15296..73448613d 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java @@ -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.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IChunkGet; diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlacementStateProcessor.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlacementStateProcessor.java index 08c26fd65..8e86f601b 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlacementStateProcessor.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlacementStateProcessor.java @@ -1,6 +1,6 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_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; diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java index 87cbfc3da..c4ec35c14 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java @@ -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.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IChunkGet; diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlacementStateProcessor.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlacementStateProcessor.java index ccf91d26b..6d076f3e0 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlacementStateProcessor.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlacementStateProcessor.java @@ -1,6 +1,6 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; -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; diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java index 837c40015..bcd2079d4 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java @@ -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.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IChunkGet; diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlacementStateProcessor.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlacementStateProcessor.java index b0db5ca7e..fc83d6327 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlacementStateProcessor.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlacementStateProcessor.java @@ -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; diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java index 798112590..06797bdd5 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java @@ -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.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IChunkGet; diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlacementStateProcessor.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlacementStateProcessor.java index 862e62a5e..74c9c80f1 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlacementStateProcessor.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlacementStateProcessor.java @@ -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; diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java index 7c4001831..26a2dda50 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java @@ -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.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IChunkGet; diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlacementStateProcessor.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlacementStateProcessor.java index 72e0c80b7..0bee6e5f7 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlacementStateProcessor.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlacementStateProcessor.java @@ -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; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index f74063019..d0d3ee96c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -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; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index d34d349d6..589dc7c22 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -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; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PlacementStateProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/PlacementStateProcessor.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PlacementStateProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/PlacementStateProcessor.java index 277be9e3a..97cd4bb29 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PlacementStateProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/PlacementStateProcessor.java @@ -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 setTiles, char[] set, int index, int blockY, boolean firstPass) { + private void checkAndPerformUpdate( + Map 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++) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/Adjacent2DMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/Adjacent2DMask.java index 853362f7a..22d5d7ff7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/Adjacent2DMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/Adjacent2DMask.java @@ -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; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAny2DMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAny2DMask.java index d40b413c7..9bc8aa67e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAny2DMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAny2DMask.java @@ -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; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index 49d8eb538..a27a507f4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -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; @@ -748,6 +750,8 @@ public final class EditSessionBuilder { /** * Get the SideEffectSet that will be used + * + * @since TODO */ public SideEffectSet getSideEffectSet() { return sideEffectSet; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index ed6f62eac..e57c83084 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -117,7 +117,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) { @@ -231,11 +231,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")); @@ -263,11 +263,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")); @@ -295,9 +295,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); @@ -320,7 +320,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))); @@ -374,7 +374,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))); @@ -404,7 +404,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))); @@ -423,7 +423,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))); @@ -442,9 +442,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); @@ -516,11 +516,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)); @@ -543,22 +543,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"); @@ -606,9 +606,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)); @@ -626,20 +626,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"); @@ -690,13 +690,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; @@ -744,13 +744,13 @@ public class RegionCommands { Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "The expression to use", variable = true) - List expression, + List 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; @@ -821,11 +821,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) @@ -854,9 +854,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); @@ -875,7 +875,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; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java index 16d8c0e15..8e63c3a29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java @@ -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; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java index 5dd43fd50..7fb8bb30c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java @@ -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 > boolean test(B blockStateHolder) { return types[blockStateHolder.getBlockType().getInternalId()]; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java index 5a0e902da..f6416f5c1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java @@ -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 getDirections(BlockState state) { Set directions = new HashSet<>(); for (Property property : state.getBlockType().getProperties()) {