mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:58:34 +00:00
Current Progress #3
This commit is contained in:
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class RegionMaskTestFunction implements RegionFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
if (mask.test(position)) {
|
||||
return pass.apply(position);
|
||||
} else {
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.biome;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.block;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
@ -56,13 +52,15 @@ public class BlockReplace implements RegionFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
return pattern.apply(extent, position, position);
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// public boolean apply(Vector position) throws WorldEditException {
|
||||
// return pattern.apply(extent, position, position);
|
||||
//=======
|
||||
// public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
// return extent.setBlock(position, pattern.apply(position));
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
return extent.setBlock(position, pattern.apply(position));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return pattern.apply(extent, position, position);
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,16 +22,12 @@ package com.sk89q.worldedit.function.block;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.jnbt.CompoundTagBuilder;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||
@ -40,16 +36,13 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Direction.Flag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
* Copies blocks from one extent to another.
|
||||
@ -85,16 +78,16 @@ public class ExtentBlockCopy implements RegionFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
Vector orig = position.subtract(from);
|
||||
Vector transformed = transform.apply(orig);
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
BaseBlock block = source.getFullBlock(position);
|
||||
BlockVector3 orig = position.subtract(from);
|
||||
BlockVector3 transformed = transform.apply(orig.toVector3()).toBlockPoint();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
// BaseBlock block = source.getFullBlock(position);
|
||||
// BlockVector3 orig = position.subtract(from);
|
||||
// BlockVector3 transformed = transform.apply(orig.toVector3()).toBlockPoint();
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
// Apply transformations to NBT data if necessary
|
||||
BlockStateHolder block = transformNbtData(source.getBlock(position));
|
||||
@ -119,18 +112,18 @@ public class ExtentBlockCopy implements RegionFunction {
|
||||
Direction direction = MCDirections.fromRotation(rot);
|
||||
|
||||
if (direction != null) {
|
||||
<<<<<<< HEAD
|
||||
Vector applyAbsolute = transform.apply(direction.toVector());
|
||||
Vector applyOrigin = transform.apply(Vector.ZERO);
|
||||
applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// Vector applyAbsolute = transform.apply(direction.toVector());
|
||||
// Vector applyOrigin = transform.apply(Vector.ZERO);
|
||||
// applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
// applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
// applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
//=======
|
||||
Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);
|
||||
// Direction newDirection = Direction.findClosest(applyAbsolute, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
||||
|
@ -29,13 +29,10 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.function.LayerFunction;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Makes a layer of grass on top, three layers of dirt below, and smooth stone
|
||||
|
@ -22,15 +22,11 @@ package com.sk89q.worldedit.function.entity;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.jnbt.FloatTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.jnbt.CompoundTagBuilder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -105,19 +101,19 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
Location newLocation;
|
||||
Location location = entity.getLocation();
|
||||
|
||||
<<<<<<< HEAD
|
||||
Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
Vector newDirection;
|
||||
if (transform.isIdentity()) {
|
||||
newDirection = entity.getLocation().getDirection();
|
||||
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
} else {
|
||||
newDirection = new Vector(transform.apply(location.getDirection())).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
state = transformNbtData(state);
|
||||
}
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
// Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
// Vector newDirection;
|
||||
// if (transform.isIdentity()) {
|
||||
// newDirection = entity.getLocation().getDirection();
|
||||
// newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
// } else {
|
||||
// newDirection = new Vector(transform.apply(location.getDirection())).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
// newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
// state = transformNbtData(state);
|
||||
// }
|
||||
//=======
|
||||
Vector3 pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
Vector3 newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
Vector3 newDirection;
|
||||
@ -129,7 +125,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
|
||||
// Some entities store their position data in NBT
|
||||
state = transformNbtData(state);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
boolean success = destination.createEntity(newLocation, state) != null;
|
||||
|
||||
@ -167,14 +163,14 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
boolean hasFacing = tag.containsKey("Facing");
|
||||
|
||||
if (hasTilePosition) {
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
changed = true;
|
||||
Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
|
||||
=======
|
||||
// Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
// Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
|
||||
//=======
|
||||
Vector3 tilePosition = new Vector3(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
values.put("TileX", new IntTag(newTilePosition.getBlockX()));
|
||||
values.put("TileY", new IntTag(newTilePosition.getBlockY()));
|
||||
@ -213,10 +209,10 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
double pitch = Math.toRadians(rotation.getFloat(1));
|
||||
|
||||
double xz = Math.cos(pitch);
|
||||
Vector direction = new Vector(-xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw));
|
||||
Vector3 direction = new Vector3(-xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw));
|
||||
direction = transform.apply(direction);
|
||||
FloatTag yawTag = new FloatTag(direction.toYaw());
|
||||
FloatTag pitchTag = new FloatTag(direction.toPitch());
|
||||
FloatTag yawTag = new FloatTag((float)direction.toYaw());
|
||||
FloatTag pitchTag = new FloatTag((float)direction.toPitch());
|
||||
values.put("Rotation", new ListTag(FloatTag.class, Arrays.asList(yawTag, pitchTag)));
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,9 @@ import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Generates flora (which may include tall grass, flowers, etc.).
|
||||
|
@ -21,12 +21,9 @@ package com.sk89q.worldedit.function.generator;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
@ -25,11 +25,8 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
|
@ -1,22 +1,18 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.collection.FastBitSet;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -82,7 +78,6 @@ public class BlockMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public Mask optimize() {
|
||||
Map<Object, Integer> states = new HashMap<>();
|
||||
int indexFound = -1;
|
||||
@ -102,13 +97,6 @@ public class BlockMask extends AbstractExtentMask {
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
BlockStateHolder block = getExtent().getBlock(vector);
|
||||
for (BlockStateHolder testBlock : blocks) {
|
||||
if (testBlock.equalsFuzzy(block)) {
|
||||
return true;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
// Only types, no states
|
||||
if (indexFound == -1) {
|
||||
@ -138,6 +126,12 @@ public class BlockMask extends AbstractExtentMask {
|
||||
return mask;
|
||||
}
|
||||
}
|
||||
// public boolean test(BlockVector3 vector) {
|
||||
// BlockStateHolder block = getExtent().getBlock(vector);
|
||||
// for (BlockStateHolder testBlock : blocks) {
|
||||
// if (testBlock.equalsFuzzy(block)) {
|
||||
// return true;
|
||||
|
||||
|
||||
private Mask getOptimizedMask(BlockType type, long[] bitSet) {
|
||||
boolean single = true;
|
||||
@ -233,7 +227,7 @@ public class BlockMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
BlockStateHolder block = getExtent().getBlock(vector);
|
||||
long[] bitSet = bitSets[block.getInternalBlockTypeId()];
|
||||
if (bitSet == null) return false;
|
||||
|
@ -1,11 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -15,6 +11,8 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BlockTypeMask extends AbstractExtentMask {
|
||||
@ -81,18 +79,16 @@ public class BlockTypeMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
return types[getExtent().getBlockType(vector).getInternalId()];
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return blocks.contains(getExtent().getBlock(vector).getBlockType());
|
||||
return types[getExtent().getBlockType(vector).getInternalId()];
|
||||
}
|
||||
// public boolean test(BlockVector3 vector) {
|
||||
// return blocks.contains(getExtent().getBlock(vector).getBlockType());
|
||||
// }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
return null;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -20,11 +20,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -44,13 +40,8 @@ public class ExistingBlockMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
return !getExtent().getBlock(vector).getMaterial().isAir();
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return !getExtent().getBlock(vector).getBlockType().getMaterial().isAir();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class InverseMask extends AbstractMask {
|
||||
private final Mask mask;
|
||||
|
||||
@ -12,7 +12,7 @@ public class InverseMask extends AbstractMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return !mask.test(vector);
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.google.common.base.Function;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
@ -172,17 +169,12 @@ public class MaskIntersection extends AbstractMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
for (Mask mask : masksArray) {
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (masks.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Mask mask : masks) {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
if (!mask.test(vector)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.google.common.base.Function;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -58,17 +54,12 @@ public class MaskUnion extends MaskIntersection {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public Function<Map.Entry<Mask, Mask>, Mask> pairingFunction() {
|
||||
return input -> input.getKey().or(input.getValue());
|
||||
}
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
Collection<Mask> masks = getMasks();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
for (Mask mask : getMasksArray()) {
|
||||
if (mask.test(vector)) {
|
||||
return true;
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -57,36 +52,36 @@ public final class Masks {
|
||||
* @param finalMask the mask
|
||||
* @return a new mask
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public static Mask negate(final Mask finalMask) {
|
||||
return finalMask.inverse();
|
||||
=======
|
||||
public static Mask negate(final Mask mask) {
|
||||
if (mask instanceof AlwaysTrue) {
|
||||
return ALWAYS_FALSE;
|
||||
} else if (mask instanceof AlwaysFalse) {
|
||||
return ALWAYS_TRUE;
|
||||
}
|
||||
|
||||
checkNotNull(mask);
|
||||
return new AbstractMask() {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return !mask.test(vector);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
Mask2D mask2d = mask.toMask2D();
|
||||
if (mask2d != null) {
|
||||
return negate(mask2d);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public static Mask negate(final Mask mask) {
|
||||
// if (mask instanceof AlwaysTrue) {
|
||||
// return ALWAYS_FALSE;
|
||||
// } else if (mask instanceof AlwaysFalse) {
|
||||
// return ALWAYS_TRUE;
|
||||
// }
|
||||
//
|
||||
// checkNotNull(mask);
|
||||
// return new AbstractMask() {
|
||||
// @Override
|
||||
// public boolean test(BlockVector3 vector) {
|
||||
// return !mask.test(vector);
|
||||
// }
|
||||
//
|
||||
// @Nullable
|
||||
// @Override
|
||||
// public Mask2D toMask2D() {
|
||||
// Mask2D mask2d = mask.toMask2D();
|
||||
// if (mask2d != null) {
|
||||
// return negate(mask2d);
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.noise.NoiseGenerator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.noise.NoiseGenerator;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@ -21,12 +16,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class OffsetMask extends AbstractMask {
|
||||
|
||||
private Mask mask;
|
||||
<<<<<<< HEAD
|
||||
private Vector offset;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
=======
|
||||
private BlockVector3 offset;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -80,16 +70,8 @@ public class OffsetMask extends AbstractMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
mutable.mutX((vector.getX() + offset.getX()));
|
||||
mutable.mutY((vector.getY() + offset.getY()));
|
||||
mutable.mutZ((vector.getZ() + offset.getZ()));
|
||||
return getMask().test(mutable);
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return getMask().test(vector.add(offset));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class SingleBlockStateBitMask extends AbstractExtentMask {
|
||||
private final int bitMask;
|
||||
@ -12,7 +12,7 @@ public class SingleBlockStateBitMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
int internalId = getExtent().getBlock(vector).getInternalId();
|
||||
return (internalId & bitMask) == internalId;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -18,7 +18,7 @@ public class SingleBlockStateMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return state.equals(getExtent().getBlock(vector));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -15,7 +15,7 @@ public class SingleBlockTypeMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return getExtent().getBlockType(vector).getInternalId() == internalId;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
=======
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -23,16 +20,14 @@ public class SolidBlockMask extends BlockTypeMask {
|
||||
return types;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public SolidBlockMask(Extent extent) {
|
||||
super(extent, getTypes());
|
||||
=======
|
||||
}
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
Extent extent = getExtent();
|
||||
BlockState block = extent.getBlock(vector);
|
||||
return block.getBlockType().getMaterial().isMovementBlocker();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.sk89q.worldedit.function.operation;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -16,11 +16,11 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
private final Extent destination;
|
||||
private final Extent source;
|
||||
private final RegionFunction function;
|
||||
private final Vector origin;
|
||||
private final BlockVector3 origin;
|
||||
|
||||
private Vector mutable = new MutableBlockVector();
|
||||
// private Vector mutable = new MutableBlockVector();
|
||||
|
||||
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, Vector origin, Transform transform, RegionFunction function) {
|
||||
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, BlockVector3 origin, Transform transform, RegionFunction function) {
|
||||
this.source = source;
|
||||
this.region = region;
|
||||
this.destination = destination;
|
||||
@ -33,8 +33,8 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
CuboidRegion destRegion = transform(this.transform, this.region);
|
||||
Transform inverse = this.transform.inverse();
|
||||
for (Vector pt : destRegion) {
|
||||
Vector copyFrom = transform(inverse, pt);
|
||||
for (BlockVector3 pt : destRegion) {
|
||||
BlockVector3 copyFrom = transform(inverse, pt);
|
||||
if (region.contains(copyFrom)) {
|
||||
function.apply(pt);
|
||||
}
|
||||
@ -43,31 +43,32 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
}
|
||||
|
||||
private CuboidRegion transform(Transform transform, Region region) {
|
||||
Vector min = new MutableBlockVector(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
Vector max = new MutableBlockVector(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
Vector pos1 = region.getMinimumPoint();
|
||||
Vector pos2 = region.getMaximumPoint();
|
||||
BlockVector3 min = new BlockVector3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
BlockVector3 max = new BlockVector3(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
BlockVector3 pos1 = region.getMinimumPoint();
|
||||
BlockVector3 pos2 = region.getMaximumPoint();
|
||||
for (int x : new int[] { pos1.getBlockX(), pos2.getBlockX() }) {
|
||||
for (int y : new int[] { pos1.getBlockY(), pos2.getBlockY() }) {
|
||||
for (int z : new int[] { pos1.getBlockZ(), pos2.getBlockZ() }) {
|
||||
Vector pt = transform(transform, new Vector(x, y, z)).toBlockVector();
|
||||
min = Vector.getMinimum(min, pt);
|
||||
max = Vector.getMaximum(max, pt);
|
||||
BlockVector3 pt = transform(transform, new BlockVector3(x, y, z));
|
||||
min = min.getMinimum(pt);
|
||||
max = max.getMaximum(pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new CuboidRegion(min, max);
|
||||
}
|
||||
|
||||
private Vector transform(Transform transform, Vector pt) {
|
||||
mutable.mutX(((pt.getBlockX() - origin.getBlockX())));
|
||||
mutable.mutY(((pt.getBlockY() - origin.getBlockY())));
|
||||
mutable.mutZ(((pt.getBlockZ() - origin.getBlockZ())));
|
||||
Vector tmp = transform.apply(mutable);
|
||||
tmp.mutX((tmp.getBlockX() + origin.getBlockX()));
|
||||
tmp.mutY((tmp.getBlockY() + origin.getBlockY()));
|
||||
tmp.mutZ((tmp.getBlockZ() + origin.getBlockZ()));
|
||||
return tmp;
|
||||
private BlockVector3 transform(Transform transform, BlockVector3 pt) {
|
||||
// mutable.mutX(((pt.getBlockX() - origin.getBlockX())));
|
||||
// mutable.mutY(((pt.getBlockY() - origin.getBlockY())));
|
||||
// mutable.mutZ(((pt.getBlockZ() - origin.getBlockZ())));
|
||||
// BlockVector3 tmp = transform.apply(new Vector3(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint();
|
||||
// tmp.mutX((tmp.getBlockX() + origin.getBlockX()));
|
||||
// tmp.mutY((tmp.getBlockY() + origin.getBlockY()));
|
||||
// tmp.mutZ((tmp.getBlockZ() + origin.getBlockZ()));
|
||||
// return tmp;
|
||||
return transform.apply(new Vector3(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint().add(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.function.operation;
|
||||
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -40,7 +40,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class BlockMapEntryPlacer implements Operation {
|
||||
|
||||
private final Extent extent;
|
||||
private final Iterator<Map.Entry<BlockVector, BlockStateHolder>> iterator;
|
||||
private final Iterator<Map.Entry<BlockVector3, BlockStateHolder>> iterator;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -48,7 +48,7 @@ public class BlockMapEntryPlacer implements Operation {
|
||||
* @param extent the extent to set the blocks on
|
||||
* @param iterator the iterator
|
||||
*/
|
||||
public BlockMapEntryPlacer(Extent extent, Iterator<Map.Entry<BlockVector, BlockStateHolder>> iterator) {
|
||||
public BlockMapEntryPlacer(Extent extent, Iterator<Map.Entry<BlockVector3, BlockStateHolder>> iterator) {
|
||||
checkNotNull(extent);
|
||||
checkNotNull(iterator);
|
||||
this.extent = extent;
|
||||
@ -58,7 +58,7 @@ public class BlockMapEntryPlacer implements Operation {
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<BlockVector, BlockStateHolder> entry = iterator.next();
|
||||
Map.Entry<BlockVector3, BlockStateHolder> entry = iterator.next();
|
||||
extent.setBlock(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.function.operation;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.example.MappedFaweQueue;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.extent.BlockTranslateExtent;
|
||||
@ -29,14 +28,10 @@ import com.boydti.fawe.object.function.block.CombinedBlockCopy;
|
||||
import com.boydti.fawe.object.function.block.SimpleBlockCopy;
|
||||
import com.boydti.fawe.util.MaskTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -51,12 +46,9 @@ import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
import com.sk89q.worldedit.function.visitor.IntersectRegionFunction;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.transform.Identity;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -279,9 +271,9 @@ public class ForwardExtentCopy implements Operation {
|
||||
}
|
||||
|
||||
Extent finalDest = destination;
|
||||
Vector translation = to.subtract(from);
|
||||
BlockVector3 translation = to.subtract(from);
|
||||
|
||||
if (!translation.equals(Vector.ZERO)) {
|
||||
if (!translation.equals(BlockVector3.ZERO)) {
|
||||
finalDest = new BlockTranslateExtent(finalDest, translation.getBlockX(), translation.getBlockY(), translation.getBlockZ());
|
||||
}
|
||||
|
||||
@ -318,30 +310,28 @@ public class ForwardExtentCopy implements Operation {
|
||||
RegionFunction maskFunc = null;
|
||||
|
||||
if (sourceFunction != null) {
|
||||
Vector disAbs = translation.positive();
|
||||
Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 disAbs = translation.abs();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
boolean overlap = (disAbs.getBlockX() < size.getBlockX() && disAbs.getBlockY() < size.getBlockY() && disAbs.getBlockZ() < size.getBlockZ());
|
||||
|
||||
RegionFunction copySrcFunc = sourceFunction;
|
||||
if (overlap && translation.length() != 0) {
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
int x = translation.getBlockX();
|
||||
int y = translation.getBlockY();
|
||||
int z = translation.getBlockZ();
|
||||
|
||||
<<<<<<< HEAD
|
||||
maskFunc = position -> {
|
||||
mutable.setComponents(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
|
||||
if (region.contains(mutable)) {
|
||||
return sourceFunction.apply(mutable);
|
||||
BlockVector3 bv = new BlockVector3(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
|
||||
if (region.contains(bv)) {
|
||||
return sourceFunction.apply(bv);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
copySrcFunc = position -> {
|
||||
mutable.setComponents(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
|
||||
if (!region.contains(mutable)) {
|
||||
BlockVector3 bv = new BlockVector3(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
|
||||
if (!region.contains(bv)) {
|
||||
return sourceFunction.apply(position);
|
||||
}
|
||||
return false;
|
||||
@ -371,11 +361,9 @@ public class ForwardExtentCopy implements Operation {
|
||||
Operations.completeBlindly(blockCopy);
|
||||
|
||||
if (!entities.isEmpty()) {
|
||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
|
||||
=======
|
||||
if (copyingEntities) {
|
||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// if (copyingEntities) {
|
||||
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
||||
entityCopy.setRemoving(removingEntities);
|
||||
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
||||
Operations.completeBlindly(entityVisitor);
|
||||
|
@ -1,22 +1,10 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* @deprecated Just use BaseBlock directly
|
||||
*/
|
||||
@ -29,11 +17,6 @@ public class BlockPattern implements Pattern {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block.
|
||||
*
|
||||
@ -52,13 +35,10 @@ public class BlockPattern implements Pattern {
|
||||
checkNotNull(block);
|
||||
this.block = block;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -22,13 +17,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class ClipboardPattern extends AbstractPattern {
|
||||
|
||||
private final Clipboard clipboard;
|
||||
<<<<<<< HEAD
|
||||
private final int sx, sy, sz;
|
||||
private final Vector min;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
=======
|
||||
private final BlockVector3 size;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
private final BlockVector3 min;
|
||||
// private final BlockVector3 size;
|
||||
|
||||
/**
|
||||
* Create a new clipboard pattern.
|
||||
@ -38,7 +29,7 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
public ClipboardPattern(Clipboard clipboard) {
|
||||
checkNotNull(clipboard);
|
||||
this.clipboard = clipboard;
|
||||
Vector size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1);
|
||||
this.sx = size.getBlockX();
|
||||
this.sy = size.getBlockY();
|
||||
this.sz = size.getBlockZ();
|
||||
@ -46,26 +37,23 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
//<<<<<<< HEAD
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
int xp = position.getBlockX() % sx;
|
||||
int yp = position.getBlockY() % sy;
|
||||
int zp = position.getBlockZ() % sz;
|
||||
if (xp < 0) xp += sx;
|
||||
if (yp < 0) yp += sy;
|
||||
if (zp < 0) zp += sz;
|
||||
mutable.mutX((min.getX() + xp));
|
||||
mutable.mutY((min.getY() + yp));
|
||||
mutable.mutZ((min.getZ() + zp));
|
||||
return clipboard.getBlock(mutable);
|
||||
=======
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
|
||||
return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return clipboard.getBlock(new BlockVector3(min.getX() + xp, min.getY() + yp, min.getZ() + zp));
|
||||
//=======
|
||||
// public BlockStateHolder apply(BlockVector3 position) {
|
||||
// int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
// int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
// int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
//
|
||||
// return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp));
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Link;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -17,7 +17,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
public interface FawePattern extends Pattern {
|
||||
|
||||
@Deprecated
|
||||
default BlockStateHolder apply(Vector position) {
|
||||
default BlockStateHolder apply(BlockVector3 position) {
|
||||
throw new UnsupportedOperationException("Please use apply(extent, get, set)");
|
||||
}
|
||||
|
||||
@ -27,6 +27,6 @@ public interface FawePattern extends Pattern {
|
||||
* @return a block
|
||||
*/
|
||||
@Override
|
||||
boolean apply(Extent extent, Vector get, Vector set) throws WorldEditException;
|
||||
boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException;
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.collection.RandomCollection;
|
||||
import com.boydti.fawe.object.random.SimpleRandom;
|
||||
import com.boydti.fawe.object.random.TrueRandom;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -60,24 +56,24 @@ public class RandomPattern extends AbstractPattern {
|
||||
this.patterns.add(pattern);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public Set<Pattern> getPatterns() {
|
||||
return patterns;
|
||||
=======
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
double r = random.nextDouble();
|
||||
double offset = 0;
|
||||
|
||||
for (Chance chance : patterns) {
|
||||
if (r <= (offset + chance.getChance()) / max) {
|
||||
return chance.getPattern().apply(position);
|
||||
}
|
||||
offset += chance.getChance();
|
||||
}
|
||||
|
||||
throw new RuntimeException("ProportionalFillPattern");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// @Override
|
||||
// public BlockStateHolder apply(BlockVector3 position) {
|
||||
// double r = random.nextDouble();
|
||||
// double offset = 0;
|
||||
//
|
||||
// for (Chance chance : patterns) {
|
||||
// if (r <= (offset + chance.getChance()) / max) {
|
||||
// return chance.getPattern().apply(position);
|
||||
// }
|
||||
// offset += chance.getChance();
|
||||
// }
|
||||
//
|
||||
// throw new RuntimeException("ProportionalFillPattern");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
public RandomCollection<Pattern> getCollection() {
|
||||
@ -85,12 +81,12 @@ public class RandomPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector get) {
|
||||
public BlockStateHolder apply(BlockVector3 get) {
|
||||
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(get);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException {
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(extent, set, get);
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -97,10 +93,10 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
int x = base.getBlockX() % size.getBlockX();
|
||||
int y = base.getBlockY() % size.getBlockY();
|
||||
int z = base.getBlockZ() % size.getBlockZ();
|
||||
<<<<<<< HEAD
|
||||
return extent.getBlock(new Vector(x, y, z));
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// return extent.getBlock(new Vector(x, y, z));
|
||||
//=======
|
||||
return extent.getFullBlock(new BlockVector3(x, y, z));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.util;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.util;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -44,18 +44,18 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
public static final BlockVector3[] DIAGONAL_DIRECTIONS;
|
||||
|
||||
static {
|
||||
DEFAULT_DIRECTIONS[0] = (new MutableBlockVector(0, -1, 0));
|
||||
DEFAULT_DIRECTIONS[1] = (new MutableBlockVector(0, 1, 0));
|
||||
DEFAULT_DIRECTIONS[2] = (new MutableBlockVector(-1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[3] = (new MutableBlockVector(1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[4] = (new MutableBlockVector(0, 0, -1));
|
||||
DEFAULT_DIRECTIONS[5] = (new MutableBlockVector(0, 0, 1));
|
||||
List<MutableBlockVector> list = new ArrayList<>();
|
||||
DEFAULT_DIRECTIONS[0] = (new BlockVector3(0, -1, 0));
|
||||
DEFAULT_DIRECTIONS[1] = (new BlockVector3(0, 1, 0));
|
||||
DEFAULT_DIRECTIONS[2] = (new BlockVector3(-1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[3] = (new BlockVector3(1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[4] = (new BlockVector3(0, 0, -1));
|
||||
DEFAULT_DIRECTIONS[5] = (new BlockVector3(0, 0, 1));
|
||||
List<BlockVector3> list = new ArrayList<>();
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (x != 0 || y != 0 || z != 0) {
|
||||
MutableBlockVector pos = new MutableBlockVector(x, y, z);
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (!list.contains(pos)) {
|
||||
list.add(pos);
|
||||
}
|
||||
@ -184,7 +184,7 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
MutableBlockVector mutable2 = new MutableBlockVector();
|
||||
// MutableBlockVector mutable2 = new MutableBlockVector();
|
||||
boolean shouldTrim = false;
|
||||
IntegerTrio[] dirs = getIntDirections();
|
||||
BlockVectorSet tempQueue = new BlockVectorSet();
|
||||
@ -223,10 +223,7 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
int x = from.getBlockX() + direction.x;
|
||||
int z = from.getBlockZ() + direction.z;
|
||||
if (!visited.contains(x, y, z)) {
|
||||
mutable2.mutX(x);
|
||||
mutable2.mutY(y);
|
||||
mutable2.mutZ(z);
|
||||
if (isVisitable(from, mutable2)) {
|
||||
if (isVisitable(from, new BlockVector3(x, y, z))) {
|
||||
j++;
|
||||
visited.add(x, y, z);
|
||||
tempQueue.add(x, y, z);
|
||||
|
@ -50,7 +50,7 @@ public class DirectionalVisitor extends RecursiveVisitor {
|
||||
super(mask, function, distance, hasFaweQueue);
|
||||
checkNotNull(mask);
|
||||
this.origin = origin;
|
||||
this.dirVec = new MutableBlockVector(direction);
|
||||
this.dirVec = direction;
|
||||
final Collection<BlockVector3> directions = this.getDirections();
|
||||
directions.clear();
|
||||
directions.add(new BlockVector3(1, 0, 0));
|
||||
|
@ -19,19 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@ -63,12 +59,8 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
super(mask, function, depth, hasFaweQueue);
|
||||
checkNotNull(mask);
|
||||
this.baseY = baseY;
|
||||
<<<<<<< HEAD
|
||||
final Collection<Vector> directions = this.getDirections();
|
||||
=======
|
||||
|
||||
Collection<BlockVector3> directions = getDirections();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
directions.clear();
|
||||
directions.add(new BlockVector3(1, 0, 0));
|
||||
directions.add(new BlockVector3(-1, 0, 0));
|
||||
@ -78,15 +70,9 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean isVisitable(final Vector from, final Vector to) {
|
||||
final int fromY = from.getBlockY();
|
||||
return ((fromY == this.baseY) || (to.getBlockY() - from.getBlockY() < 0)) && super.isVisitable(from, to);
|
||||
=======
|
||||
protected boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int fromY = from.getBlockY();
|
||||
return (fromY == baseY || to.subtract(from).getBlockY() < 0) && super.isVisitable(from, to);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,23 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.example.MappedFaweQueue;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.operation.RunContext;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import java.util.List;
|
||||
|
||||
@ -50,7 +47,7 @@ public class FlatRegionVisitor implements Operation {
|
||||
private final FlatRegionFunction function;
|
||||
private MappedFaweQueue queue;
|
||||
private int affected = 0;
|
||||
private final Iterable<Vector2D> iterator;
|
||||
private final Iterable<BlockVector2> iterator;
|
||||
|
||||
/**
|
||||
* Create a new visitor.
|
||||
@ -84,21 +81,21 @@ public class FlatRegionVisitor implements Operation {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public Operation resume(final RunContext run) throws WorldEditException {
|
||||
if (this.queue != null) {
|
||||
for (final Vector2D pt : new Fast2DIterator(this.iterator, queue)) {
|
||||
for (final BlockVector2 pt : new Fast2DIterator(this.iterator, queue)) {
|
||||
if (this.function.apply(pt)) affected++;
|
||||
}
|
||||
} else {
|
||||
for (final Vector2D pt : this.iterator) {
|
||||
for (final BlockVector2 pt : this.iterator) {
|
||||
if (this.function.apply(pt)) affected++;
|
||||
=======
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
for (BlockVector2 pt : flatRegion.asFlatRegion()) {
|
||||
if (function.apply(pt)) {
|
||||
affected++;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public Operation resume(RunContext run) throws WorldEditException {
|
||||
// for (BlockVector2 pt : flatRegion.asFlatRegion()) {
|
||||
// if (function.apply(pt)) {
|
||||
// affected++;
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class IntersectRegionFunction implements RegionFunction {
|
||||
private final RegionFunction[] functions;
|
||||
@ -13,7 +13,7 @@ public class IntersectRegionFunction implements RegionFunction {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
boolean ret = false;
|
||||
for (RegionFunction function : functions) {
|
||||
if (!function.apply(position)) {
|
||||
|
@ -19,14 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.LayerFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||
@ -58,7 +53,7 @@ public class LayerVisitor implements Operation {
|
||||
private Mask2D mask = Masks.alwaysTrue2D();
|
||||
private final int minY;
|
||||
private final int maxY;
|
||||
private final Iterable<Vector2D> iterator;
|
||||
private final Iterable<BlockVector2> iterator;
|
||||
|
||||
/**
|
||||
* Create a new visitor.
|
||||
@ -100,36 +95,21 @@ public class LayerVisitor implements Operation {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public Operation resume(final RunContext run) throws WorldEditException {
|
||||
for (final Vector2D column : this.iterator) {
|
||||
for (final BlockVector2 column : this.iterator) {
|
||||
if (!this.mask.test(column)) {
|
||||
=======
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
for (BlockVector2 column : flatRegion.asFlatRegion()) {
|
||||
if (!mask.test(column)) {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
continue;
|
||||
}
|
||||
|
||||
// Abort if we are underground
|
||||
<<<<<<< HEAD
|
||||
if (this.function.isGround(column.toVector(this.maxY + 1))) {
|
||||
=======
|
||||
if (function.isGround(column.toBlockVector3(maxY + 1))) {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
int groundY = 0;
|
||||
<<<<<<< HEAD
|
||||
for (int y = this.maxY; y >= this.minY; --y) {
|
||||
final Vector test = column.toVector(y);
|
||||
=======
|
||||
for (int y = maxY; y >= minY; --y) {
|
||||
BlockVector3 test = column.toBlockVector3(y);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
if (!found) {
|
||||
if (this.function.isGround(test)) {
|
||||
found = true;
|
||||
|
@ -19,17 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
=======
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
@ -45,17 +41,12 @@ public class NonRisingVisitor extends RecursiveVisitor {
|
||||
*/
|
||||
|
||||
public NonRisingVisitor(Mask mask, RegionFunction function) {
|
||||
<<<<<<< HEAD
|
||||
this(mask, function, Integer.MAX_VALUE, null);
|
||||
}
|
||||
|
||||
public NonRisingVisitor(Mask mask, RegionFunction function, int depth, HasFaweQueue hasFaweQueue) {
|
||||
super(mask, function, depth, hasFaweQueue);
|
||||
final Collection<Vector> directions = this.getDirections();
|
||||
=======
|
||||
super(mask, function);
|
||||
Collection<BlockVector3> directions = getDirections();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
directions.clear();
|
||||
directions.add(new BlockVector3(1, 0, 0));
|
||||
directions.add(new BlockVector3(-1, 0, 0));
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -62,13 +58,8 @@ public class RecursiveVisitor extends BreadthFirstSearch {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean isVisitable(final Vector from, final Vector to) {
|
||||
return this.mask.test(to);
|
||||
=======
|
||||
protected boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
return mask.test(to);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user