Add some debug messages to aid in future coding decisions.

This commit is contained in:
MattBDev 2020-01-13 16:54:29 -05:00
parent c6f51f54a4
commit c4f376a2e5
10 changed files with 20 additions and 87 deletions

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.mask; package com.boydti.fawe.object.mask;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
@ -137,6 +138,8 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
int x = vector.getBlockX(); int x = vector.getBlockX();
int y = vector.getBlockY(); int y = vector.getBlockY();
int z = vector.getBlockZ(); int z = vector.getBlockZ();

View File

@ -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();
}
}

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.function.mask; package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
@ -18,6 +19,7 @@ public abstract class ABlockMask extends AbstractExtentMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
return test(vector.getBlock(extent)); return test(vector.getBlock(extent));
} }

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
@ -173,6 +174,7 @@ public class BlockMask extends ABlockMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
return ordinals[vector.getOrdinal(extent)]; return ordinals[vector.getOrdinal(extent)];
} }

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.function.mask; package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.Fawe;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.blocks.Blocks;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
@ -52,6 +53,7 @@ public class BlockStateMask extends AbstractExtentMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
return test(vector.getBlock(extent)); return test(vector.getBlock(extent));
} }

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
@ -107,6 +108,7 @@ public class BlockTypeMask extends AbstractExtentMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
return test(vector.getBlock(extent).getBlockType()); return test(vector.getBlock(extent).getBlockType());
} }

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.function.mask; package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -40,6 +41,8 @@ public class ExistingBlockMask extends AbstractExtentMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
return !vector.getBlock(extent).getMaterial().isAir(); return !vector.getBlock(extent).getMaterial().isAir();
} }

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -63,6 +64,7 @@ public class RegionMask extends AbstractMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug(" extent: " + extent.getClass());
return region.contains(vector); return region.contains(vector);
} }

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.function.mask; package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -19,6 +20,8 @@ public class SingleBlockStateMask extends ABlockMask {
@Override @Override
public boolean test(Extent extent, BlockVector3 vector) { public boolean test(Extent extent, BlockVector3 vector) {
Fawe.imp().debug("getExtent(): " + getExtent().getClass() + " extent: " + extent.getClass());
return ordinal == vector.getOrdinal(extent); return ordinal == vector.getOrdinal(extent);
} }