From c4f376a2e52dc3ffe983a8df423fa7ff9f1ea77f Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 13 Jan 2020 16:54:29 -0500 Subject: [PATCH] Add some debug messages to aid in future coding decisions. --- .../boydti/fawe/object/mask/AngleMask.java | 3 + .../fawe/object/mask/SolidPlaneMask.java | 87 ------------------- .../worldedit/function/mask/ABlockMask.java | 2 + .../worldedit/function/mask/BiomeMask2D.java | 1 + .../worldedit/function/mask/BlockMask.java | 2 + .../function/mask/BlockStateMask.java | 2 + .../function/mask/BlockTypeMask.java | 2 + .../function/mask/ExistingBlockMask.java | 3 + .../worldedit/function/mask/RegionMask.java | 2 + .../function/mask/SingleBlockStateMask.java | 3 + 10 files changed, 20 insertions(+), 87 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java index 5607c2eda..4aac2a2de 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/AngleMask.java @@ -1,5 +1,6 @@ package com.boydti.fawe.object.mask; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.math.BlockVector3; @@ -137,6 +138,8 @@ public class AngleMask extends SolidBlockMask implements ResettableMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); + int x = vector.getBlockX(); int y = vector.getBlockY(); int z = vector.getBlockZ(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java b/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java deleted file mode 100644 index 8de7c3d5a..000000000 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SolidPlaneMask.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.boydti.fawe.object.mask; - -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.function.mask.SolidBlockMask; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; - -/** - * Restricts the - */ -public class SolidPlaneMask extends SolidBlockMask implements ResettableMask { - - private transient int mode = -1; - private transient MutableBlockVector3 mutable = new MutableBlockVector3(); - - private int originX = Integer.MAX_VALUE, originY = Integer.MAX_VALUE, originZ = Integer.MAX_VALUE; - - public SolidPlaneMask(Extent extent) { - super(extent); - } - - @Override - public boolean test(Extent extent, BlockVector3 vector) { - switch (mode) { - case -1: - if (!super.test(vector)) { - return false; - } - originX = vector.getBlockX(); - originY = vector.getBlockY(); - originZ = vector.getBlockZ(); - mode = 0; - if (!extent.getBlock(mutable.setComponents(originX - 1, originY, originZ)).getMaterial().isAir() && !extent.getBlock(mutable.setComponents(originX + 1, originY, originZ)).getMaterial().isAir()) { - mode &= 1; - } - if (!extent.getBlock(mutable.setComponents(originX, originY, originZ - 1)).getMaterial().isAir() && !extent.getBlock(mutable.setComponents(originX, originY, originZ + 1)).getMaterial().isAir()) { - mode &= 4; - } - if (!extent.getBlock(mutable.setComponents(originX, originY - 1, originZ + 1)).getMaterial().isAir() && !extent.getBlock(mutable.setComponents(originX, originY + 1, originZ + 1)).getMaterial().isAir()) { - mode &= 2; - } - if (Integer.bitCount(mode) >= 3) { - return false; - } - case 0: - case 1: - case 2: - case 4: - if (!super.test(vector)) { - return false; - } - int original = mode; - if (originX != vector.getBlockX()) { - mode &= 1; - } - if (originY != vector.getBlockY()) { - mode &= 2; - } - if (originZ != vector.getBlockZ()) { - mode &= 4; - } - if (Integer.bitCount(mode) >= 3) { - mode = original; - return false; - } - default: - if (originX != vector.getBlockX() && (mode & 1) == 0) { - return false; - } - if (originZ != vector.getBlockZ() && (mode & 4) == 0) { - return false; - } - if (originY != vector.getBlockY() && (mode & 2) == 0) { - return false; - } - return super.test(vector); - - } - } - - @Override - public void reset() { - mode = -1; - mutable = new MutableBlockVector3(); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java index 5c22f44f2..7ed4fb81c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java @@ -1,5 +1,6 @@ package com.sk89q.worldedit.function.mask; +import com.boydti.fawe.Fawe; import com.boydti.fawe.util.StringMan; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; @@ -18,6 +19,7 @@ public abstract class ABlockMask extends AbstractExtentMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); return test(vector.getBlock(extent)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java index 30124bb93..074efcd65 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.biome.BiomeType; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index cd78a773a..a1a10a111 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.math.BlockVector3; @@ -173,6 +174,7 @@ public class BlockMask extends ABlockMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); return ordinals[vector.getOrdinal(extent)]; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java index b8bc72e8f..41d8fe832 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.function.mask; +import com.boydti.fawe.Fawe; import com.google.common.collect.Maps; import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.Extent; @@ -52,6 +53,7 @@ public class BlockStateMask extends AbstractExtentMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); return test(vector.getBlock(extent)); } 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 c33db1738..4058bdf35 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 @@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockType; @@ -107,6 +108,7 @@ public class BlockTypeMask extends AbstractExtentMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); return test(vector.getBlock(extent).getBlockType()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java index 730cb93aa..98b45253a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.function.mask; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; @@ -40,6 +41,8 @@ public class ExistingBlockMask extends AbstractExtentMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); + return !vector.getBlock(extent).getMaterial().isAir(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java index ce589776f..b67744dba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; @@ -63,6 +64,7 @@ public class RegionMask extends AbstractMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug(" extent: " + extent.getClass()); return region.contains(vector); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java index f9c90d718..bb97aa592 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java @@ -1,5 +1,6 @@ package com.sk89q.worldedit.function.mask; +import com.boydti.fawe.Fawe; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; @@ -19,6 +20,8 @@ public class SingleBlockStateMask extends ABlockMask { @Override public boolean test(Extent extent, BlockVector3 vector) { + Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass()); + return ordinal == vector.getOrdinal(extent); }