minor tweak for mutable vectors

This commit is contained in:
Jesse Boyd 2019-04-01 03:09:20 +11:00
parent 2165bb127f
commit 92a7bd5e44
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
120 changed files with 923 additions and 2426 deletions

View File

@ -113,7 +113,7 @@ public interface IBukkitAdapter {
*/
default org.bukkit.Location adapt(Location location) {
checkNotNull(location);
Vector3 position = location.toVector();
Vector3 position = location;
return new org.bukkit.Location(
adapt((World) location.getExtent()),
position.getX(), position.getY(), position.getZ(),

View File

@ -16,6 +16,7 @@ import com.boydti.fawe.util.image.Drawable;
import com.boydti.fawe.util.image.ImageViewer;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
@ -24,8 +25,6 @@ import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.Vector2;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform;
@ -51,7 +50,7 @@ import javax.annotation.Nullable;
// TODO FIXME
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
private final MutableBlockVector mutable = new MutableBlockVector();
private final MutableBlockVector3 mutable = new MutableBlockVector3();
private final ThreadLocal<int[]> indexStore = new ThreadLocal<int[]>() {
@Override
@ -528,7 +527,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights[index] & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
int newHeight = table.average(x, z, index);
setLayerHeightRaw(index, newHeight);
}
@ -583,7 +582,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
}
mutable.mutX(x);
mutable.mutY(y);
if (!mask.test(mutable.toBlockVector3())) {
if (!mask.test(mutable)) {
continue;
}
if (placed.containsRadius(x, z, distance)) {
@ -603,9 +602,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform();
if (transform.isIdentity()) {
schematic.paste(this, mutable.toBlockVector3(), false);
schematic.paste(this, mutable, false);
} else {
schematic.paste(this, mutable.toBlockVector3(), false, transform);
schematic.paste(this, mutable, false, transform);
}
if (x + distance < getWidth()) {
x += distance;
@ -631,7 +630,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
}
mutable.mutX(x);
mutable.mutY(y);
if (!mask.test(mutable.toBlockVector3())) {
if (!mask.test(mutable)) {
continue;
}
if (placed.containsRadius(x, z, distance)) {
@ -652,9 +651,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform();
if (transform.isIdentity()) {
schematic.paste(this, mutable.toBlockVector3(), false);
schematic.paste(this, mutable, false);
} else {
schematic.paste(this, mutable.toBlockVector3(), false, transform);
schematic.paste(this, mutable, false, transform);
}
if (x + distance < getWidth()) {
x += distance;
@ -1135,7 +1134,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
if (mask != null) {
mutable.mutX(z);
mutable.mutY(heights.getByte(index) & 0xFF);
if (!mask.test(mutable.toBlockVector3())) continue;
if (!mask.test(mutable)) continue;
}
if (imgMask != null) {
int height = imgMask.getRGB(x, z) & 0xFF;
@ -1256,7 +1255,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
for (int x = 0; x < getWidth(); x++, index++) {
mutable.mutX(x);
mutable.mutY(heights.getByte(index) & 0xFF);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
int color = img.getRGB(x, z);
BlockType block = textureUtil.getNearestBlock(color);
if (block != null) {
@ -1332,7 +1331,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
biomes.setByte(index, biome);
}
}
@ -1362,7 +1361,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
.nextInt(256) <= height) {
mutable.mutX(x);
mutable.mutY(height);
overlayArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
overlayArr[index] = pattern.apply(mutable).getInternalId();
}
}
}
@ -1390,7 +1389,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
.nextInt(256) <= height) {
mutable.mutX(x);
mutable.mutY(height);
mainArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
mainArr[index] = pattern.apply(mutable).getInternalId();
}
}
}
@ -1416,7 +1415,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
.nextInt(256) <= height) {
mutable.mutX(x);
mutable.mutY(height);
floorArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
floorArr[index] = pattern.apply(mutable).getInternalId();
}
}
}
@ -1444,7 +1443,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
.nextInt(256) <= height) {
mutable.mutX(x);
mutable.mutY(height);
int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
int combined = pattern.apply(mutable).getInternalId();
mainArr[index] = combined;
floorArr[index] = combined;
}
@ -1466,8 +1465,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
overlay.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
if (mask.test(mutable)) {
overlay.setInt(index, pattern.apply(mutable).getInternalId());
}
}
}
@ -1485,8 +1484,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
floor.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
if (mask.test(mutable)) {
floor.setInt(index, pattern.apply(mutable).getInternalId());
}
}
}
@ -1505,8 +1504,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
main.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
if (mask.test(mutable)) {
main.setInt(index, pattern.apply(mutable).getInternalId());
}
}
}
@ -1525,8 +1524,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
if (mask.test(mutable)) {
int combined = pattern.apply(mutable).getInternalId();
floor.setInt(index, combined);
main.setInt(index, combined);
}
@ -1552,7 +1551,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
floorArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
floorArr[index] = value.apply(mutable).getInternalId();
}
}
});
@ -1573,7 +1572,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
int combined = value.apply(mutable.toBlockVector3()).getInternalId();
int combined = value.apply(mutable).getInternalId();
mainArr[index] = combined;
floorArr[index] = combined;
}
@ -1595,7 +1594,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
mainArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
mainArr[index] = value.apply(mutable).getInternalId();
}
}
});
@ -1616,7 +1615,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
overlayArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
overlayArr[index] = value.apply(mutable).getInternalId();
}
}
});
@ -2003,7 +2002,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
overlay.setInt(index, combined);
}
}
@ -2018,7 +2017,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
floor.setInt(index, combined);
}
}
@ -2034,7 +2033,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
main.setInt(index, combined);
}
}
@ -2050,7 +2049,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF;
mutable.mutX(x);
mutable.mutY(y);
if (mask.test(mutable.toBlockVector3())) {
if (mask.test(mutable)) {
floor.setInt(index, combined);
main.setInt(index, combined);
}

View File

@ -52,7 +52,7 @@ public class MappedReplacePatternFilter extends MCAFilterCounter {
// map[block.getCombined()] = pattern;
}
// private final MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
// private final MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
@Override
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) {

View File

@ -1,12 +1,11 @@
package com.boydti.fawe.jnbt.anvil.generator;
import com.boydti.fawe.object.PseudoRandom;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import java.util.Random;
@ -20,7 +19,7 @@ public class OreGen extends Resource {
private final Pattern pattern;
private final Extent extent;
private final Mask mask;
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
private double ONE_2 = 1 / 2F;
private double ONE_8 = 1 / 8F;
@ -43,7 +42,7 @@ public class OreGen extends Resource {
@Override
public boolean spawn(Random rand, int x, int z) throws WorldEditException {
int y = rand.nextInt(maxY - minY) + minY;
if (!mask.test(mutable.setComponents(x, y, z).toBlockVector3())) {
if (!mask.test(mutable.setComponents(x, y, z))) {
return false;
}
double f = rand.nextDouble() * Math.PI;
@ -106,8 +105,8 @@ public class OreGen extends Resource {
double dz = (zz + 0.5D - d9) * id11o2;
double dxyz2 = dxy2 + dz * dz;
if ((dxyz2 < 1)) {
if (mask.test(mutable.toBlockVector3()))
pattern.apply(extent, mutable.toBlockVector3(), mutable.toBlockVector3());
if (mask.test(mutable))
pattern.apply(extent, mutable, mutable);
}
}
}

View File

@ -2,7 +2,7 @@ package com.boydti.fawe.jnbt.anvil.generator;
import com.boydti.fawe.object.PseudoRandom;
import com.boydti.fawe.object.schematic.Schematic;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
@ -20,7 +20,7 @@ public class SchemGen extends Resource {
private final boolean randomRotate;
private final Mask mask;
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
public SchemGen(Mask mask, Extent extent, List<ClipboardHolder> clipboards, boolean randomRotate) {
this.mask = mask;
@ -36,7 +36,7 @@ public class SchemGen extends Resource {
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
if (y == -1) return false;
mutable.mutY(y);
if (!mask.test(mutable.toBlockVector3())) {
if (!mask.test(mutable)) {
return false;
}
mutable.mutY(y + 1);
@ -48,9 +48,9 @@ public class SchemGen extends Resource {
Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform();
if (transform.isIdentity()) {
schematic.paste(extent, mutable.toBlockVector3(), false);
schematic.paste(extent, mutable, false);
} else {
schematic.paste(extent, mutable.toBlockVector3(), false, transform);
schematic.paste(extent, mutable, false, transform);
}
mutable.mutY(y);
return true;

View File

@ -27,7 +27,7 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
// public static IBlocksHubApi api;
//
// private final MutableVector loc;
// private final MutableVector3 loc;
// private final IPlayer player;
// private IWorld world;
// private final MutableBlockData oldBlock;
@ -46,7 +46,7 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
// } catch (Throwable ignore) {
// this.world = api.getWorld(world);
// }
// this.loc = new MutableVector();
// this.loc = new MutableVector3();
// this.oldBlock = new MutableBlockData();
// this.newBlock = new MutableBlockData();
// this.player = api.getPlayer(player.getUUID());

View File

@ -2,11 +2,11 @@
//
//import org.primesoft.blockshub.api.Vector;
//
//public class MutableVector extends Vector {
//public class MutableVector3 extends Vector {
//
// public double x, y, z;
//
// public MutableVector() {
// public MutableVector3() {
// super(0, 0, 0);
// this.x = 0;
// this.y = 0;

View File

@ -18,7 +18,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BaseBiome;
@ -273,7 +273,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
default void forEachBlockInChunk(int cx, int cz, RunnableVal2<BlockVector3, BaseBlock> onEach) {
int bx = cx << 4;
int bz = cz << 4;
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
for (int x = 0; x < 16; x++) {
int xx = x + bx;
mutable.mutX(xx);
@ -290,9 +290,9 @@ public interface FaweQueue extends HasFaweQueue, Extent {
mutable.mutY(y);
CompoundTag tile = getTileEntity(x, y, z);
if (tile != null) {
onEach.run(mutable.toBlockVector3(), block.toBaseBlock(tile));
onEach.run(mutable, block.toBaseBlock(tile));
} else {
onEach.run(mutable.toBlockVector3(), block);
onEach.run(mutable, block);
}
}
}
@ -302,7 +302,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
default void forEachTileInChunk(int cx, int cz, RunnableVal2<BlockVector3, BaseBlock> onEach) {
int bx = cx << 4;
int bz = cz << 4;
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
for (int x = 0; x < 16; x++) {
int xx = x + bx;
for (int z = 0; z < 16; z++) {
@ -320,7 +320,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
mutable.mutZ(zz);
mutable.mutY(y);
BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
onEach.run(mutable.toBlockVector3(), block);
onEach.run(mutable, block);
}
}
}

View File

@ -7,8 +7,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import java.util.concurrent.ThreadLocalRandom;
@ -72,7 +71,7 @@ public class BlobBrush implements Brush {
double manScaleY = (1.25 + seedY * 0.5);
double manScaleZ = (1.25 + seedZ * 0.5);
MutableVector mutable = new MutableVector();
MutableVector3 mutable = new MutableVector3();
double roughness = 1 - sphericity;
for (int xr = -sizeInt; xr <= sizeInt; xr++) {
mutable.mutX(xr);
@ -80,7 +79,7 @@ public class BlobBrush implements Brush {
mutable.mutY(yr);
for (int zr = -sizeInt; zr <= sizeInt; zr++) {
mutable.mutZ(zr);
Vector3 pt = transform.apply(mutable.toVector3());
Vector3 pt = transform.apply(mutable);
int x = MathMan.roundInt(pt.getX());
int y = MathMan.roundInt(pt.getY());
int z = MathMan.roundInt(pt.getZ());

View File

@ -19,7 +19,7 @@ public class CircleBrush implements Brush {
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
Vector3 normal = position.toVector3().subtract(player.getLocation().toVector());
Vector3 normal = position.toVector3().subtract(player.getLocation());
editSession.makeCircle(position, pattern, size, size, size, false, normal);
}

View File

@ -6,16 +6,14 @@ import com.boydti.fawe.util.TextureUtil;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.util.Location;
@ -89,7 +87,7 @@ public class ImageBrush implements Brush {
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX((pitch - 90) % 360).inverse();
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
private final MutableVector mutable = new MutableVector();
private final MutableVector3 mutable = new MutableVector3();
@Override
public boolean test(BlockVector3 vector) {
if (solid.test(vector)) {
@ -97,11 +95,11 @@ public class ImageBrush implements Brush {
int dy = vector.getBlockY() - cy;
int dz = vector.getBlockZ() - cz;
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5).toVector3());
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5));
int x1 = (int) (pos1.getX() * scale + centerX);
int z1 = (int) (pos1.getZ() * scale + centerZ);
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5).toVector3());
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5));
int x2 = (int) (pos2.getX() * scale + centerX);
int z2 = (int) (pos2.getZ() * scale + centerZ);
if (x2 < x1) {

View File

@ -53,9 +53,9 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
int range = this.range > -1 ? getRange() : MAX_RANGE;
if (adjacent) {
Location face = player.getBlockTraceFace(range, true);
return face.toVector().add(face.getDirection());
return face.add(face.getDirection());
} else {
return player.getBlockTrace(getRange(), true).toVector();
return player.getBlockTrace(getRange(), true);
}
}

View File

@ -7,7 +7,6 @@ import com.boydti.fawe.object.mask.RadiusMask;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.function.mask.BlockMask;
import com.sk89q.worldedit.function.mask.BlockTypeMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
@ -16,8 +15,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -27,7 +25,7 @@ public class LayerBrush implements Brush {
private final BlockStateHolder[] layers;
private RecursiveVisitor visitor;
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
public LayerBrush(BlockStateHolder[] layers) {
this.layers = layers;
@ -53,9 +51,9 @@ public class LayerBrush implements Brush {
int previous2 = layers[depth - 2].getInternalId();
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
if (visitor.isVisited(mutable.toBlockVector3()) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) {
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) {
mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2, pos.getBlockZ() + dir.getBlockZ() * 2);
if (visitor.isVisited(mutable.toBlockVector3()) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
found = true;
break;
} else {

View File

@ -10,10 +10,10 @@ import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
public class ShatterBrush extends ScatterBrush {
private final MutableBlockVector mutable = new MutableBlockVector();
private final MutableBlockVector3 mutable = new MutableBlockVector3();
public ShatterBrush(int count) {
super(count, 1);
@ -76,8 +76,8 @@ public class ShatterBrush extends ScatterBrush {
int dz = position.getBlockZ() - z2;
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
if (dSqr <= radius2) {
MutableBlockVector v = mutable.setComponents(x2, y2, z2);
BlockVector3 bv = v.toBlockVector3();
MutableBlockVector3 v = mutable.setComponents(x2, y2, z2);
BlockVector3 bv = v;
if (surfaceTest.test(bv) && finalMask.test(bv)) {
// (collision) If it's visited and part of another frontier, set the block
if (!placed.add(x2, y2, z2)) {

View File

@ -17,7 +17,7 @@ import com.sk89q.worldedit.function.mask.MaskIntersection;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.interpolation.Node;
import java.util.ArrayList;
@ -151,13 +151,13 @@ public class SplineBrush implements Brush, ResettableTool {
}
private Vector3 getCentroid(Collection<BlockVector3> points) {
MutableVector sum = new MutableVector();
MutableVector3 sum = new MutableVector3();
for (BlockVector3 p : points) {
sum.mutX(sum.getX() + p.getX());
sum.mutY(sum.getY() + p.getY());
sum.mutZ(sum.getZ() + p.getZ());
}
return sum.multiply(1.0 / points.size()).toVector3();
return sum.multiply(1.0 / points.size());
}
private BlockVector3 normal(Collection<BlockVector3> points, BlockVector3 centroid) {
@ -179,7 +179,7 @@ public class SplineBrush implements Brush, ResettableTool {
double yz = 0.0;
double zz = 0.0;
MutableVector r = new MutableVector();
MutableVector3 r = new MutableVector3();
for (BlockVector3 p : points) {
r.mutX((p.getX() - centroid.getX()));
r.mutY((p.getY() - centroid.getY()));

View File

@ -15,8 +15,7 @@ import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.util.Location;
@ -54,7 +53,7 @@ public class StencilBrush extends HeightBrush {
Player player = editSession.getPlayer().getPlayer();
// BlockVector3 pos = player.getLocation().toVector();
// BlockVector3 pos = player.getLocation();
@ -65,7 +64,7 @@ public class StencilBrush extends HeightBrush {
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
private final MutableVector mutable = new MutableVector();
private final MutableVector3 mutable = new MutableVector3();
@Override
public boolean test(BlockVector3 vector) {
if (solid.test(vector)) {
@ -73,7 +72,7 @@ public class StencilBrush extends HeightBrush {
int dy = vector.getBlockY() - cy;
int dz = vector.getBlockZ() - cz;
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz).toVector3());
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
dx = MathMan.roundInt(srcPos.getX());
dz = MathMan.roundInt(srcPos.getZ());

View File

@ -8,7 +8,7 @@ import com.sk89q.worldedit.*;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
import com.sk89q.worldedit.math.interpolation.Node;
@ -60,7 +60,7 @@ public class SurfaceSpline implements Brush {
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
if (tipy == -1) continue;
if (radius == 0) {
BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz).toBlockVector3();
BlockVector3 set = MutableBlockVector3.get(tipx, tipy, tipz);
try {
pattern.apply(editSession, set, set);
} catch (WorldEditException e) {

View File

@ -4,7 +4,6 @@ import com.boydti.fawe.object.PseudoRandom;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.convolution.GaussianKernel;
@ -31,7 +30,7 @@ public interface HeightMap {
int iterations = 1;
Location min = new Location(session.getWorld(), pos.subtract(size, maxY, size).toVector3());
BlockVector3 max = pos.add(size, maxY, size);
Region region = new CuboidRegion(session.getWorld(), min.toVector().toBlockPoint(), max);
Region region = new CuboidRegion(session.getWorld(), min.toBlockPoint(), max);
com.sk89q.worldedit.math.convolution.HeightMap heightMap = new com.sk89q.worldedit.math.convolution.HeightMap(session, region, data[0], layers);
if (smooth) {
try {

View File

@ -1,16 +1,16 @@
package com.boydti.fawe.object.brush.heightmap;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
public class RotatableHeightMap extends AbstractDelegateHeightMap {
private AffineTransform transform;
private MutableVector mutable;
private MutableVector3 mutable;
public RotatableHeightMap(HeightMap parent) {
super(parent);
mutable = new MutableVector();
mutable = new MutableVector3();
this.transform = new AffineTransform();
}
@ -22,7 +22,7 @@ public class RotatableHeightMap extends AbstractDelegateHeightMap {
public double getHeight(int x, int z) {
mutable.mutX(x);
mutable.mutZ(z);
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z).toVector3()).toBlockPoint();
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint();
return super.getHeight(pos.getBlockX(), pos.getBlockZ());
}
}

View File

@ -3,10 +3,9 @@ package com.boydti.fawe.object.brush.heightmap;
import com.boydti.fawe.object.IntegerPair;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.awt.image.BufferedImage;
@ -77,10 +76,10 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
int xx = pos.getBlockX();
int zz = pos.getBlockZ();
int highestY = minY;
MutableBlockVector bv = new MutableBlockVector(pos);
MutableBlockVector3 bv = new MutableBlockVector3(pos);
for (int y = minY; y <= maxY; y++) {
bv.mutY(y);
BlockStateHolder block = clipboard.getBlock(bv.toBlockVector3());
BlockStateHolder block = clipboard.getBlock(bv);
if (!block.getBlockType().getMaterial().isAir()) {
highestY = y + 1;
}

View File

@ -13,7 +13,7 @@ import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.interpolation.Interpolation;
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
@ -95,10 +95,10 @@ public class SweepBrush implements Brush, ResettableTool {
double blockDistance = 1d / splineLength;
double step = blockDistance / quality;
double accumulation = 0;
MutableVector last = new MutableVector(0, 0, 0);
MutableVector3 last = new MutableVector3(0, 0, 0);
for (double pos = 0D; pos <= 1D; pos += step) {
Vector3 gradient = interpol.get1stDerivative(pos);
if (last == null) last = new MutableVector(interpol.get1stDerivative(pos));
if (last == null) last = new MutableVector3(interpol.get1stDerivative(pos));
double dist = MathMan.sqrtApprox(last.distanceSq(gradient));
last.mutX(gradient.getX());
last.mutY(gradient.getY());

View File

@ -3,12 +3,12 @@ package com.boydti.fawe.object.change;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.history.UndoContext;
import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BaseBiome;
public class MutableBiomeChange implements Change {
private MutableBlockVector2D mutable = new MutableBlockVector2D();
private MutableBlockVector2 mutable = new MutableBlockVector2();
private BaseBiome from;
private BaseBiome to;
@ -25,11 +25,11 @@ public class MutableBiomeChange implements Change {
@Override
public void undo(UndoContext context) throws WorldEditException {
context.getExtent().setBiome(mutable.toBlockVector2(), from);
context.getExtent().setBiome(mutable, from);
}
@Override
public void redo(UndoContext context) throws WorldEditException {
context.getExtent().setBiome(mutable.toBlockVector2(), to);
context.getExtent().setBiome(mutable, to);
}
}

View File

@ -1,21 +1,19 @@
package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.biome.BaseBiome;
@ -29,7 +27,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
public final int mx, my, mz;
private final boolean hasBiomes;
private final boolean hasEntities;
private MutableBlockVector2D mutableBlockVector2D = new MutableBlockVector2D();
private MutableBlockVector2 MutableBlockVector2 = new MutableBlockVector2();
public final Extent extent;
public WorldCopyClipboard(Extent editSession, Region region) {
@ -58,7 +56,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
@Override
public BaseBiome getBiome(int x, int z) {
return extent.getBiome(mutableBlockVector2D.setComponents(mx + x, mz + z).toBlockVector2());
return extent.getBiome(MutableBlockVector2.setComponents(mx + x, mz + z));
}
@Override
@ -76,7 +74,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
public void forEach(BlockReader task, boolean air) {
BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint();
MutableBlockVector pos = new MutableBlockVector();
MutableBlockVector3 pos = new MutableBlockVector3();
if (region instanceof CuboidRegion) {
if (air) {
((CuboidRegion) region).setUseOldIterator(true);
@ -137,9 +135,9 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
pos.mutX(x);
int xx = pos.getBlockX() - mx;
if (region.contains(pos.toBlockVector3())) {
if (region.contains(pos)) {
// BlockState block = getBlockAbs(x, y, z);
BaseBlock block = extent.getFullBlock(pos.toBlockVector3());
BaseBlock block = extent.getFullBlock(pos);
if (!air && block.getBlockType().getMaterial().isAir()) {
continue;
}

View File

@ -2,7 +2,7 @@ package com.boydti.fawe.object.collection;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ -43,14 +43,14 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
int newSize = count + size;
if (newSize > index) {
int localIndex = index - count;
MutableBlockVector pos = new MutableBlockVector(set.getIndex(localIndex));
MutableBlockVector3 pos = new MutableBlockVector3(set.getIndex(localIndex));
if (pos != null) {
int pair = entry.getIntKey();
int cx = MathMan.unpairX(pair);
int cz = MathMan.unpairY(pair);
pos.mutX((cx << 11) + pos.getBlockX());
pos.mutZ((cz << 11) + pos.getBlockZ());
return pos.toBlockVector3();
return pos;
}
}
count += newSize;
@ -92,7 +92,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
return new Iterator<BlockVector3>() {
Int2ObjectMap.Entry<LocalBlockVectorSet> entry = entries.next();
Iterator<BlockVector3> entryIter = entry.getValue().iterator();
MutableBlockVector mutable = new MutableBlockVector();
MutableBlockVector3 mutable = new MutableBlockVector3();
@Override
public void remove() {
@ -117,7 +117,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
int pair = entry.getIntKey();
int cx = MathMan.unpairX(pair);
int cz = MathMan.unpairY(pair);
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ()).toBlockVector3();
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ());
}
};
}

View File

@ -2,7 +2,7 @@ package com.boydti.fawe.object.collection;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import java.util.Collection;
import java.util.Iterator;
@ -15,7 +15,7 @@ import java.util.Set;
*/
public class LocalBlockVector2DSet implements Set<BlockVector2> {
private final SparseBitSet set;
private final MutableBlockVector2D mutable = new MutableBlockVector2D();
private final MutableBlockVector2 mutable = new MutableBlockVector2();
public LocalBlockVector2DSet() {
this.set = new SparseBitSet();
@ -102,7 +102,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
if (index != -1) {
int x = MathMan.unpairSearchCoordsX(index);
int y = MathMan.unpairSearchCoordsY(index);
return mutable.setComponents(x, y).toBlockVector2();
return mutable.setComponents(x, y);
}
return null;
}
@ -131,7 +131,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
mutable.setComponents(x, y);
previous = index;
index = set.nextSetBit(index + 1);
return mutable.toBlockVector2();
return mutable;
}
return null;
}

View File

@ -2,7 +2,7 @@ package com.boydti.fawe.object.collection;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import java.util.Collection;
import java.util.Iterator;
@ -117,7 +117,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
int y = b1;
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
return MutableBlockVector.get(x, y, z).toBlockVector3();
return MutableBlockVector3.get(x, y, z);
}
return null;
}
@ -127,7 +127,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
return new Iterator<BlockVector3>() {
int index = set.nextSetBit(0);
int previous = -1;
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
@Override
public void remove() {
@ -151,7 +151,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
mutable.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21));
previous = index;
index = set.nextSetBit(index + 1);
return mutable.toBlockVector3();
return mutable;
}
return null;
}
@ -280,7 +280,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
boolean result = false;
int size = size();
int index = -1;
MutableBlockVector mVec = MutableBlockVector.get(0, 0, 0);
MutableBlockVector3 mVec = MutableBlockVector3.get(0, 0, 0);
for (int i = 0; i < size; i++) {
index = set.nextSetBit(index + 1);
int b1 = (index & 0xFF);
@ -310,7 +310,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
public void forEach(BlockVectorSetVisitor visitor) {
int size = size();
int index = -1;
BlockVector3 mVec = MutableBlockVector.get(0, 0, 0).toBlockVector3();
BlockVector3 mVec = MutableBlockVector3.get(0, 0, 0);
for (int i = 0; i < size; i++) {
index = set.nextSetBit(index + 1);
int b1 = (index & 0xFF);

View File

@ -7,14 +7,13 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
public class BlockTranslateExtent extends AbstractDelegateExtent {
private final int dx, dy, dz;
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
public BlockTranslateExtent(Extent extent, int dx, int dy, int dz) {
super(extent);
@ -28,7 +27,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
mutable.mutX((location.getX() + dx));
mutable.mutY((location.getY() + dy));
mutable.mutZ((location.getZ() + dz));
return getExtent().setBlock(mutable.toBlockVector3(), block);
return getExtent().setBlock(mutable, block);
}
@Override

View File

@ -1,17 +1,16 @@
package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockStateHolder;
public class OffsetExtent extends ResettableExtent {
private final int dx, dy, dz;
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
public OffsetExtent(Extent parent, int dx, int dy, int dz) {
super(parent);
@ -22,7 +21,7 @@ public class OffsetExtent extends ResettableExtent {
@Override
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz).toBlockVector2(), biome);
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz), biome);
}
@Override
@ -42,7 +41,7 @@ public class OffsetExtent extends ResettableExtent {
@Override
public ResettableExtent setExtent(Extent extent) {
mutable = new MutableBlockVector2D();
mutable = new MutableBlockVector2();
return super.setExtent(extent);
}
}

View File

@ -6,16 +6,15 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockStateHolder;
public class PositionTransformExtent extends ResettableExtent {
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private transient BlockVector3 min;
private Transform transform;
@ -26,7 +25,7 @@ public class PositionTransformExtent extends ResettableExtent {
@Override
public ResettableExtent setExtent(Extent extent) {
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
min = null;
return super.setExtent(extent);
}
@ -42,7 +41,7 @@ public class PositionTransformExtent extends ResettableExtent {
mutable.mutX(((pos.getX() - min.getX())));
mutable.mutY(((pos.getY() - min.getY())));
mutable.mutZ(((pos.getZ() - min.getZ())));
MutableVector tmp = new MutableVector(transform.apply(mutable.toVector3()));
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
BlockVector3 result = min.add(tmp.toBlockPoint());
return result;
}
@ -72,7 +71,7 @@ public class PositionTransformExtent extends ResettableExtent {
mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ());
mutable.mutY(0);
return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
return super.getBiome(getPos(mutable).toBlockVector2());
}
@Override
@ -91,7 +90,7 @@ public class PositionTransformExtent extends ResettableExtent {
mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ());
mutable.mutY(0);
return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
}
public void setTransform(Transform transform) {

View File

@ -2,11 +2,10 @@ package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -14,7 +13,7 @@ import java.util.SplittableRandom;
public class RandomOffsetTransform extends ResettableExtent {
private transient SplittableRandom random;
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
private final int dx, dy, dz;
@ -30,7 +29,7 @@ public class RandomOffsetTransform extends ResettableExtent {
public boolean setBiome(BlockVector2 pos, BaseBiome biome) {
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
return getExtent().setBiome(mutable.setComponents(x, z).toBlockVector2(), biome);
return getExtent().setBiome(mutable.setComponents(x, z), biome);
}
@Override
@ -52,7 +51,7 @@ public class RandomOffsetTransform extends ResettableExtent {
@Override
public ResettableExtent setExtent(Extent extent) {
random = new SplittableRandom();
mutable = new MutableBlockVector2D();
mutable = new MutableBlockVector2();
return super.setExtent(extent);
}
}

View File

@ -2,13 +2,12 @@ package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -16,7 +15,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
public class ScaleTransform extends ResettableExtent {
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private transient int maxy;
private transient BlockVector3 min;
@ -35,7 +34,7 @@ public class ScaleTransform extends ResettableExtent {
public ResettableExtent setExtent(Extent extent) {
min = null;
maxy = extent.getMaximumPoint().getBlockY();
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
return super.setExtent(extent);
}
@ -46,7 +45,7 @@ public class ScaleTransform extends ResettableExtent {
mutable.mutX((min.getX() + (pos.getX() - min.getX()) * dx));
mutable.mutY((min.getY() + (pos.getY() - min.getY()) * dy));
mutable.mutZ((min.getZ() + (pos.getZ() - min.getZ()) * dz));
return mutable.toBlockVector3();
return mutable;
}
private BlockVector3 getPos(int x, int y, int z) {
@ -56,14 +55,14 @@ public class ScaleTransform extends ResettableExtent {
mutable.mutX((min.getX() + (x - min.getX()) * dx));
mutable.mutY((min.getY() + (y - min.getY()) * dy));
mutable.mutZ((min.getZ() + (z - min.getZ()) * dz));
return mutable.toBlockVector3();
return mutable;
}
@Override
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
boolean result = false;
MutableBlockVector pos = new MutableBlockVector(getPos(location));
MutableBlockVector3 pos = new MutableBlockVector3(getPos(location));
double sx = pos.getX();
double sy = pos.getY();
double sz = pos.getZ();
@ -73,7 +72,7 @@ public class ScaleTransform extends ResettableExtent {
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
result |= super.setBlock(pos.toBlockVector3(), block);
result |= super.setBlock(pos, block);
}
}
}
@ -83,7 +82,7 @@ public class ScaleTransform extends ResettableExtent {
@Override
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
boolean result = false;
MutableBlockVector pos = new MutableBlockVector(getPos(position.getBlockX(), 0, position.getBlockZ()));
MutableBlockVector3 pos = new MutableBlockVector3(getPos(position.getBlockX(), 0, position.getBlockZ()));
double sx = pos.getX();
double sz = pos.getZ();
double ex = pos.getX() + dx;
@ -99,7 +98,7 @@ public class ScaleTransform extends ResettableExtent {
@Override
public boolean setBlock(int x1, int y1, int z1, BlockStateHolder block) throws WorldEditException {
boolean result = false;
MutableBlockVector pos = new MutableBlockVector(getPos(x1, y1, z1));
MutableBlockVector3 pos = new MutableBlockVector3(getPos(x1, y1, z1));
double sx = pos.getX();
double sy = pos.getY();
double sz = pos.getZ();
@ -109,7 +108,7 @@ public class ScaleTransform extends ResettableExtent {
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
result |= super.setBlock(pos.toBlockVector3(), block);
result |= super.setBlock(pos, block);
}
}
}

View File

@ -2,11 +2,10 @@ package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -14,7 +13,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class SourceMaskExtent extends TemporalExtent {
private Mask mask;
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
/**
@ -54,6 +53,6 @@ public class SourceMaskExtent extends TemporalExtent {
mutable.mutX(x);
mutable.mutY(y);
mutable.mutZ(z);
return mask.test(mutable.toBlockVector3()) && super.setBlock(x, y, z, block);
return mask.test(mutable) && super.setBlock(x, y, z, block);
}
}

View File

@ -7,16 +7,14 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.registry.BlockRegistry;
public class TransformExtent extends BlockTransformExtent {
private final MutableBlockVector mutable = new MutableBlockVector();
private final MutableBlockVector3 mutable = new MutableBlockVector3();
private BlockVector3 min;
private int maxy;
@ -58,7 +56,7 @@ public class TransformExtent extends BlockTransformExtent {
mutable.mutX(((pos.getX() - min.getX())));
mutable.mutY(((pos.getY() - min.getY())));
mutable.mutZ(((pos.getZ() - min.getZ())));
MutableVector tmp = new MutableVector(getTransform().apply(mutable.toVector3()));
MutableVector3 tmp = new MutableVector3(getTransform().apply(mutable.toVector3()));
tmp.mutX((tmp.getX() + min.getX()));
tmp.mutY((tmp.getY() + min.getY()));
tmp.mutZ((tmp.getZ() + min.getZ()));
@ -72,7 +70,7 @@ public class TransformExtent extends BlockTransformExtent {
mutable.mutX(((x - min.getX())));
mutable.mutY(((y - min.getY())));
mutable.mutZ(((z - min.getZ())));
MutableVector tmp = new MutableVector(getTransform().apply(mutable.toVector3()));
MutableVector3 tmp = new MutableVector3(getTransform().apply(mutable.toVector3()));
tmp.mutX((tmp.getX() + min.getX()));
tmp.mutY((tmp.getY() + min.getY()));
tmp.mutZ((tmp.getZ() + min.getZ()));
@ -104,7 +102,7 @@ public class TransformExtent extends BlockTransformExtent {
mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ());
mutable.mutY(0);
return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
return super.getBiome(getPos(mutable).toBlockVector2());
}
@Override
@ -123,6 +121,6 @@ public class TransformExtent extends BlockTransformExtent {
mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ());
mutable.mutY(0);
return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
}
}

View File

@ -5,7 +5,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.FlatRegionFunction;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
public class SurfaceRegionFunction implements FlatRegionFunction {
private final Extent extent;
@ -13,7 +13,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
private final int minY;
private final int maxY;
private int lastY;
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
public SurfaceRegionFunction(Extent extent, RegionFunction function, int minY, int maxY) {
this.extent = extent;
@ -30,7 +30,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
if (layer != -1) {
lastY = layer;
return function.apply(mutable.setComponents(x, layer, z).toBlockVector3());
return function.apply(mutable.setComponents(x, layer, z));
}
return false;
}

View File

@ -5,17 +5,17 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
public class BiomeCopy implements RegionFunction {
protected final Extent source;
protected final Extent destination;
private final MutableBlockVector2D mPos2d;
private final MutableBlockVector2 mPos2d;
public BiomeCopy(Extent source, Extent destination) {
this.source = source;
this.destination = destination;
this.mPos2d = new MutableBlockVector2D();
this.mPos2d = new MutableBlockVector2();
this.mPos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
}
@ -25,7 +25,7 @@ public class BiomeCopy implements RegionFunction {
int z = position.getBlockZ();
if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) {
mPos2d.setComponents(x, z);
BlockVector2 bv = mPos2d.toBlockVector2();
BlockVector2 bv = mPos2d;
return destination.setBiome( bv, source.getBiome(bv));
}
return false;

View File

@ -3,7 +3,7 @@ package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
/**
* Just an optimized version of the Adjacent Mask for single adjacency
@ -11,16 +11,16 @@ import com.sk89q.worldedit.math.MutableBlockVector;
public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
private final CachedMask mask;
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
public AdjacentAnyMask(Mask mask) {
this.mask = CachedMask.cache(mask);
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
}
@Override
public void reset() {
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
}
public CachedMask getParentMask() {
@ -75,6 +75,6 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
if (y > 0 && mask.test(x, y - 1, z)) {
mutable.setComponents(0, -1, 0);
}
return (mutable.getX() == 0 && mutable.getY() == 0 && mutable.getZ() == 0) ? null : mutable.toBlockVector3();
return (mutable.getX() == 0 && mutable.getY() == 0 && mutable.getZ() == 0) ? null : mutable;
}
}

View File

@ -3,18 +3,18 @@ package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
public class AdjacentMask extends AbstractMask {
private final int min, max;
private final Mask mask;
private MutableBlockVector v;
private MutableBlockVector3 v;
public AdjacentMask(Mask mask, int requiredMin, int requiredMax) {
this.mask = mask;
this.min = requiredMin;
this.max = requiredMax;
this.v = new MutableBlockVector();
this.v = new MutableBlockVector3();
}
@Override
@ -25,34 +25,34 @@ public class AdjacentMask extends AbstractMask {
double y = bv.getY();
double z = bv.getZ();
v.mutX(x + 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutX(x);
return true;
}
v.mutX(x - 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutX(x);
return true;
}
v.mutX(x);
v.mutY(y + 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutY(y);
return true;
}
v.mutY(y - 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutY(y);
return true;
}
v.mutY(y);
v.mutZ(z + 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutZ(z);
return true;
}
v.mutZ(z - 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutZ(z);
return true;
}

View File

@ -4,7 +4,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import java.util.Arrays;
import javax.annotation.Nullable;
@ -21,7 +21,7 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
protected final int maxY;
protected final int distance;
protected transient MutableBlockVector mutable = new MutableBlockVector();
protected transient MutableBlockVector3 mutable = new MutableBlockVector3();
public AngleMask(Extent extent, double min, double max, boolean overlay, int distance) {
super(extent);
@ -36,7 +36,7 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
@Override
public void reset() {
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
cacheBotX = Integer.MIN_VALUE;
cacheBotZ = Integer.MIN_VALUE;
lastX = Integer.MIN_VALUE;

View File

@ -4,12 +4,12 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BaseBiome;
public class BiomeMask extends AbstractExtentMask implements ResettableMask {
private final BaseBiome biome;
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
public BiomeMask(Extent extent, BaseBiome biome) {
super(extent);
@ -18,12 +18,12 @@ public class BiomeMask extends AbstractExtentMask implements ResettableMask {
@Override
public void reset() {
mutable = new MutableBlockVector2D();
mutable = new MutableBlockVector2();
}
@Override
public boolean test(BlockVector3 vector) {
BlockVector2 pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ()).toBlockVector2();
BlockVector2 pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ());
return getExtent().getBiome(pos).getId() == biome.getId();
}
}

View File

@ -4,11 +4,11 @@ import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
public class CachedMask extends AbstractDelegateMask implements ResettableMask {
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private transient LocalBlockVectorSet cache_checked = new LocalBlockVectorSet();
private transient LocalBlockVectorSet cache_results = new LocalBlockVectorSet();
@ -27,7 +27,7 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
@Override
public void reset() {
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
cache_checked = new LocalBlockVectorSet();
cache_results = new LocalBlockVectorSet();
resetCache();
@ -51,11 +51,11 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
if (!check) {
return cache_results.contains(x, y, z);
}
boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
boolean result = getMask().test(mutable.setComponents(x, y, z));
if (result) cache_results.add(x, y, z);
return result;
} catch (UnsupportedOperationException ignore) {
boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
boolean result = getMask().test(mutable.setComponents(x, y, z));
if (y < 0 || y > 255) return result;
resetCache();
cache_checked.setOffset(x, z);

View File

@ -21,7 +21,7 @@ public class MaskedTargetBlock extends TargetBlock {
Location lastBlock = null;
while (getNextBlock() != null) {
Location current = getCurrentBlock();
if (!mask.test(current.toVector().toBlockPoint())) {
if (!mask.test(current.toBlockPoint())) {
if (searchForLastBlock) {
lastBlock = current;
if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= world.getMaxY()) {

View File

@ -4,7 +4,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import javax.annotation.Nullable;
@ -14,7 +14,7 @@ import javax.annotation.Nullable;
public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
private transient int mode = -1;
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private int originX = Integer.MAX_VALUE, originY = Integer.MAX_VALUE, originZ = Integer.MAX_VALUE;
@ -34,13 +34,13 @@ public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
originZ = vector.getBlockZ();
mode = 0;
Extent extent = getExtent();
if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX + 1, originY, originZ).toBlockVector3()).getMaterial().isAir()) {
if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX + 1, originY, originZ)).getMaterial().isAir()) {
mode &= 1;
}
if (!extent.getBlockType(mutable.setComponents(originX, originY, originZ - 1).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY, originZ + 1).toBlockVector3()).getMaterial().isAir()) {
if (!extent.getBlockType(mutable.setComponents(originX, originY, originZ - 1)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY, originZ + 1)).getMaterial().isAir()) {
mode &= 4;
}
if (!extent.getBlockType(mutable.setComponents(originX, originY - 1, originZ + 1).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY + 1, originZ + 1).toBlockVector3()).getMaterial().isAir()) {
if (!extent.getBlockType(mutable.setComponents(originX, originY - 1, originZ + 1)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY + 1, originZ + 1)).getMaterial().isAir()) {
mode &= 2;
}
if (Integer.bitCount(mode) >= 3) {
@ -85,7 +85,7 @@ public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
@Override
public void reset() {
mode = -1;
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
}
@Nullable

View File

@ -3,18 +3,18 @@ package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
public class WallMask extends AbstractMask {
private final int min, max;
private final Mask mask;
private MutableBlockVector v;
private MutableBlockVector3 v;
public WallMask(Mask mask, int requiredMin, int requiredMax) {
this.mask = mask;
this.min = requiredMin;
this.max = requiredMax;
this.v = new MutableBlockVector();
this.v = new MutableBlockVector3();
}
@Override
@ -25,23 +25,23 @@ public class WallMask extends AbstractMask {
double y = v.getY();
double z = v.getZ();
v.mutX(x + 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutX(x);
return true;
}
v.mutX(x - 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutX(x);
return true;
}
v.mutX(x);
v.mutZ(z + 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutZ(z);
return true;
}
v.mutZ(z - 1);
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
if (mask.test(v) && ++count == min && max >= 8) {
v.mutZ(z);
return true;
}

View File

@ -5,12 +5,12 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BaseBiome;
import java.io.IOException;
public class BiomePattern extends ExistingPattern {
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
private final BaseBiome biome;
public BiomePattern(Extent extent, BaseBiome biome) {
@ -48,6 +48,6 @@ public class BiomePattern extends ExistingPattern {
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
mutable = new MutableBlockVector2D();
mutable = new MutableBlockVector2();
}
}

View File

@ -9,7 +9,7 @@ import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.regions.Region;
import java.io.IOException;
import java.io.NotSerializableException;
@ -22,7 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
public class FullClipboardPattern extends AbstractExtentPattern {
private final Clipboard clipboard;
private final MutableBlockVector mutable = new MutableBlockVector();
private final MutableBlockVector3 mutable = new MutableBlockVector3();
/**
* Create a new clipboard pattern.

View File

@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.IOException;
@ -15,7 +15,7 @@ import java.io.IOException;
public class NoXPattern extends AbstractPattern {
private final Pattern pattern;
// private transient MutableBlockVector mutable = new MutableBlockVector();
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
public NoXPattern(Pattern pattern) {
this.pattern = pattern;
@ -25,7 +25,7 @@ public class NoXPattern extends AbstractPattern {
public BaseBlock apply(BlockVector3 pos) {
// mutable.mutY((pos.getY()));
// mutable.mutZ((pos.getZ()));
// return pattern.apply(mutable.toBlockVector3());
// return pattern.apply(mutable);
return pattern.apply(pos);
}
@ -38,6 +38,6 @@ public class NoXPattern extends AbstractPattern {
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
// mutable = new MutableBlockVector();
// mutable = new MutableBlockVector3();
}
}

View File

@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.IOException;
@ -20,7 +20,7 @@ public class NoYPattern extends AbstractPattern {
this.pattern = pattern;
}
// private transient MutableBlockVector mutable = new MutableBlockVector();
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
@Override
public BaseBlock apply(BlockVector3 pos) {
@ -38,6 +38,6 @@ public class NoYPattern extends AbstractPattern {
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
// mutable = new MutableBlockVector();
// mutable = new MutableBlockVector3();
}
}

View File

@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.IOException;
@ -20,7 +20,7 @@ public class NoZPattern extends AbstractPattern {
this.pattern = pattern;
}
// private transient MutableBlockVector mutable = new MutableBlockVector();
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
@Override
public BaseBlock apply(BlockVector3 pos) {
@ -38,6 +38,6 @@ public class NoZPattern extends AbstractPattern {
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
// mutable = new MutableBlockVector();
// mutable = new MutableBlockVector3();
}
}

View File

@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.IOException;
@ -15,7 +15,7 @@ import java.io.IOException;
public class OffsetPattern extends AbstractPattern {
private final int dx, dy, dz;
// private transient MutableBlockVector mutable = new MutableBlockVector();
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private final Pattern pattern;
public OffsetPattern(Pattern pattern, int dx, int dy, int dz) {
@ -45,6 +45,6 @@ public class OffsetPattern extends AbstractPattern {
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
// mutable = new MutableBlockVector();
// mutable = new MutableBlockVector3();
}
}

View File

@ -9,7 +9,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform;
@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class RandomFullClipboardPattern extends AbstractPattern {
private final Extent extent;
private final MutableBlockVector mutable = new MutableBlockVector();
private final MutableBlockVector3 mutable = new MutableBlockVector3();
private final List<ClipboardHolder> clipboards;
private boolean randomRotate;
private boolean randomFlip;

View File

@ -2,13 +2,11 @@ package com.boydti.fawe.object.pattern;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.math.MutableBlockVector3;
import java.io.IOException;
import java.util.SplittableRandom;
@ -18,7 +16,7 @@ public class RandomOffsetPattern extends AbstractPattern {
private final Pattern pattern;
private transient int dx2, dy2, dz2;
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private transient SplittableRandom r;
public RandomOffsetPattern(Pattern pattern, int dx, int dy, int dz) {
@ -38,7 +36,7 @@ public class RandomOffsetPattern extends AbstractPattern {
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
return pattern.apply(mutable.toBlockVector3());
return pattern.apply(mutable);
}
@Override
@ -46,7 +44,7 @@ public class RandomOffsetPattern extends AbstractPattern {
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
return pattern.apply(extent, set, mutable.toBlockVector3());
return pattern.apply(extent, set, mutable);
}
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
@ -55,6 +53,6 @@ public class RandomOffsetPattern extends AbstractPattern {
this.dy2 = dy * 2 + 1;
this.dz2 = dz * 2 + 1;
this.r = new SplittableRandom();
this.mutable = new MutableBlockVector();
this.mutable = new MutableBlockVector3();
}
}

View File

@ -2,13 +2,11 @@ package com.boydti.fawe.object.pattern;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.math.MutableBlockVector3;
import java.io.IOException;
@ -16,7 +14,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
private final Pattern pattern;
private transient BlockVector3 origin;
private transient MutableBlockVector mutable = new MutableBlockVector();
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
public RelativePattern(Pattern pattern) {
this.pattern = pattern;
@ -30,7 +28,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
mutable.mutX((pos.getX() - origin.getX()));
mutable.mutY((pos.getY() - origin.getY()));
mutable.mutZ((pos.getZ() - origin.getZ()));
return pattern.apply(mutable.toBlockVector3());
return pattern.apply(mutable);
}
@Override
@ -41,12 +39,12 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
mutable.mutX((get.getX() - origin.getX()));
mutable.mutY((get.getY() - origin.getY()));
mutable.mutZ((get.getZ() - origin.getZ()));
return pattern.apply(extent, set, mutable.toBlockVector3());
return pattern.apply(extent, set, mutable);
}
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
mutable = new MutableBlockVector();
mutable = new MutableBlockVector3();
}
@Override

View File

@ -1,15 +1,13 @@
package com.boydti.fawe.object.pattern;
import com.boydti.fawe.FaweCache;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.IOException;
@ -20,7 +18,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
private final Pattern pattern;
private transient int dx2, dy2, dz2;
private transient MutableBlockVector mutable;
private transient MutableBlockVector3 mutable;
private transient boolean[] solid;
private SplittableRandom r;
@ -39,7 +37,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
this.dz2 = dz * 2 + 1;
solid = SolidBlockMask.getTypes();
this.r = new SplittableRandom();
this.mutable = new MutableBlockVector();
this.mutable = new MutableBlockVector3();
}
@Override
@ -47,7 +45,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
BaseBlock block = pattern.apply(mutable.toBlockVector3());
BaseBlock block = pattern.apply(mutable);
if (solid[block.getInternalBlockTypeId()]) {
return block;
} else {
@ -60,9 +58,9 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
BlockStateHolder block = pattern.apply(mutable.toBlockVector3());
BlockStateHolder block = pattern.apply(mutable);
if (solid[block.getInternalBlockTypeId()]) {
return pattern.apply(extent, set, mutable.toBlockVector3());
return pattern.apply(extent, set, mutable);
} else {
return pattern.apply(extent, set, get);
}

View File

@ -5,7 +5,7 @@ import com.sk89q.worldedit.function.pattern.AbstractPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.IOException;
@ -15,10 +15,10 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
private final Pattern pattern;
private int moves;
private transient MutableBlockVector cur;
private transient MutableBlockVector[] buffer;
private transient MutableBlockVector[] allowed;
private transient MutableBlockVector next;
private transient MutableBlockVector3 cur;
private transient MutableBlockVector3[] buffer;
private transient MutableBlockVector3[] allowed;
private transient MutableBlockVector3 next;
public SurfaceRandomOffsetPattern(Pattern pattern, int distance) {
this.pattern = pattern;
@ -27,12 +27,12 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
}
private void init() {
cur = new MutableBlockVector();
this.buffer = new MutableBlockVector[BreadthFirstSearch.DIAGONAL_DIRECTIONS.length];
cur = new MutableBlockVector3();
this.buffer = new MutableBlockVector3[BreadthFirstSearch.DIAGONAL_DIRECTIONS.length];
for (int i = 0; i < buffer.length; i++) {
buffer[i] = new MutableBlockVector();
buffer[i] = new MutableBlockVector3();
}
allowed = new MutableBlockVector[buffer.length];
allowed = new MutableBlockVector3[buffer.length];
}
@Override
@ -48,21 +48,21 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
next = buffer[i];
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
next.setComponents(cur.getBlockX() + dir.getBlockX(), cur.getBlockY() + dir.getBlockY(), cur.getBlockZ() + dir.getBlockZ());
if (allowed(next.toBlockVector3())) {
if (allowed(next)) {
allowed[index++] = next;
}
}
if (index == 0) {
return cur.toBlockVector3();
return cur;
}
next = allowed[ThreadLocalRandom.current().nextInt(index)];
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
}
return cur.toBlockVector3();
return cur;
}
private boolean allowed(BlockVector3 bv) {
MutableBlockVector v = new MutableBlockVector(bv);
MutableBlockVector3 v = new MutableBlockVector3(bv);
BlockStateHolder block = pattern.apply(bv);
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
return false;
@ -71,34 +71,34 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
int y = v.getBlockY();
int z = v.getBlockZ();
v.mutY(y + 1);
if (canPassthrough(v.toBlockVector3())) {
if (canPassthrough(v)) {
v.mutY(y);
return true;
}
v.mutY(y - 1);
if (canPassthrough(v.toBlockVector3())) {
if (canPassthrough(v)) {
v.mutY(y);
return true;
}
v.mutY(y);
v.mutX(x + 1);
if (canPassthrough(v.toBlockVector3())) {
if (canPassthrough(v)) {
v.mutX(x);
return true;
}
v.mutX(x - 1);
if (canPassthrough(v.toBlockVector3())) {
if (canPassthrough(v)) {
v.mutX(x);
return true;
}
v.mutX(x);
v.mutZ(z + 1);
if (canPassthrough(v.toBlockVector3())) {
if (canPassthrough(v)) {
v.mutZ(z);
return true;
}
v.mutZ(z - 1);
if (canPassthrough(v.toBlockVector3())) {
if (canPassthrough(v)) {
v.mutZ(z);
return true;
}

View File

@ -8,7 +8,7 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class FaweQueueDelegateExtent extends DelegateFaweQueue {
private final FaweQueue parentQueue;
private final Extent parentExtent;
// private final MutableBlockVector2D mutable2d = new MutableBlockVector2D();
// private final MutableBlockVector2 mutable2d = new MutableBlockVector2();
public FaweQueueDelegateExtent(FaweQueue parentQueue, Extent parentExtent) {
super(parentQueue);

View File

@ -20,8 +20,8 @@
package com.boydti.fawe.object.regions;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException;
@ -143,8 +143,8 @@ public class PolyhedralRegion extends AbstractRegion {
if (minimumPoint == null) {
minimumPoint = maximumPoint = vertex;
} else {
// minimumPoint = new MutableBlockVector(minimumPoint.getMinimum(vertex));
// maximumPoint = new MutableBlockVector(maximumPoint.getMaximum(vertex));
// minimumPoint = new MutableBlockVector3(minimumPoint.getMinimum(vertex));
// maximumPoint = new MutableBlockVector3(maximumPoint.getMaximum(vertex));
minimumPoint = minimumPoint.getMinimum(vertex);
maximumPoint = maximumPoint.getMaximum(vertex);
}

View File

@ -5,7 +5,7 @@ import com.boydti.fawe.util.TextureUtil;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -68,8 +68,8 @@ public class PNGWriter implements ClipboardWriter {
boolean fill = length * 4 < imageSize && width * 4 < imageSize;
MutableBlockVector mutable, mutableTop, mutableRight, mutableLeft;
mutable = mutableTop = mutableRight = mutableLeft = new MutableBlockVector(0, 0, 0);
MutableBlockVector3 mutable, mutableTop, mutableRight, mutableLeft;
mutable = mutableTop = mutableRight = mutableLeft = new MutableBlockVector3(0, 0, 0);
// Vector mutableTop = new Vector(0, 0, 0);
// Vector mutableRight = new Vector(0, 0, 0);
// Vector mutableLeft = new Vector(0, 0, 0);
@ -96,16 +96,16 @@ public class PNGWriter implements ClipboardWriter {
double cpy2 = cpy1 + dpyj[zz];
for (int y = y0; y < y0 + height; y++) {
mutable.mutY(y);
BlockStateHolder block = clipboard.getBlock(mutable.toBlockVector3());
BlockStateHolder block = clipboard.getBlock(mutable);
if (block.getBlockType().getMaterial().isAir()) {
continue;
}
mutableTop.mutY(y + 1);
mutableRight.mutY(y);
mutableLeft.mutY(y);
if (!clipboard.getBlock(mutableTop.toBlockVector3()).getBlockType().getMaterial().isAir() &&
!clipboard.getBlock(mutableRight.toBlockVector3()).getBlockType().getMaterial().isAir() &&
!clipboard.getBlock(mutableLeft.toBlockVector3()).getBlockType().getMaterial().isAir() ) {
if (!clipboard.getBlock(mutableTop).getBlockType().getMaterial().isAir() &&
!clipboard.getBlock(mutableRight).getBlockType().getMaterial().isAir() &&
!clipboard.getBlock(mutableLeft).getBlockType().getMaterial().isAir() ) {
continue;
}
double cpy = cpy2 - dpxi[y - y0];

View File

@ -8,8 +8,6 @@ import com.boydti.fawe.util.MaskTraverser;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
@ -25,7 +23,7 @@ import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
@ -211,7 +209,7 @@ public class Schematic {
BlockArrayClipboard bac = (BlockArrayClipboard) clipboard;
if (copyBiomes) {
bac.IMP.forEach(new FaweClipboard.BlockReader() {
MutableBlockVector2D mpos2d = new MutableBlockVector2D();
MutableBlockVector2 mpos2d = new MutableBlockVector2();
{
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
}
@ -222,7 +220,7 @@ public class Schematic {
int zz = z + relz;
if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) {
mpos2d.setComponents(xx, zz);
extent.setBiome(mpos2d.toBlockVector2(), bac.IMP.getBiome(x, z));
extent.setBiome(mpos2d, bac.IMP.getBiome(x, z));
}
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
return;
@ -247,8 +245,8 @@ public class Schematic {
final int rely = to.getBlockY() - origin.getBlockY();
final int relz = to.getBlockZ() - origin.getBlockZ();
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
// MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D();
MutableBlockVector2D mpos2d = new MutableBlockVector2D();
// MutableBlockVector2 mpos2d_2 = new MutableBlockVector2();
MutableBlockVector2 mpos2d = new MutableBlockVector2();
{
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
}
@ -260,7 +258,7 @@ public class Schematic {
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
mpos2d.setComponents(xx, zz);
// extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ())));
extent.setBiome(mpos2d.toBlockVector2(), clipboard.getBiome(BlockVector2.at(mutable.getBlockX(), mutable.getBlockZ())));
extent.setBiome(mpos2d, clipboard.getBiome(BlockVector2.at(mutable.getBlockX(), mutable.getBlockZ())));
}
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
return false;

View File

@ -22,7 +22,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.AbstractProperty;
@ -168,7 +168,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
}
Map<String, Object> structure = FaweCache.asMap("version", 1, "author", owner);
// ignored: version / owner
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
Int2ObjectArrayMap<Integer> indexes = new Int2ObjectArrayMap<>();
// Size
structure.put("size", Arrays.asList(width, height, length));

View File

@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Location;
@ -56,7 +56,7 @@ public class SchemVis extends ImmutableVirtualWorld {
private final Long2ObjectOpenHashMap<Map.Entry<File, Long>> files;
private final Long2ObjectOpenHashMap<MCAChunk> chunks; // TODO use soft references OR clear chunks outside view distance
private final MutableBlockVector2D lastPos = new MutableBlockVector2D();
private final MutableBlockVector2 lastPos = new MutableBlockVector2();
private final FawePlayer player;
private final Location origin;
private final BlockVector2 chunkOffset;
@ -322,10 +322,10 @@ public class SchemVis extends ImmutableVirtualWorld {
private BlockVector2 registerAndGetChunkOffset(BlockVector2 schemDimensions, File file) {
int chunkX = schemDimensions.getBlockX() >> 4;
int chunkZ = schemDimensions.getBlockZ() >> 4;
MutableBlockVector2D pos2 = new MutableBlockVector2D();
MutableBlockVector2D curPos = lastPos;
MutableBlockVector2 pos2 = new MutableBlockVector2();
MutableBlockVector2 curPos = lastPos;
// Find next free position
while (!isAreaFree(curPos.toBlockVector2(), pos2.setComponents(curPos.getBlockX() + chunkX, curPos.getBlockZ() + chunkZ).toBlockVector2())) {
while (!isAreaFree(curPos, pos2.setComponents(curPos.getBlockX() + chunkX, curPos.getBlockZ() + chunkZ))) {
// if (curPos == lastPos && !files.containsKey(MathMan.pairInt(curPos.getBlockX(), curPos.getBlockZ()))) {
// curPos = new MutableBlockVector2();
// curPos.setComponents(lastPos.getBlockX(), lastPos.getBlockZ());
@ -345,7 +345,7 @@ public class SchemVis extends ImmutableVirtualWorld {
}
}
for (int i = 0; i < Math.min(chunkX, chunkZ); i++) curPos.nextPosition();
return curPos.toBlockVector2();
return curPos;
}
private boolean isAreaFree(BlockVector2 chunkPos1, BlockVector2 chunkPos2 /* inclusive */) {
@ -599,7 +599,7 @@ public class SchemVis extends ImmutableVirtualWorld {
clear();
chunks.clear();
files.clear();
player.getPlayer().setPosition(origin.toVector(), origin.getPitch(), origin.getYaw());
player.getPlayer().setPosition(origin, origin.getPitch(), origin.getYaw());
if (update) {
FaweQueue packetQueue = SetQueue.IMP.getNewQueue(player.getWorld(), true, false);

View File

@ -7,7 +7,7 @@ import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.RunContext;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -77,8 +77,8 @@ public abstract class DFSVisitor implements Operation {
NodePair current;
Node from;
Node adjacent;
// MutableBlockVector mutable = new MutableBlockVector();
// MutableBlockVector mutable2 = new MutableBlockVector();
// MutableBlockVector3 mutable = new MutableBlockVector3();
// MutableBlockVector3 mutable2 = new MutableBlockVector3();
int countAdd, countAttempt;
IntegerTrio[] dirs = getIntDirections();

View File

@ -67,20 +67,6 @@ public abstract class TaskManager {
* @param runnables
*/
public void parallel(Collection<Runnable> runnables) {
// if (!Fawe.get().isJava8()) {
// ExecutorCompletionService c = new ExecutorCompletionService(pool);
// for (Runnable run : runnables) {
// c.submit(run, null);
// }
// try {
// for (int i = 0; i < runnables.size(); i++) {
// c.take();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return;
// }
for (Runnable run : runnables) {
pool.submit(run);
}

View File

@ -136,8 +136,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
private FawePlayer player;
private FaweChangeSet changeTask;
private MutableBlockVector mutablebv = new MutableBlockVector();
private MutableVector mutablev = new MutableVector();
private MutableBlockVector3 mutablebv = new MutableBlockVector3();
private int changes = 0;
private BlockBag blockBag;
@ -1080,7 +1079,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
public boolean setBlock(int x, int y, int z, Pattern pattern) {
this.changes++;
try {
BlockVector3 bv = mutablebv.setComponents(x, y, z).toBlockVector3();
BlockVector3 bv = mutablebv.setComponents(x, y, z);
return pattern.apply(extent, bv, bv);
} catch (WorldEditException e) {
throw new RuntimeException("Unexpected exception", e);
@ -2147,7 +2146,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
private int makeCylinder(BlockVector3 pos, final Pattern block, double radiusX, double radiusZ, int height, double thickness, final boolean filled) {
radiusX += 0.5;
radiusZ += 0.5;
MutableBlockVector posv = new MutableBlockVector(pos);
MutableBlockVector3 posv = new MutableBlockVector3(pos);
if (height == 0) {
return this.changes;
} else if (height < 0) {
@ -2167,7 +2166,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
int px = posv.getBlockX();
int py = posv.getBlockY();
int pz = posv.getBlockZ();
MutableBlockVector mutable = new MutableBlockVector();
MutableBlockVector3 mutable = new MutableBlockVector3();
final int ceilRadiusX = (int) Math.ceil(radiusX);
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
@ -2207,10 +2206,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
for (int y = 0; y < height; ++y) {
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
}
}
}
@ -2241,10 +2240,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
for (int y = 0; y < height; ++y) {
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
}
}
}
@ -2271,7 +2270,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
int px = pos.getBlockX();
int py = pos.getBlockY();
int pz = pos.getBlockZ();
MutableBlockVector mutable = new MutableBlockVector();
MutableBlockVector3 mutable = new MutableBlockVector3();
final int ceilRadiusX = (int) Math.ceil(radiusX);
final int ceilRadiusY = (int) Math.ceil(radiusY);
@ -2318,21 +2317,21 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py - y, pz + z).toBlockVector3(), block);
setBlock(mutable.setComponents(px + x, py - y, pz + z), block);
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py - y, pz + z).toBlockVector3(), block);
setBlock(mutable.setComponents(px - x, py - y, pz + z), block);
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py - y, pz - z).toBlockVector3(), block);
setBlock(mutable.setComponents(px + x, py - y, pz - z), block);
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py - y, pz - z).toBlockVector3(), block);
setBlock(mutable.setComponents(px - x, py - y, pz - z), block);
}
}
}
@ -2791,7 +2790,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
final int maxY = max.getBlockY();
final int maxZ = max.getBlockZ();
MutableBlockVector mutable = new MutableBlockVector(minX, minY, minZ);
MutableBlockVector3 mutable = new MutableBlockVector3(minX, minY, minZ);
for (int x = minX; x <= maxX; ++x) {
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; ++z) {
@ -2938,14 +2937,14 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
//
// for (BlockVector3 position : region) {
// // offset, scale
// final Vector3 scaled = position.toVector3().subtract(zero).divide(unit);
// final Vector3 scaled = position.subtract(zero).divide(unit);
//
// // transform
// expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ());
//
// final BlockVector3 sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
private MutableBlockVector mutable = new MutableBlockVector();
private MutableBlockVector3 mutable = new MutableBlockVector3();
@Override
public boolean apply(BlockVector3 position) throws WorldEditException {
@ -3297,12 +3296,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
@Override
protected BaseBiome getBiome(final int x, final int z, final BaseBiome defaultBiomeType) {
final Vector2 current = Vector2.at(x, z);
environment.setCurrentBlock(current.toVector3(0));
final Vector2 scaled = current.subtract(zero2D).divide(unit2D);
environment.setCurrentBlock(x, 0, z);
double scaledX = (x - zero2D.getX()) / unit2D.getX();
double scaledZ = (z - zero2D.getZ()) / unit2D.getZ();
try {
if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) {
if (expression.evaluate(scaledX, scaledZ) <= 0) {
return null;
}
@ -3397,8 +3396,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
}
final Set<BlockVector2> chunks = region.getChunks();
MutableBlockVector mutable = new MutableBlockVector();
MutableBlockVector2D mutable2D = new MutableBlockVector2D();
MutableBlockVector3 mutable = new MutableBlockVector3();
MutableBlockVector2 mutable2D = new MutableBlockVector2();
for (BlockVector2 chunk : chunks) {
final int cx = chunk.getBlockX();
final int cz = chunk.getBlockZ();
@ -3418,7 +3417,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
boolean containsAny = false;
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) {
containsAny = true;
BlockVector3 mbv = mutable.toBlockVector3();
BlockVector3 mbv = mutable;
if (fcs != null) {
for (int x = 0; x < 16; x++) {
int xx = x + bx;

View File

@ -20,7 +20,6 @@
package com.sk89q.worldedit;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweInputStream;
import com.boydti.fawe.object.FaweLimit;
@ -43,7 +42,6 @@ import com.sk89q.jchronic.utils.Time;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.command.tool.*;
@ -51,7 +49,6 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
import com.sk89q.worldedit.history.changeset.ChangeSet;
import com.sk89q.worldedit.internal.cui.CUIEvent;
@ -67,7 +64,6 @@ import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.snapshot.Snapshot;
@ -878,7 +874,7 @@ public class LocalSession implements TextureHolder {
public BlockVector3 getPlacementPosition(Player player) throws IncompleteRegionException {
checkNotNull(player);
if (!placeAtPos1) {
return player.getBlockIn().toVector().toBlockPoint();
return player.getBlockIn().toBlockPoint();
}
return selector.getPrimaryPosition();

View File

@ -150,11 +150,11 @@ public class BiomeCommands extends MethodCommands {
return;
}
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
BaseBiome biome = player.getWorld().getBiome(blockPosition.toBlockPoint().toBlockVector2());
biomes[biome.getId()]++;
size = 1;
} else if (args.hasFlag('p')) {
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toBlockPoint().toBlockVector2());
biomes[biome.getId()]++;
size = 1;
} else {
@ -219,7 +219,7 @@ public class BiomeCommands extends MethodCommands {
Mask2D mask2d = mask != null ? mask.toMask2D() : null;
if (atPosition) {
region = new CuboidRegion(player.getLocation().toVector().toBlockPoint(), player.getLocation().toVector().toBlockPoint());
region = new CuboidRegion(player.getLocation().toBlockPoint(), player.getLocation().toBlockPoint());
} else {
region = session.getSelection(world);
}

View File

@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.CombinedTransform;
@ -94,11 +94,11 @@ public class FlattenedClipboardTransform {
corners[i] = transformAround.apply(corners[i]);
}
MutableVector newMinimum = new MutableVector(corners[0]);
MutableVector newMaximum = new MutableVector(corners[0]);
// MutableVector cbv = new MutableVector();
MutableVector3 newMinimum = new MutableVector3(corners[0]);
MutableVector3 newMaximum = new MutableVector3(corners[0]);
// MutableVector3 cbv = new MutableVector3();
for (int i = 1; i < corners.length; i++) {
MutableVector cbv = new MutableVector(corners[i]);
MutableVector3 cbv = new MutableVector3(corners[i]);
newMinimum = newMinimum.setComponents(newMinimum.getMinimum(cbv));
newMaximum = newMaximum.setComponents(newMaximum.getMaximum(cbv));
}

View File

@ -31,9 +31,7 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -49,10 +47,8 @@ import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.command.binding.Range;
import com.sk89q.worldedit.util.command.binding.Switch;
@ -142,9 +138,9 @@ public class GenerationCommands extends MethodCommands {
image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
}
// MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector().toBlockPoint());
// MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
BlockVector3 pos1 = player.getLocation().toVector().toBlockPoint();
// MutableBlockVector3 pos1 = new MutableBlockVector3(player.getLocation().toBlockPoint());
// MutableBlockVector3 pos2 = new MutableBlockVector3(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
BlockVector3 pos1 = player.getLocation().toBlockPoint();
BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1);
CuboidRegion region = new CuboidRegion(pos1, pos2);
int[] count = new int[1];

View File

@ -40,7 +40,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.command.binding.Range;
@ -167,10 +166,10 @@ public class HistoryCommands extends MethodCommands {
radius = Math.max(Math.min(500, radius), 0);
final World world = player.getWorld();
Location origin = player.getLocation();
BlockVector3 bot = origin.toVector().toBlockPoint().subtract(radius, radius, radius);
BlockVector3 bot = origin.toBlockPoint().subtract(radius, radius, radius);
bot = bot.withY(Math.max(0, bot.getY()));
// bot.mutY(Math.max(0, bot.getY()));
BlockVector3 top = origin.toVector().toBlockPoint().add(radius, radius, radius);
BlockVector3 top = origin.toBlockPoint().add(radius, radius, radius);
bot = bot.withY(Math.min(255, top.getY()));
// top.mutY(Math.min(255, top.getY()));
RollbackDatabase database = DBHandler.IMP.getDatabase(world);

View File

@ -190,7 +190,7 @@ public class NavigationCommands {
pos = player.getSolidBlockTrace(300);
}
if (pos != null) {
if(args.hasFlag('f')) player.setPosition(pos.toVector()); else player.findFreePosition(pos);
if(args.hasFlag('f')) player.setPosition(pos); else player.findFreePosition(pos);
BBC.POOF.send(player);
} else {
BBC.NO_BLOCK.send(player);

View File

@ -34,9 +34,7 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -64,7 +62,6 @@ import com.sk89q.worldedit.math.convolution.HeightMapFilter;
import com.sk89q.worldedit.math.noise.RandomNoise;
import com.sk89q.worldedit.regions.*;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.command.binding.Range;
import com.sk89q.worldedit.util.command.binding.Switch;
@ -172,7 +169,7 @@ public class RegionCommands extends MethodCommands {
BBC.NO_BLOCK.send(player);
return;
}
CompoundTag nbt = editSession.getFullBlock(pos.toVector().toBlockPoint()).getNbtData();
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
if (nbt != null) {
player.print(nbt.getValue().toString());
} else {

View File

@ -35,7 +35,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext;
@ -45,7 +44,6 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.regions.RegionSelector;
@ -65,18 +63,13 @@ import com.sk89q.worldedit.util.formatting.Style;
import com.sk89q.worldedit.util.formatting.StyledFragment;
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.storage.ChunkStore;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
@ -115,7 +108,7 @@ public class SelectionCommands {
return;
}
} else {
pos = player.getBlockIn().toVector().toBlockPoint();
pos = player.getBlockIn().toBlockPoint();
}
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
@ -148,7 +141,7 @@ public class SelectionCommands {
return;
}
} else {
pos = player.getBlockIn().toVector().toBlockPoint();
pos = player.getBlockIn().toBlockPoint();
}
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
@ -169,7 +162,7 @@ public class SelectionCommands {
)
@CommandPermissions("worldedit.selection.hpos")
public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
BlockVector3 pos = player.getBlockTrace(300).toBlockPoint();
if (pos != null) {
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
@ -193,7 +186,7 @@ public class SelectionCommands {
)
@CommandPermissions("worldedit.selection.hpos")
public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
BlockVector3 pos = player.getBlockTrace(300).toBlockPoint();
if (pos != null) {
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
@ -254,7 +247,7 @@ public class SelectionCommands {
min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3());
} else {
// use player loc
min2D = ChunkStore.toChunk(player.getBlockIn().toVector().toBlockPoint());
min2D = ChunkStore.toChunk(player.getBlockIn().toBlockPoint());
}
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);

View File

@ -6,9 +6,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -33,7 +30,7 @@ public class AreaPickaxe implements BlockTool {
int ox = clicked.getBlockX();
int oy = clicked.getBlockY();
int oz = clicked.getBlockZ();
BlockType initialType = clicked.getExtent().getBlock(clicked.toVector().toBlockPoint()).getBlockType();
BlockType initialType = clicked.getExtent().getBlock(clicked.toBlockPoint()).getBlockType();
if (initialType.getMaterial().isAir()) {
return true;
@ -63,7 +60,7 @@ public class AreaPickaxe implements BlockTool {
// continue;
// }
//
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toBlockPoint().distanceSq(pos));
//
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
// }

View File

@ -37,7 +37,6 @@ import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
/**
* A mode that cycles the data values of supported blocks.
@ -56,8 +55,8 @@ public class BlockDataCyler implements DoubleActionBlockTool {
World world = (World) clicked.getExtent();
// BlockStateHolder block = world.getBlock(clicked.toVector());
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
// BlockStateHolder block = world.getBlock(clicked);
BlockVector3 blockPoint = clicked.toBlockPoint();
BlockState block = world.getBlock(blockPoint);
if (!config.allowedDataCycleBlocks.isEmpty()

View File

@ -19,24 +19,16 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.object.extent.PatternTransform;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
/**
* A mode that replaces one block.
@ -61,7 +53,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
EditSession editSession = session.createEditSession(player);
try {
editSession.setBlock(clicked.toVector().toBlockPoint(), pattern);
editSession.setBlock(clicked.toBlockPoint(), pattern);
} finally {
if (bag != null) {
bag.flushChanges();
@ -76,7 +68,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
EditSession editSession = session.createEditSession(player);
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector().toBlockPoint());
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toBlockPoint());
BlockType type = targetBlock.getBlockType();
if (type != null) {

View File

@ -1,7 +1,6 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RunnableVal;
@ -26,7 +25,6 @@ import com.sk89q.worldedit.*;
import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.entity.Player;
@ -40,7 +38,6 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import java.io.IOException;
@ -53,7 +50,6 @@ import java.util.concurrent.locks.ReentrantLock;
import javax.annotation.Nullable;
import static com.boydti.fawe.object.brush.TargetMode.TARGET_FACE_RANGE;
import static com.google.common.base.Preconditions.checkNotNull;
public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
@ -385,7 +381,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
Location loc = player.getLocation();
switch (targetMode) {
case TARGET_BLOCK_RANGE:
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
case FOWARD_POINT_PITCH: {
int d = 0;
float pitch = loc.getPitch();
@ -393,7 +389,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
// vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
return offset(vector, loc.toVector()).toBlockPoint();
return offset(vector, loc).toBlockPoint();
}
case TARGET_POINT_HEIGHT: {
final int height = loc.getBlockY();
@ -407,10 +403,10 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
}
final int distance = (height - y) + 8;
return offset(trace(editSession, player, distance, true), loc.toVector()).toBlockPoint();
return offset(trace(editSession, player, distance, true), loc).toBlockPoint();
}
case TARGET_FACE_RANGE:
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
default:
return null;
}
@ -429,7 +425,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
@Override
public void run(Vector3 value) {
Location result = tb.getMaskedTargetBlock(useLastBlock);
this.value = result.toVector();
this.value = result;
}
});
}
@ -478,7 +474,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
editSession.setMask(newMask);
//=======
// try {
// brush.build(editSession, target.toVector().toBlockPoint(), material, size);
// brush.build(editSession, target.toBlockPoint(), material, size);
// } catch (MaxChangedBlocksException e) {
// player.printError("Max blocks change limit reached.");
// } finally {

View File

@ -50,7 +50,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
if (target == null) return true;
RegionSelector selector = session.getRegionSelector(player.getWorld());
BlockVector3 blockPoint = target.toVector().toBlockPoint();
BlockVector3 blockPoint = target.toBlockPoint();
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
selector.explainPrimarySelection(player, session, blockPoint);
}
@ -68,7 +68,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
if (target == null) return true;
RegionSelector selector = session.getRegionSelector(player.getWorld());
BlockVector3 blockPoint = target.toVector().toBlockPoint();
BlockVector3 blockPoint = target.toBlockPoint();
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
selector.explainSecondarySelection(player, session, blockPoint);
}

View File

@ -69,7 +69,7 @@ public class FloatingTreeRemover implements BlockTool {
Player player, LocalSession session, Location clicked) {
final World world = (World) clicked.getExtent();
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
final BlockState state = world.getBlock(clicked.toBlockPoint());
if (!isTreeBlock(state.getBlockType())) {
player.printError("That's not a tree.");
@ -77,7 +77,7 @@ public class FloatingTreeRemover implements BlockTool {
}
final EditSession editSession = session.createEditSession(player);
try /*(EditSession editSession = session.createEditSession(player))*/ {
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
final Set<BlockVector3> blockSet = bfs(world, clicked.toBlockPoint());
if (blockSet == null) {
player.printError("That's not a floating tree.");
return true;

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -59,7 +58,7 @@ public class FloodFillTool implements BlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
World world = (World) clicked.getExtent();
BlockVector3 origin = clicked.toVector().toBlockPoint();
BlockVector3 origin = clicked.toBlockPoint();
BlockType initialType = world.getBlock(origin).getBlockType();
if (initialType.getMaterial().isAir()) {

View File

@ -58,12 +58,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
EditSession eS = session.createEditSession(player);
try {
// eS.disableBuffering();
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
BlockVector3 blockPoint = pos.toBlockPoint();
BaseBlock applied = secondary.apply(blockPoint);
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(blockPoint, secondary);
} else {
eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), secondary);
eS.setBlock(pos.subtract(pos.getDirection()).toBlockPoint(), secondary);
}
return true;
} catch (MaxChangedBlocksException e) {
@ -80,12 +80,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
try {
// eS.disableBuffering();
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
BlockVector3 blockPoint = pos.toBlockPoint();
BaseBlock applied = primary.apply(blockPoint);
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(blockPoint, primary);
} else {
eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), primary);
eS.setBlock(pos.subtract(pos.getDirection()).toBlockPoint(), primary);
}
return true;
} catch (MaxChangedBlocksException e) {

View File

@ -45,10 +45,10 @@ public class QueryTool implements BlockTool {
World world = (World) clicked.getExtent();
EditSession editSession = session.createEditSession(player);
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
BlockVector3 blockPoint = clicked.toBlockPoint();
BaseBlock block = editSession.getFullBlock(blockPoint);
player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
player.print("\u00A79@" + clicked + ": " + "\u00A7e"
+ block.getBlockType().getName() + "\u00A77" + " ("
+ block.toString() + ") "
+ "\u00A7f"

View File

@ -1,7 +1,5 @@
package com.sk89q.worldedit.command.tool;
import java.util.Set;
import com.boydti.fawe.object.mask.IdMask;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
@ -13,13 +11,6 @@ import com.sk89q.worldedit.function.block.BlockReplace;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -45,10 +36,10 @@ public class RecursivePickaxe implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent();
final BlockVector3 pos = clicked.toVector().toBlockPoint();
final BlockVector3 pos = clicked.toBlockPoint();
EditSession editSession = session.createEditSession(player);
BlockVector3 origin = clicked.toVector().toBlockPoint();
BlockVector3 origin = clicked.toBlockPoint();
BlockType initialType = world.getBlock(origin).getBlockType();
BlockStateHolder block = editSession.getBlock(pos);
@ -74,8 +65,8 @@ public class RecursivePickaxe implements BlockTool {
session.remember(editSession);
//=======
// try {
// recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
// clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
// recurse(server, editSession, world, clicked.toBlockPoint(),
// clicked.toBlockPoint(), range, initialType, new HashSet<>());
// } catch (MaxChangedBlocksException e) {
// player.printError("Max blocks change limit reached.");
// } finally {

View File

@ -44,7 +44,7 @@ public class SinglePickaxe implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent();
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
BlockVector3 blockPoint = clicked.toBlockPoint();
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
if (blockType == BlockTypes.BEDROCK
&& !player.canDestroyBedrock()) {
@ -61,7 +61,7 @@ public class SinglePickaxe implements BlockTool {
try {
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
// TODO FIXME play effect
// world.playEffect(clicked.toVector(), 2001, blockType);
// world.playEffect(clicked, 2001, blockType);
}
} finally {
editSession.flushQueue();

View File

@ -53,7 +53,7 @@ public class TreePlanter implements BlockTool {
try {
boolean successful = false;
for (int i = 0; i < 10; i++) {
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
if (treeType.generate(editSession, clicked.add(0, 1, 0).toBlockPoint())) {
successful = true;
break;
}

View File

@ -44,7 +44,7 @@ public class SmoothBrush implements Brush {
Vector3 posDouble = position.toVector3();
Location min = new Location(editSession.getWorld(), posDouble.subtract(size, size, size));
BlockVector3 max = posDouble.add(size, size + 10, size).toBlockPoint();
Region region = new CuboidRegion(editSession.getWorld(), min.toVector().toBlockPoint(), max);
Region region = new CuboidRegion(editSession.getWorld(), min.toBlockPoint(), max);
HeightMap heightMap = new HeightMap(editSession, region);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
heightMap.applyFilter(filter, iterations);

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.entity.Player;
@ -36,20 +35,12 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypeUtil;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException;
import java.io.File;
@ -345,12 +336,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public Location getBlockIn() {
return getLocation().setPosition(getLocation().toVector().floor());
return getLocation().setPosition(getLocation().floor());
}
@Override
public Location getBlockOn() {
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).floor());
}
@Override
@ -425,7 +416,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
boolean inFree = false;
while ((block = hitBlox.getNextBlock()) != null) {
boolean free = !world.getBlock(block.toVector().toBlockPoint()).getBlockType().getMaterial().isMovementBlocker();
boolean free = !world.getBlock(block.toBlockPoint()).getBlockType().getMaterial().isMovementBlocker();
if (firstBlock) {
firstBlock = false;

View File

@ -28,7 +28,6 @@ import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
import com.boydti.fawe.wrappers.PlayerWrapper;
import com.boydti.fawe.wrappers.WorldWrapper;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.command.tool.*;
import static com.google.common.base.Preconditions.checkNotNull;
@ -44,7 +43,6 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.platform.*;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.HandSide;
@ -310,7 +308,7 @@ public class PlatformManager {
final Actor actor = createProxyActor(event.getCause());
try {
final Location location = event.getLocation();
final BlockVector3 vector = location.toVector().toBlockPoint();
final BlockVector3 vector = location.toBlockPoint();
// At this time, only handle interaction from players
if (actor instanceof Player) {

View File

@ -21,7 +21,6 @@ package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import static com.google.common.base.Preconditions.checkNotNull;
@ -112,7 +111,7 @@ public class PlayerProxy extends AbstractPlayerActor {
@Override
public Location getLocation() {
Location loc = this.basePlayer.getLocation();
return new Location(loc.getExtent(), loc.toVector().add(offset), loc.getDirection());
return new Location(loc.getExtent(), loc.add(offset), loc.getDirection());
}
@Override

View File

@ -35,7 +35,7 @@ import com.sk89q.worldedit.function.operation.OperationQueue;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
@ -51,7 +51,7 @@ import javax.annotation.Nullable;
public class AbstractDelegateExtent implements LightingExtent {
private transient final Extent extent;
// private MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
// private MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
/**
* Create a new instance.

View File

@ -39,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class MaskingExtent extends AbstractDelegateExtent {
private Mask mask;
// private MutableBlockVector mutable = new MutableBlockVector();
// private MutableBlockVector3 mutable = new MutableBlockVector3();
/**
* Create a new instance.

View File

@ -32,7 +32,6 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@ -42,9 +41,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Collections;
@ -177,7 +175,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
public List<? extends Entity> getEntities(Region region) {
List<Entity> filtered = new ArrayList<>();
for (Entity entity : getEntities()) {
if (region.contains(entity.getLocation().toVector().toBlockPoint())) {
if (region.contains(entity.getLocation().toBlockPoint())) {
filtered.add(entity);
}
}

View File

@ -141,6 +141,8 @@ public class BlockTransformExtent extends ResettableExtent {
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
/**
* Transform the given block using the given transform.
*

View File

@ -26,7 +26,6 @@ import com.sk89q.jnbt.FloatTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@ -104,7 +103,7 @@ public class ExtentEntityCopy implements EntityFunction {
//<<<<<<< HEAD
// Vector pivot = from.round().add(0.5, 0.5, 0.5);
// Vector newPosition = transform.apply(location.toVector().subtract(pivot));
// Vector newPosition = transform.apply(location.subtract(pivot));
// Vector newDirection;
// if (transform.isIdentity()) {
// newDirection = entity.getLocation().getDirection();
@ -116,7 +115,7 @@ public class ExtentEntityCopy implements EntityFunction {
// }
//=======
Vector3 pivot = from.round().add(0.5, 0.5, 0.5);
Vector3 newPosition = transform.apply(location.toVector().subtract(pivot));
Vector3 newPosition = transform.apply(location.subtract(pivot));
Vector3 newDirection;
newDirection = transform.isIdentity() ?

View File

@ -18,7 +18,7 @@ public class BackwardsExtentBlockCopy implements Operation {
private final RegionFunction function;
private final BlockVector3 origin;
// private Vector mutable = new MutableBlockVector();
// private Vector mutable = new MutableBlockVector3();
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, BlockVector3 origin, Transform transform, RegionFunction function) {
this.source = source;

View File

@ -369,7 +369,7 @@ public class ForwardExtentCopy implements Operation {
if (!entities.isEmpty()) {
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
// if (copyingEntities) {
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
entityCopy.setRemoving(removingEntities);
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
Operations.completeBlindly(entityVisitor);

View File

@ -29,5 +29,4 @@ public interface FawePattern extends Pattern {
*/
@Override
boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException;
}
}

View File

@ -14,7 +14,7 @@ import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.RunContext;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.Vector3;
import java.util.ArrayDeque;
@ -217,8 +217,8 @@ public abstract class BreadthFirstSearch implements Operation {
@Override
public Operation resume(RunContext run) throws WorldEditException {
MutableBlockVector mutable = new MutableBlockVector();
// MutableBlockVector mutable2 = new MutableBlockVector();
MutableBlockVector3 mutable = new MutableBlockVector3();
// MutableBlockVector3 mutable2 = new MutableBlockVector3();
boolean shouldTrim = false;
IntegerTrio[] dirs = getIntDirections();
BlockVectorSet tempQueue = new BlockVectorSet();

View File

@ -20,7 +20,7 @@
package com.sk89q.worldedit.function.visitor;
import com.boydti.fawe.object.HasFaweQueue;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;

View File

@ -102,7 +102,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
}
if (logMode != null && sender.isPlayer()) {
Vector3 position = player.getLocation().toVector();
Vector3 position = player.getLocation();
LocalSession session = worldEdit.getSessionManager().get(player);
switch (logMode) {

View File

@ -60,22 +60,12 @@ public class BlockVector2 {
}
public static BlockVector2 at(int x, int z) {
switch (x) {
case 0:
if (z == 0) {
return ZERO;
}
break;
case 1:
if (z == 1) {
return ONE;
}
break;
}
return new BlockVector2(x, z);
}
private final int x, z;
protected int x, z;
protected BlockVector2(){}
/**
* Construct an instance.
@ -83,11 +73,31 @@ public class BlockVector2 {
* @param x the X coordinate
* @param z the Z coordinate
*/
private BlockVector2(int x, int z) {
protected BlockVector2(int x, int z) {
this.x = x;
this.z = z;
}
public MutableBlockVector2 setComponents(int x, int z) {
return new MutableBlockVector2(x, z);
}
public MutableBlockVector2 mutX(double x) {
return new MutableBlockVector2((int) x, z);
}
public MutableBlockVector2 mutZ(double z) {
return new MutableBlockVector2(x, (int) z);
}
public MutableBlockVector2 mutX(int x) {
return new MutableBlockVector2(x, z);
}
public MutableBlockVector2 mutZ(int z) {
return new MutableBlockVector2(x, z);
}
/**
* Get the X coordinate.
*
@ -144,6 +154,35 @@ public class BlockVector2 {
return BlockVector2.at(x, z);
}
public MutableBlockVector2 nextPosition() {
int absX = Math.abs(x);
int absY = Math.abs(z);
if (absX > absY) {
if (x > 0) {
return setComponents(x, z + 1);
} else {
return setComponents(x, z - 1);
}
} else if (absY > absX) {
if (z > 0) {
return setComponents(x - 1, z);
} else {
return setComponents(x + 1, z);
}
} else {
if (x == z && x > 0) {
return setComponents(x, z + 1);
}
if (x == absX) {
return setComponents(x, z + 1);
}
if (z == absY) {
return setComponents(x, z - 1);
}
return setComponents(x + 1, z);
}
}
/**
* Add another vector to this vector and return the result as a new vector.
*

View File

@ -42,20 +42,6 @@ public class BlockVector3 {
}
public static BlockVector3 at(int x, int y, int z) {
// switch for efficiency on typical cases
// in MC y is rarely 0/1 on selections
switch (y) {
case 0:
if (x == 0 && z == 0) {
return ZERO;
}
break;
case 1:
if (x == 1 && z == 1) {
return ONE;
}
break;
}
return new BlockVector3(x, y, z);
}
@ -80,7 +66,9 @@ public class BlockVector3 {
return YzxOrderComparator.YZX_ORDER;
}
private final int x, y, z;
protected int x, y, z;
protected BlockVector3(){}
/**
* Construct an instance.
@ -89,12 +77,44 @@ public class BlockVector3 {
* @param y the Y coordinate
* @param z the Z coordinate
*/
private BlockVector3(int x, int y, int z) {
protected BlockVector3(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public MutableBlockVector3 setComponents(double x, double y, double z) {
return new MutableBlockVector3((int) x, (int) y, (int) z);
}
public MutableBlockVector3 setComponents(int x, int y, int z) {
return new MutableBlockVector3(x, y, z);
}
public MutableBlockVector3 mutX(double x) {
return new MutableBlockVector3((int) x, y, z);
}
public MutableBlockVector3 mutY(double y) {
return new MutableBlockVector3(x, (int) y, z);
}
public MutableBlockVector3 mutZ(double z) {
return new MutableBlockVector3(x, y, (int) z);
}
public MutableBlockVector3 mutX(int x) {
return new MutableBlockVector3(x, y, z);
}
public MutableBlockVector3 mutY(int y) {
return new MutableBlockVector3(x, y, z);
}
public MutableBlockVector3 mutZ(int z) {
return new MutableBlockVector3(x, y, z);
}
/**
* Get the X coordinate.
*

Some files were not shown because too many files have changed in this diff Show More