3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

Current Progress #3

Dieser Commit ist enthalten in:
IronApollo 2019-01-09 02:13:44 -05:00
Ursprung d4157b7e0e
Commit 842b1307c7
221 geänderte Dateien mit 3173 neuen und 3041 gelöschten Zeilen

Datei anzeigen

@ -22,11 +22,11 @@ package com.sk89q.worldedit.blocks;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
/** /**
* A implementation of a lazy block for {@link Extent#getLazyBlock(Vector)} * A implementation of a lazy block for {@link Extent#getLazyBlock(Vector)}
@ -42,7 +42,7 @@ import com.sk89q.worldedit.extent.Extent;
public class LazyBlock extends BaseBlock { public class LazyBlock extends BaseBlock {
private final Extent extent; private final Extent extent;
private final Vector position; private final BlockVector3 position;
private boolean loaded = false; private boolean loaded = false;
/** /**
@ -52,7 +52,7 @@ public class LazyBlock extends BaseBlock {
* @param extent the extent to later load the full block data from * @param extent the extent to later load the full block data from
* @param position the position to later load the full block data from * @param position the position to later load the full block data from
*/ */
public LazyBlock(BlockType type, Extent extent, Vector position) { public LazyBlock(BlockType type, Extent extent, BlockVector3 position) {
super(type); super(type);
checkNotNull(extent); checkNotNull(extent);
checkNotNull(position); checkNotNull(position);
@ -67,7 +67,7 @@ public class LazyBlock extends BaseBlock {
* @param extent the extent to later load the full block data from * @param extent the extent to later load the full block data from
* @param position the position to later load the full block data from * @param position the position to later load the full block data from
*/ */
public LazyBlock(BlockState state, Extent extent, Vector position) { public LazyBlock(BlockState state, Extent extent, BlockVector3 position) {
super(state); super(state);
checkNotNull(extent); checkNotNull(extent);
checkNotNull(position); checkNotNull(position);

Datei anzeigen

@ -526,7 +526,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights[index] & 0xFF; int y = heights[index] & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
int newHeight = table.average(x, z, index); int newHeight = table.average(x, z, index);
setLayerHeightRaw(index, newHeight); setLayerHeightRaw(index, newHeight);
} }
@ -581,7 +581,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
} }
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (!mask.test(mutable)) { if (!mask.test(mutable.toBlockVector3())) {
continue; continue;
} }
if (placed.containsRadius(x, z, distance)) { if (placed.containsRadius(x, z, distance)) {
@ -601,9 +601,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
Schematic schematic = new Schematic(clipboard); Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform(); Transform transform = holder.getTransform();
if (transform.isIdentity()) { if (transform.isIdentity()) {
schematic.paste(this, mutable, false); schematic.paste(this, mutable.toBlockVector3(), false);
} else { } else {
schematic.paste(this, mutable, false, transform); schematic.paste(this, mutable.toBlockVector3(), false, transform);
} }
if (x + distance < getWidth()) { if (x + distance < getWidth()) {
x += distance; x += distance;
@ -629,7 +629,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
} }
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (!mask.test(mutable)) { if (!mask.test(mutable.toBlockVector3())) {
continue; continue;
} }
if (placed.containsRadius(x, z, distance)) { if (placed.containsRadius(x, z, distance)) {
@ -650,9 +650,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
Schematic schematic = new Schematic(clipboard); Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform(); Transform transform = holder.getTransform();
if (transform.isIdentity()) { if (transform.isIdentity()) {
schematic.paste(this, mutable, false); schematic.paste(this, mutable.toBlockVector3(), false);
} else { } else {
schematic.paste(this, mutable, false, transform); schematic.paste(this, mutable.toBlockVector3(), false, transform);
} }
if (x + distance < getWidth()) { if (x + distance < getWidth()) {
x += distance; x += distance;
@ -1132,7 +1132,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
if (mask != null) { if (mask != null) {
mutable.mutX(z); mutable.mutX(z);
mutable.mutY(heights.getByte(index) & 0xFF); mutable.mutY(heights.getByte(index) & 0xFF);
if (!mask.test(mutable)) continue; if (!mask.test(mutable.toBlockVector3())) continue;
} }
if (imgMask != null) { if (imgMask != null) {
int height = imgMask.getRGB(x, z) & 0xFF; int height = imgMask.getRGB(x, z) & 0xFF;
@ -1251,7 +1251,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
for (int x = 0; x < getWidth(); x++, index++) { for (int x = 0; x < getWidth(); x++, index++) {
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(heights.getByte(index) & 0xFF); mutable.mutY(heights.getByte(index) & 0xFF);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
int color = img.getRGB(x, z); int color = img.getRGB(x, z);
BlockType block = textureUtil.getNearestBlock(color); BlockType block = textureUtil.getNearestBlock(color);
if (block != null) { if (block != null) {
@ -1327,7 +1327,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
biomes.setByte(index, biome); biomes.setByte(index, biome);
} }
} }
@ -1356,7 +1356,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) { if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(height); mutable.mutY(height);
overlayArr[index] = pattern.apply(mutable).getInternalId(); overlayArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
} }
} }
} }
@ -1383,7 +1383,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) { if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(height); mutable.mutY(height);
mainArr[index] = pattern.apply(mutable).getInternalId(); mainArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
} }
} }
} }
@ -1408,7 +1408,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) { if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(height); mutable.mutY(height);
floorArr[index] = pattern.apply(mutable).getInternalId(); floorArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
} }
} }
} }
@ -1435,7 +1435,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) { if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(height); mutable.mutY(height);
int combined = pattern.apply(mutable).getInternalId(); int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
mainArr[index] = combined; mainArr[index] = combined;
floorArr[index] = combined; floorArr[index] = combined;
} }
@ -1457,8 +1457,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
overlay.setInt(index, pattern.apply(mutable).getInternalId()); overlay.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
} }
} }
} }
@ -1476,8 +1476,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
floor.setInt(index, pattern.apply(mutable).getInternalId()); floor.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
} }
} }
} }
@ -1496,8 +1496,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
main.setInt(index, pattern.apply(mutable).getInternalId()); main.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
} }
} }
} }
@ -1516,8 +1516,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
int combined = pattern.apply(mutable).getInternalId(); int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
floor.setInt(index, combined); floor.setInt(index, combined);
main.setInt(index, combined); main.setInt(index, combined);
} }
@ -1543,7 +1543,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
floorArr[index] = value.apply(mutable).getInternalId(); floorArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
} }
} }
}); });
@ -1564,7 +1564,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
int combined = value.apply(mutable).getInternalId(); int combined = value.apply(mutable.toBlockVector3()).getInternalId();
mainArr[index] = combined; mainArr[index] = combined;
floorArr[index] = combined; floorArr[index] = combined;
} }
@ -1586,7 +1586,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
mainArr[index] = value.apply(mutable).getInternalId(); mainArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
} }
} }
}); });
@ -1607,7 +1607,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
overlayArr[index] = value.apply(mutable).getInternalId(); overlayArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
} }
} }
}); });
@ -1994,7 +1994,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
overlay.setInt(index, combined); overlay.setInt(index, combined);
} }
} }
@ -2009,7 +2009,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
floor.setInt(index, combined); floor.setInt(index, combined);
} }
} }
@ -2025,7 +2025,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
main.setInt(index, combined); main.setInt(index, combined);
} }
} }
@ -2041,7 +2041,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int y = heights.getByte(index) & 0xFF; int y = heights.getByte(index) & 0xFF;
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
if (mask.test(mutable)) { if (mask.test(mutable.toBlockVector3())) {
floor.setInt(index, combined); floor.setInt(index, combined);
main.setInt(index, combined); main.setInt(index, combined);
} }

Datei anzeigen

@ -43,7 +43,7 @@ public class OreGen extends Resource {
@Override @Override
public boolean spawn(Random rand, int x, int z) throws WorldEditException { public boolean spawn(Random rand, int x, int z) throws WorldEditException {
int y = rand.nextInt(maxY - minY) + minY; int y = rand.nextInt(maxY - minY) + minY;
if (!mask.test(mutable.setComponents(x, y, z))) { if (!mask.test(mutable.setComponents(x, y, z).toBlockVector3())) {
return false; return false;
} }
double f = rand.nextDouble() * Math.PI; double f = rand.nextDouble() * Math.PI;
@ -106,8 +106,8 @@ public class OreGen extends Resource {
double dz = (zz + 0.5D - d9) * id11o2; double dz = (zz + 0.5D - d9) * id11o2;
double dxyz2 = dxy2 + dz * dz; double dxyz2 = dxy2 + dz * dz;
if ((dxyz2 < 1)) { if ((dxyz2 < 1)) {
if (mask.test(mutable)) if (mask.test(mutable.toBlockVector3()))
pattern.apply(extent, mutable, mutable); pattern.apply(extent, mutable.toBlockVector3(), mutable.toBlockVector3());
} }
} }
} }

Datei anzeigen

@ -36,7 +36,7 @@ public class SchemGen extends Resource {
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255); int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
if (y == -1) return false; if (y == -1) return false;
mutable.mutY(y); mutable.mutY(y);
if (!mask.test(mutable)) { if (!mask.test(mutable.toBlockVector3())) {
return false; return false;
} }
mutable.mutY(y + 1); mutable.mutY(y + 1);
@ -48,9 +48,9 @@ public class SchemGen extends Resource {
Schematic schematic = new Schematic(clipboard); Schematic schematic = new Schematic(clipboard);
Transform transform = holder.getTransform(); Transform transform = holder.getTransform();
if (transform.isIdentity()) { if (transform.isIdentity()) {
schematic.paste(extent, mutable, false); schematic.paste(extent, mutable.toBlockVector3(), false);
} else { } else {
schematic.paste(extent, mutable, false, transform); schematic.paste(extent, mutable.toBlockVector3(), false, transform);
} }
mutable.mutY(y); mutable.mutY(y);
return true; return true;

Datei anzeigen

@ -286,9 +286,9 @@ public interface FaweQueue extends HasFaweQueue, Extent {
CompoundTag tile = getTileEntity(x, y, z); CompoundTag tile = getTileEntity(x, y, z);
if (tile != null) { if (tile != null) {
BaseBlock block = BaseBlock.getFromInternalId(combined, tile); BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
onEach.run(mutable, block); onEach.run(mutable.toBlockVector3(), block);
} else { } else {
onEach.run(mutable, state); onEach.run(mutable.toBlockVector3(), state);
} }
} }
} }
@ -316,7 +316,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
mutable.mutZ(zz); mutable.mutZ(zz);
mutable.mutY(y); mutable.mutY(y);
BaseBlock block = BaseBlock.getFromInternalId(combined, tile); BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
onEach.run(mutable, block); onEach.run(mutable.toBlockVector3(), block);
} }
} }
} }

Datei anzeigen

@ -80,7 +80,7 @@ public class BlobBrush implements Brush {
mutable.mutY(yr); mutable.mutY(yr);
for (int zr = -sizeInt; zr <= sizeInt; zr++) { for (int zr = -sizeInt; zr <= sizeInt; zr++) {
mutable.mutZ(zr); mutable.mutZ(zr);
Vector3 pt = transform.apply(mutable); Vector3 pt = transform.apply(mutable.toVector3());
int x = MathMan.roundInt(pt.getX()); int x = MathMan.roundInt(pt.getX());
int y = MathMan.roundInt(pt.getY()); int y = MathMan.roundInt(pt.getY());
int z = MathMan.roundInt(pt.getZ()); int z = MathMan.roundInt(pt.getZ());

Datei anzeigen

@ -98,11 +98,11 @@ public class ImageBrush implements Brush {
int dy = vector.getBlockY() - cy; int dy = vector.getBlockY() - cy;
int dz = vector.getBlockZ() - cz; int dz = vector.getBlockZ() - cz;
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5)); Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5).toVector3());
int x1 = (int) (pos1.getX() * scale + centerX); int x1 = (int) (pos1.getX() * scale + centerX);
int z1 = (int) (pos1.getZ() * scale + centerZ); int z1 = (int) (pos1.getZ() * scale + centerZ);
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5)); Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5).toVector3());
int x2 = (int) (pos2.getX() * scale + centerX); int x2 = (int) (pos2.getX() * scale + centerX);
int z2 = (int) (pos2.getZ() * scale + centerZ); int z2 = (int) (pos2.getZ() * scale + centerZ);
if (x2 < x1) { if (x2 < x1) {

Datei anzeigen

@ -53,9 +53,9 @@ public class LayerBrush implements Brush {
int previous2 = layers[depth - 2].getInternalId(); int previous2 = layers[depth - 2].getInternalId();
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) { for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ()); mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) { if (visitor.isVisited(mutable.toBlockVector3()) && 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); mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2, pos.getBlockZ() + dir.getBlockZ() * 2);
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) { if (visitor.isVisited(mutable.toBlockVector3()) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
found = true; found = true;
break; break;
} else { } else {

Datei anzeigen

@ -77,7 +77,8 @@ public class ShatterBrush extends ScatterBrush {
int dSqr = (dx * dx) + (dy * dy) + (dz * dz); int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
if (dSqr <= radius2) { if (dSqr <= radius2) {
MutableBlockVector v = mutable.setComponents(x2, y2, z2); MutableBlockVector v = mutable.setComponents(x2, y2, z2);
if (surfaceTest.test(v) && finalMask.test(v)) { BlockVector3 bv = v.toBlockVector3();
if (surfaceTest.test(bv) && finalMask.test(bv)) {
// (collision) If it's visited and part of another frontier, set the block // (collision) If it's visited and part of another frontier, set the block
if (!placed.add(x2, y2, z2)) { if (!placed.add(x2, y2, z2)) {
if (!frontierVisited.contains(x2, y2, z2)) { if (!frontierVisited.contains(x2, y2, z2)) {

Datei anzeigen

@ -157,7 +157,7 @@ public class SplineBrush implements Brush, ResettableTool {
sum.mutY(sum.getY() + p.getY()); sum.mutY(sum.getY() + p.getY());
sum.mutZ(sum.getZ() + p.getZ()); sum.mutZ(sum.getZ() + p.getZ());
} }
return sum.multiply(1.0 / points.size()); return sum.multiply(1.0 / points.size()).toVector3();
} }
private BlockVector3 normal(Collection<BlockVector3> points, BlockVector3 centroid) { private BlockVector3 normal(Collection<BlockVector3> points, BlockVector3 centroid) {

Datei anzeigen

@ -73,7 +73,7 @@ public class StencilBrush extends HeightBrush {
int dy = vector.getBlockY() - cy; int dy = vector.getBlockY() - cy;
int dz = vector.getBlockZ() - cz; int dz = vector.getBlockZ() - cz;
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz)); Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz).toVector3());
dx = MathMan.roundInt(srcPos.getX()); dx = MathMan.roundInt(srcPos.getX());
dz = MathMan.roundInt(srcPos.getZ()); dz = MathMan.roundInt(srcPos.getZ());

Datei anzeigen

@ -60,7 +60,7 @@ public class SurfaceSpline implements Brush {
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY); tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
if (tipy == -1) continue; if (tipy == -1) continue;
if (radius == 0) { if (radius == 0) {
BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz); BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz).toBlockVector3();
try { try {
pattern.apply(editSession, set, set); pattern.apply(editSession, set, set);
} catch (WorldEditException e) { } catch (WorldEditException e) {

Datei anzeigen

@ -22,7 +22,7 @@ public class RotatableHeightMap extends AbstractDelegateHeightMap {
public double getHeight(int x, int z) { public double getHeight(int x, int z) {
mutable.mutX(x); mutable.mutX(x);
mutable.mutZ(z); mutable.mutZ(z);
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint(); BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z).toVector3()).toBlockPoint();
return super.getHeight(pos.getBlockX(), pos.getBlockZ()); return super.getHeight(pos.getBlockX(), pos.getBlockZ());
} }
} }

Datei anzeigen

@ -81,7 +81,7 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
MutableBlockVector bv = new MutableBlockVector(pos); MutableBlockVector bv = new MutableBlockVector(pos);
for (int y = minY; y <= maxY; y++) { for (int y = minY; y <= maxY; y++) {
bv.mutY(y); bv.mutY(y);
BlockStateHolder block = clipboard.getBlock(bv); BlockStateHolder block = clipboard.getBlock(bv.toBlockVector3());
if (!block.getBlockType().getMaterial().isAir()) { if (!block.getBlockType().getMaterial().isAir()) {
highestY = y + 1; highestY = y + 1;
} }

Datei anzeigen

@ -25,11 +25,11 @@ public class MutableBiomeChange implements Change {
@Override @Override
public void undo(UndoContext context) throws WorldEditException { public void undo(UndoContext context) throws WorldEditException {
context.getExtent().setBiome(mutable, from); context.getExtent().setBiome(mutable.toBlockVector2(), from);
} }
@Override @Override
public void redo(UndoContext context) throws WorldEditException { public void redo(UndoContext context) throws WorldEditException {
context.getExtent().setBiome(mutable, to); context.getExtent().setBiome(mutable.toBlockVector2(), to);
} }
} }

Datei anzeigen

@ -57,7 +57,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
@Override @Override
public BaseBiome getBiome(int x, int z) { public BaseBiome getBiome(int x, int z) {
return extent.getBiome(mutableBlockVector2D.setComponents(mx + x, mz + z)); return extent.getBiome(mutableBlockVector2D.setComponents(mx + x, mz + z).toBlockVector2());
} }
@Override @Override
@ -137,7 +137,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) { for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
pos.mutX(x); pos.mutX(x);
int xx = pos.getBlockX() - mx; int xx = pos.getBlockX() - mx;
if (region.contains(pos)) { if (region.contains(pos.toBlockVector3())) {
BlockState block = getBlockAbs(x, y, z); BlockState block = getBlockAbs(x, y, z);
if (!air && block.getBlockType().getMaterial().isAir()) { if (!air && block.getBlockType().getMaterial().isAir()) {
continue; continue;

Datei anzeigen

@ -50,7 +50,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
int cz = MathMan.unpairY(pair); int cz = MathMan.unpairY(pair);
pos.mutX((cx << 11) + pos.getBlockX()); pos.mutX((cx << 11) + pos.getBlockX());
pos.mutZ((cz << 11) + pos.getBlockZ()); pos.mutZ((cz << 11) + pos.getBlockZ());
return pos; return pos.toBlockVector3();
} }
} }
count += newSize; count += newSize;
@ -117,7 +117,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
int pair = entry.getIntKey(); int pair = entry.getIntKey();
int cx = MathMan.unpairX(pair); int cx = MathMan.unpairX(pair);
int cz = MathMan.unpairY(pair); int cz = MathMan.unpairY(pair);
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ()); return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ()).toBlockVector3();
} }
}; };
} }

Datei anzeigen

@ -102,7 +102,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
if (index != -1) { if (index != -1) {
int x = MathMan.unpairSearchCoordsX(index); int x = MathMan.unpairSearchCoordsX(index);
int y = MathMan.unpairSearchCoordsY(index); int y = MathMan.unpairSearchCoordsY(index);
return mutable.setComponents(x, y); return mutable.setComponents(x, y).toBlockVector2();
} }
return null; return null;
} }
@ -131,7 +131,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
mutable.setComponents(x, y); mutable.setComponents(x, y);
previous = index; previous = index;
index = set.nextSetBit(index + 1); index = set.nextSetBit(index + 1);
return mutable; return mutable.toBlockVector2();
} }
return null; return null;
} }

Datei anzeigen

@ -117,7 +117,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21); int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
int y = b1; int y = b1;
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21); int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
return MutableBlockVector.get(x, y, z); return MutableBlockVector.get(x, y, z).toBlockVector3();
} }
return null; return null;
} }
@ -151,7 +151,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
mutable.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21)); mutable.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21));
previous = index; previous = index;
index = set.nextSetBit(index + 1); index = set.nextSetBit(index + 1);
return mutable; return mutable.toBlockVector3();
} }
return null; return null;
} }
@ -310,7 +310,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
public void forEach(BlockVectorSetVisitor visitor) { public void forEach(BlockVectorSetVisitor visitor) {
int size = size(); int size = size();
int index = -1; int index = -1;
BlockVector3 mVec = MutableBlockVector.get(0, 0, 0); BlockVector3 mVec = MutableBlockVector.get(0, 0, 0).toBlockVector3();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
index = set.nextSetBit(index + 1); index = set.nextSetBit(index + 1);
int b1 = (index & 0xFF); int b1 = (index & 0xFF);

Datei anzeigen

@ -28,7 +28,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
mutable.mutX((location.getX() + dx)); mutable.mutX((location.getX() + dx));
mutable.mutY((location.getY() + dy)); mutable.mutY((location.getY() + dy));
mutable.mutZ((location.getZ() + dz)); mutable.mutZ((location.getZ() + dz));
return getExtent().setBlock(mutable, block); return getExtent().setBlock(mutable.toBlockVector3(), block);
} }
@Override @Override
@ -36,7 +36,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
mutable.mutX(x + dx); mutable.mutX(x + dx);
mutable.mutY(y + dy); mutable.mutY(y + dy);
mutable.mutZ(z + dz); mutable.mutZ(z + dz);
return getExtent().setBlock(mutable, block); return getExtent().setBlock(mutable.toBlockVector3(), block);
} }
@Override @Override

Datei anzeigen

@ -23,7 +23,7 @@ public class OffsetExtent extends ResettableExtent {
@Override @Override
public boolean setBiome(BlockVector2 position, BaseBiome biome) { public boolean setBiome(BlockVector2 position, BaseBiome biome) {
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz), biome); return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz).toBlockVector2(), biome);
} }
@Override @Override

Datei anzeigen

@ -83,7 +83,7 @@ public class PositionTransformExtent extends ResettableExtent {
mutable.mutX(position.getBlockX()); mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ()); mutable.mutZ(position.getBlockZ());
mutable.mutY(0); mutable.mutY(0);
return super.getBiome(getPos(mutable).toBlockVector2()); return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
} }
@Override @Override
@ -102,7 +102,7 @@ public class PositionTransformExtent extends ResettableExtent {
mutable.mutX(position.getBlockX()); mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ()); mutable.mutZ(position.getBlockZ());
mutable.mutY(0); mutable.mutY(0);
return super.setBiome(getPos(mutable).toBlockVector2(), biome); return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
} }
public void setTransform(Transform transform) { public void setTransform(Transform transform) {

Datei anzeigen

@ -30,7 +30,7 @@ public class RandomOffsetTransform extends ResettableExtent {
public boolean setBiome(BlockVector2 pos, BaseBiome biome) { public boolean setBiome(BlockVector2 pos, BaseBiome biome) {
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx; int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz; int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
return getExtent().setBiome(mutable.setComponents(x, z), biome); return getExtent().setBiome(mutable.setComponents(x, z).toBlockVector2(), biome);
} }
@Override @Override

Datei anzeigen

@ -46,7 +46,7 @@ public class ScaleTransform extends ResettableExtent {
mutable.mutX((min.getX() + (pos.getX() - min.getX()) * dx)); mutable.mutX((min.getX() + (pos.getX() - min.getX()) * dx));
mutable.mutY((min.getY() + (pos.getY() - min.getY()) * dy)); mutable.mutY((min.getY() + (pos.getY() - min.getY()) * dy));
mutable.mutZ((min.getZ() + (pos.getZ() - min.getZ()) * dz)); mutable.mutZ((min.getZ() + (pos.getZ() - min.getZ()) * dz));
return mutable; return mutable.toBlockVector3();
} }
private BlockVector3 getPos(int x, int y, int z) { private BlockVector3 getPos(int x, int y, int z) {
@ -56,7 +56,7 @@ public class ScaleTransform extends ResettableExtent {
mutable.mutX((min.getX() + (x - min.getX()) * dx)); mutable.mutX((min.getX() + (x - min.getX()) * dx));
mutable.mutY((min.getY() + (y - min.getY()) * dy)); mutable.mutY((min.getY() + (y - min.getY()) * dy));
mutable.mutZ((min.getZ() + (z - min.getZ()) * dz)); mutable.mutZ((min.getZ() + (z - min.getZ()) * dz));
return mutable; return mutable.toBlockVector3();
} }
@ -73,7 +73,7 @@ public class ScaleTransform extends ResettableExtent {
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) { 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.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
result |= super.setBlock(pos, block); result |= super.setBlock(pos.toBlockVector3(), block);
} }
} }
} }
@ -109,7 +109,7 @@ public class ScaleTransform extends ResettableExtent {
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) { 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.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
result |= super.setBlock(pos, block); result |= super.setBlock(pos.toBlockVector3(), block);
} }
} }
} }

Datei anzeigen

@ -54,6 +54,6 @@ public class SourceMaskExtent extends TemporalExtent {
mutable.mutX(x); mutable.mutX(x);
mutable.mutY(y); mutable.mutY(y);
mutable.mutZ(z); mutable.mutZ(z);
return mask.test(mutable) && super.setBlock(x, y, z, block); return mask.test(mutable.toBlockVector3()) && super.setBlock(x, y, z, block);
} }
} }

Datei anzeigen

@ -34,15 +34,15 @@ public class TransformExtent extends BlockTransformExtent {
@Override @Override
public BlockVector3 getMinimumPoint() { public BlockVector3 getMinimumPoint() {
BlockVector3 pos1 = new MutableBlockVector(getPos(super.getMinimumPoint())); BlockVector3 pos1 = getPos(super.getMinimumPoint());
BlockVector3 pos2 = new MutableBlockVector(getPos(super.getMaximumPoint())); BlockVector3 pos2 = getPos(super.getMaximumPoint());
return pos1.getMinimum(pos2); return pos1.getMinimum(pos2);
} }
@Override @Override
public BlockVector3 getMaximumPoint() { public BlockVector3 getMaximumPoint() {
BlockVector3 pos1 = new MutableBlockVector(getPos(super.getMinimumPoint())); BlockVector3 pos1 = getPos(super.getMinimumPoint());
BlockVector3 pos2 = new MutableBlockVector(getPos(super.getMaximumPoint())); BlockVector3 pos2 = getPos(super.getMaximumPoint());
return pos1.getMaximum(pos2); return pos1.getMaximum(pos2);
} }
@ -99,7 +99,7 @@ public class TransformExtent extends BlockTransformExtent {
mutable.mutX(position.getBlockX()); mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ()); mutable.mutZ(position.getBlockZ());
mutable.mutY(0); mutable.mutY(0);
return super.getBiome(getPos(mutable).toBlockVector2()); return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
} }
@Override @Override
@ -118,6 +118,6 @@ public class TransformExtent extends BlockTransformExtent {
mutable.mutX(position.getBlockX()); mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ()); mutable.mutZ(position.getBlockZ());
mutable.mutY(0); mutable.mutY(0);
return super.setBiome(getPos(mutable).toBlockVector2(), biome); return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
} }
} }

Datei anzeigen

@ -30,7 +30,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false); int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
if (layer != -1) { if (layer != -1) {
lastY = layer; lastY = layer;
return function.apply(mutable.setComponents(x, layer, z)); return function.apply(mutable.setComponents(x, layer, z).toBlockVector3());
} }
return false; return false;
} }

Datei anzeigen

@ -3,6 +3,7 @@ package com.boydti.fawe.object.function.block;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D; import com.sk89q.worldedit.math.MutableBlockVector2D;
@ -24,7 +25,8 @@ public class BiomeCopy implements RegionFunction {
int z = position.getBlockZ(); int z = position.getBlockZ();
if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) { if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) {
mPos2d.setComponents(x, z); mPos2d.setComponents(x, z);
return destination.setBiome(mPos2d, source.getBiome(mPos2d)); BlockVector2 bv = mPos2d.toBlockVector2();
return destination.setBiome( bv, source.getBiome(bv));
} }
return false; return false;
} }

Datei anzeigen

@ -58,23 +58,23 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
int y = v.getBlockY(); int y = v.getBlockY();
int z = v.getBlockZ(); int z = v.getBlockZ();
if (mask.test(x + 1, y, z)) { if (mask.test(x + 1, y, z)) {
return mutable.setComponents(1, 0, 0); mutable.setComponents(1, 0, 0);
} }else
if (mask.test(x - 1, y, z)) { if (mask.test(x - 1, y, z)) {
return mutable.setComponents(-1, 0, 0); mutable.setComponents(-1, 0, 0);
} }else
if (mask.test(x, y, z + 1)) { if (mask.test(x, y, z + 1)) {
return mutable.setComponents(0, 0, 1); mutable.setComponents(0, 0, 1);
} }else
if (mask.test(x, y, z - 1)) { if (mask.test(x, y, z - 1)) {
return mutable.setComponents(0, 0, -1); mutable.setComponents(0, 0, -1);
} }else
if (y < 256 && mask.test(x, y + 1, z)) { if (y < 256 && mask.test(x, y + 1, z)) {
return mutable.setComponents(0, 1, 0); mutable.setComponents(0, 1, 0);
} }else
if (y > 0 && mask.test(x, y - 1, z)) { if (y > 0 && mask.test(x, y - 1, z)) {
return mutable.setComponents(0, -1, 0); mutable.setComponents(0, -1, 0);
} }
return null; return (mutable.getX() == 0 && mutable.getY() == 0 && mutable.getZ() == 0) ? null : mutable.toBlockVector3();
} }
} }

Datei anzeigen

@ -21,38 +21,38 @@ public class AdjacentMask extends AbstractMask {
public boolean test(BlockVector3 bv) { public boolean test(BlockVector3 bv) {
v.setComponents(bv); v.setComponents(bv);
int count = 0; int count = 0;
double x = v.getX(); double x = bv.getX();
double y = v.getY(); double y = bv.getY();
double z = v.getZ(); double z = bv.getZ();
v.mutX(x + 1); v.mutX(x + 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutX(x); v.mutX(x);
return true; return true;
} }
v.mutX(x - 1); v.mutX(x - 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutX(x); v.mutX(x);
return true; return true;
} }
v.mutX(x); v.mutX(x);
v.mutY(y + 1); v.mutY(y + 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutY(y); v.mutY(y);
return true; return true;
} }
v.mutY(y - 1); v.mutY(y - 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutY(y); v.mutY(y);
return true; return true;
} }
v.mutY(y); v.mutY(y);
v.mutZ(z + 1); v.mutZ(z + 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutZ(z); v.mutZ(z);
return true; return true;
} }
v.mutZ(z - 1); v.mutZ(z - 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutZ(z); v.mutZ(z);
return true; return true;
} }

Datei anzeigen

@ -23,7 +23,7 @@ public class BiomeMask extends AbstractExtentMask implements ResettableMask {
@Override @Override
public boolean test(BlockVector3 vector) { public boolean test(BlockVector3 vector) {
BlockVector2 pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ()); BlockVector2 pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ()).toBlockVector2();
return getExtent().getBiome(pos).getId() == biome.getId(); return getExtent().getBiome(pos).getId() == biome.getId();
} }
} }

Datei anzeigen

@ -51,11 +51,11 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
if (!check) { if (!check) {
return cache_results.contains(x, y, z); return cache_results.contains(x, y, z);
} }
boolean result = getMask().test(mutable.setComponents(x, y, z)); boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
if (result) cache_results.add(x, y, z); if (result) cache_results.add(x, y, z);
return result; return result;
} catch (UnsupportedOperationException ignore) { } catch (UnsupportedOperationException ignore) {
boolean result = getMask().test(mutable.setComponents(x, y, z)); boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
if (y < 0 || y > 255) return result; if (y < 0 || y > 255) return result;
resetCache(); resetCache();
cache_checked.setOffset(x, z); cache_checked.setOffset(x, z);

Datei anzeigen

@ -34,13 +34,13 @@ public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
originZ = vector.getBlockZ(); originZ = vector.getBlockZ();
mode = 0; mode = 0;
Extent extent = getExtent(); Extent extent = getExtent();
if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX + 1, originY, originZ)).getMaterial().isAir()) { if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX + 1, originY, originZ).toBlockVector3()).getMaterial().isAir()) {
mode &= 1; mode &= 1;
} }
if (!extent.getBlockType(mutable.setComponents(originX, originY, originZ - 1)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY, originZ + 1)).getMaterial().isAir()) { if (!extent.getBlockType(mutable.setComponents(originX, originY, originZ - 1).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY, originZ + 1).toBlockVector3()).getMaterial().isAir()) {
mode &= 4; mode &= 4;
} }
if (!extent.getBlockType(mutable.setComponents(originX, originY - 1, originZ + 1)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY + 1, originZ + 1)).getMaterial().isAir()) { 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()) {
mode &= 2; mode &= 2;
} }
if (Integer.bitCount(mode) >= 3) { if (Integer.bitCount(mode) >= 3) {

Datei anzeigen

@ -25,23 +25,23 @@ public class WallMask extends AbstractMask {
double y = v.getY(); double y = v.getY();
double z = v.getZ(); double z = v.getZ();
v.mutX(x + 1); v.mutX(x + 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutX(x); v.mutX(x);
return true; return true;
} }
v.mutX(x - 1); v.mutX(x - 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutX(x); v.mutX(x);
return true; return true;
} }
v.mutX(x); v.mutX(x);
v.mutZ(z + 1); v.mutZ(z + 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutZ(z); v.mutZ(z);
return true; return true;
} }
v.mutZ(z - 1); v.mutZ(z - 1);
if (mask.test(v) && ++count == min && max >= 8) { if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
v.mutZ(z); v.mutZ(z);
return true; return true;
} }

Datei anzeigen

@ -15,7 +15,7 @@ import java.io.IOException;
public class NoXPattern extends AbstractPattern { public class NoXPattern extends AbstractPattern {
private final Pattern pattern; private final Pattern pattern;
private transient MutableBlockVector mutable = new MutableBlockVector(); // private transient MutableBlockVector mutable = new MutableBlockVector();
public NoXPattern(Pattern pattern) { public NoXPattern(Pattern pattern) {
this.pattern = pattern; this.pattern = pattern;
@ -23,20 +23,21 @@ public class NoXPattern extends AbstractPattern {
@Override @Override
public BlockStateHolder apply(BlockVector3 pos) { public BlockStateHolder apply(BlockVector3 pos) {
mutable.mutY((pos.getY())); // mutable.mutY((pos.getY()));
mutable.mutZ((pos.getZ())); // mutable.mutZ((pos.getZ()));
return pattern.apply(mutable); // return pattern.apply(mutable.toBlockVector3());
return pattern.apply(pos);
} }
@Override @Override
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException { public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
mutable.mutY((get.getY())); // mutable.mutY((get.getY()));
mutable.mutZ((get.getZ())); // mutable.mutZ((get.getZ()));
return pattern.apply(extent, set, mutable); return pattern.apply(extent, set, get);
} }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject(); stream.defaultReadObject();
mutable = new MutableBlockVector(); // mutable = new MutableBlockVector();
} }
} }

Datei anzeigen

@ -20,24 +20,24 @@ public class NoYPattern extends AbstractPattern {
this.pattern = pattern; this.pattern = pattern;
} }
private transient MutableBlockVector mutable = new MutableBlockVector(); // private transient MutableBlockVector mutable = new MutableBlockVector();
@Override @Override
public BlockStateHolder apply(BlockVector3 pos) { public BlockStateHolder apply(BlockVector3 pos) {
mutable.mutX((pos.getX())); // mutable.mutX((pos.getX()));
mutable.mutZ((pos.getZ())); // mutable.mutZ((pos.getZ()));
return pattern.apply(mutable); return pattern.apply(pos);
} }
@Override @Override
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException { public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
mutable.mutX((get.getX())); // mutable.mutX((get.getX()));
mutable.mutZ((get.getZ())); // mutable.mutZ((get.getZ()));
return pattern.apply(extent, set, mutable); return pattern.apply(extent, set, get);
} }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject(); stream.defaultReadObject();
mutable = new MutableBlockVector(); // mutable = new MutableBlockVector();
} }
} }

Datei anzeigen

@ -20,24 +20,24 @@ public class NoZPattern extends AbstractPattern {
this.pattern = pattern; this.pattern = pattern;
} }
private transient MutableBlockVector mutable = new MutableBlockVector(); // private transient MutableBlockVector mutable = new MutableBlockVector();
@Override @Override
public BlockStateHolder apply(BlockVector3 pos) { public BlockStateHolder apply(BlockVector3 pos) {
mutable.mutX((pos.getX())); // mutable.mutX((pos.getX()));
mutable.mutY((pos.getY())); // mutable.mutY((pos.getY()));
return pattern.apply(mutable); return pattern.apply(pos);
} }
@Override @Override
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException { public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
mutable.mutX((get.getX())); // mutable.mutX((get.getX()));
mutable.mutY((get.getY())); // mutable.mutY((get.getY()));
return pattern.apply(extent, set, mutable); return pattern.apply(extent, set, get);
} }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject(); stream.defaultReadObject();
mutable = new MutableBlockVector(); // mutable = new MutableBlockVector();
} }
} }

Datei anzeigen

@ -15,7 +15,7 @@ import java.io.IOException;
public class OffsetPattern extends AbstractPattern { public class OffsetPattern extends AbstractPattern {
private final int dx, dy, dz; private final int dx, dy, dz;
private transient MutableBlockVector mutable = new MutableBlockVector(); // private transient MutableBlockVector mutable = new MutableBlockVector();
private final Pattern pattern; private final Pattern pattern;
public OffsetPattern(Pattern pattern, int dx, int dy, int dz) { public OffsetPattern(Pattern pattern, int dx, int dy, int dz) {
@ -27,22 +27,24 @@ public class OffsetPattern extends AbstractPattern {
@Override @Override
public BlockStateHolder apply(BlockVector3 position) { public BlockStateHolder apply(BlockVector3 position) {
mutable.mutX((position.getX() + dx)); // mutable.mutX((position.getX() + dx));
mutable.mutY((position.getY() + dy)); // mutable.mutY((position.getY() + dy));
mutable.mutZ((position.getZ() + dz)); // mutable.mutZ((position.getZ() + dz));
return pattern.apply(mutable); // return pattern.apply(mutable);
return pattern.apply(new BlockVector3(position.getX() + dx, position.getY() + dy, position.getZ() + dz));
} }
@Override @Override
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException { public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
mutable.mutX((get.getX() + dx)); // mutable.mutX((get.getX() + dx));
mutable.mutY((get.getY() + dy)); // mutable.mutY((get.getY() + dy));
mutable.mutZ((get.getZ() + dz)); // mutable.mutZ((get.getZ() + dz));
return pattern.apply(extent, set, mutable); // return pattern.apply(extent, set, mutable);
return pattern.apply(extent, set, new BlockVector3(get.getX() + dx, get.getY() + dy, get.getZ() + dz));
} }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject(); stream.defaultReadObject();
mutable = new MutableBlockVector(); // mutable = new MutableBlockVector();
} }
} }

Datei anzeigen

@ -38,7 +38,7 @@ public class RandomOffsetPattern extends AbstractPattern {
mutable.mutX((position.getX() + r.nextInt(dx2) - dx)); mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
mutable.mutY((position.getY() + r.nextInt(dy2) - dy)); mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz)); mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
return pattern.apply(mutable); return pattern.apply(mutable.toBlockVector3());
} }
@Override @Override
@ -46,7 +46,7 @@ public class RandomOffsetPattern extends AbstractPattern {
mutable.mutX((get.getX() + r.nextInt(dx2) - dx)); mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
mutable.mutY((get.getY() + r.nextInt(dy2) - dy)); mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz)); mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
return pattern.apply(extent, set, mutable); return pattern.apply(extent, set, mutable.toBlockVector3());
} }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {

Datei anzeigen

@ -30,7 +30,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
mutable.mutX((pos.getX() - origin.getX())); mutable.mutX((pos.getX() - origin.getX()));
mutable.mutY((pos.getY() - origin.getY())); mutable.mutY((pos.getY() - origin.getY()));
mutable.mutZ((pos.getZ() - origin.getZ())); mutable.mutZ((pos.getZ() - origin.getZ()));
return pattern.apply(mutable); return pattern.apply(mutable.toBlockVector3());
} }
@Override @Override
@ -41,7 +41,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
mutable.mutX((get.getX() - origin.getX())); mutable.mutX((get.getX() - origin.getX()));
mutable.mutY((get.getY() - origin.getY())); mutable.mutY((get.getY() - origin.getY()));
mutable.mutZ((get.getZ() - origin.getZ())); mutable.mutZ((get.getZ() - origin.getZ()));
return pattern.apply(extent, set, mutable); return pattern.apply(extent, set, mutable.toBlockVector3());
} }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {

Datei anzeigen

@ -48,7 +48,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
mutable.mutX((position.getX() + r.nextInt(dx2) - dx)); mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
mutable.mutY((position.getY() + r.nextInt(dy2) - dy)); mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz)); mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
BlockStateHolder block = pattern.apply(mutable); BlockStateHolder block = pattern.apply(mutable.toBlockVector3());
if (solid[block.getInternalBlockTypeId()]) { if (solid[block.getInternalBlockTypeId()]) {
return block; return block;
} else { } else {
@ -61,9 +61,9 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
mutable.mutX((get.getX() + r.nextInt(dx2) - dx)); mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
mutable.mutY((get.getY() + r.nextInt(dy2) - dy)); mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz)); mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
BlockStateHolder block = pattern.apply(mutable); BlockStateHolder block = pattern.apply(mutable.toBlockVector3());
if (solid[block.getInternalBlockTypeId()]) { if (solid[block.getInternalBlockTypeId()]) {
return pattern.apply(extent, set, mutable); return pattern.apply(extent, set, mutable.toBlockVector3());
} else { } else {
return pattern.apply(extent, set, get); return pattern.apply(extent, set, get);
} }

Datei anzeigen

@ -50,22 +50,22 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
next = buffer[i]; next = buffer[i];
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i]; BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
next.setComponents(cur.getBlockX() + dir.getBlockX(), cur.getBlockY() + dir.getBlockY(), cur.getBlockZ() + dir.getBlockZ()); next.setComponents(cur.getBlockX() + dir.getBlockX(), cur.getBlockY() + dir.getBlockY(), cur.getBlockZ() + dir.getBlockZ());
if (allowed(next)) { if (allowed(next.toBlockVector3())) {
allowed[index++] = next; allowed[index++] = next;
} }
} }
if (index == 0) { if (index == 0) {
return cur; return cur.toBlockVector3();
} }
next = allowed[PseudoRandom.random.nextInt(index)]; next = allowed[PseudoRandom.random.nextInt(index)];
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ()); cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
} }
return cur; return cur.toBlockVector3();
} }
private boolean allowed(BlockVector3 bv) { private boolean allowed(BlockVector3 bv) {
MutableBlockVector v = new MutableBlockVector(bv); MutableBlockVector v = new MutableBlockVector(bv);
BlockStateHolder block = pattern.apply(v); BlockStateHolder block = pattern.apply(bv);
if (!block.getBlockType().getMaterial().isMovementBlocker()) { if (!block.getBlockType().getMaterial().isMovementBlocker()) {
return false; return false;
} }
@ -73,34 +73,34 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
int y = v.getBlockY(); int y = v.getBlockY();
int z = v.getBlockZ(); int z = v.getBlockZ();
v.mutY(y + 1); v.mutY(y + 1);
if (canPassthrough(v)) { if (canPassthrough(v.toBlockVector3())) {
v.mutY(y); v.mutY(y);
return true; return true;
} }
v.mutY(y - 1); v.mutY(y - 1);
if (canPassthrough(v)) { if (canPassthrough(v.toBlockVector3())) {
v.mutY(y); v.mutY(y);
return true; return true;
} }
v.mutY(y); v.mutY(y);
v.mutX(x + 1); v.mutX(x + 1);
if (canPassthrough(v)) { if (canPassthrough(v.toBlockVector3())) {
v.mutX(x); v.mutX(x);
return true; return true;
} }
v.mutX(x - 1); v.mutX(x - 1);
if (canPassthrough(v)) { if (canPassthrough(v.toBlockVector3())) {
v.mutX(x); v.mutX(x);
return true; return true;
} }
v.mutX(x); v.mutX(x);
v.mutZ(z + 1); v.mutZ(z + 1);
if (canPassthrough(v)) { if (canPassthrough(v.toBlockVector3())) {
v.mutZ(z); v.mutZ(z);
return true; return true;
} }
v.mutZ(z - 1); v.mutZ(z - 1);
if (canPassthrough(v)) { if (canPassthrough(v.toBlockVector3())) {
v.mutZ(z); v.mutZ(z);
return true; return true;
} }

Datei anzeigen

@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class FaweQueueDelegateExtent extends DelegateFaweQueue { public class FaweQueueDelegateExtent extends DelegateFaweQueue {
private final FaweQueue parentQueue; private final FaweQueue parentQueue;
private final Extent parentExtent; private final Extent parentExtent;
private final MutableBlockVector2D mutable2d = new MutableBlockVector2D(); // private final MutableBlockVector2D mutable2d = new MutableBlockVector2D();
public FaweQueueDelegateExtent(FaweQueue parentQueue, Extent parentExtent) { public FaweQueueDelegateExtent(FaweQueue parentQueue, Extent parentExtent) {
super(parentQueue); super(parentQueue);
@ -58,7 +58,7 @@ public class FaweQueueDelegateExtent extends DelegateFaweQueue {
@Override @Override
public int getBiomeId(int x, int z) throws FaweException.FaweChunkLoadException { public int getBiomeId(int x, int z) throws FaweException.FaweChunkLoadException {
return parentExtent.getBiome(mutable2d.setComponents(x, z)).getId(); return parentExtent.getBiome(new BlockVector2(x, z)).getId();
} }
@Override @Override

Datei anzeigen

@ -19,8 +19,10 @@
package com.boydti.fawe.object.regions; package com.boydti.fawe.object.regions;
import com.sk89q.worldedit.MutableBlockVector; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.regions.polyhedron.Edge; import com.sk89q.worldedit.regions.polyhedron.Edge;
@ -36,7 +38,7 @@ public class PolyhedralRegion extends AbstractRegion {
/** /**
* Vertices that are contained in the convex hull. * Vertices that are contained in the convex hull.
*/ */
private final Set<Vector> vertices = new LinkedHashSet<Vector>(); private final Set<BlockVector3> vertices = new LinkedHashSet<BlockVector3>();
/** /**
* Triangles that form the convex hull. * Triangles that form the convex hull.
@ -46,22 +48,22 @@ public class PolyhedralRegion extends AbstractRegion {
/** /**
* Vertices that are coplanar to the first 3 vertices. * Vertices that are coplanar to the first 3 vertices.
*/ */
private final Set<Vector> vertexBacklog = new LinkedHashSet<Vector>(); private final Set<BlockVector3> vertexBacklog = new LinkedHashSet<BlockVector3>();
/** /**
* Minimum point of the axis-aligned bounding box. * Minimum point of the axis-aligned bounding box.
*/ */
private Vector minimumPoint; private BlockVector3 minimumPoint;
/** /**
* Maximum point of the axis-aligned bounding box. * Maximum point of the axis-aligned bounding box.
*/ */
private Vector maximumPoint; private BlockVector3 maximumPoint;
/** /**
* Accumulator for the barycenter of the polyhedron. Divide by vertices.size() to get the actual center. * Accumulator for the barycenter of the polyhedron. Divide by vertices.size() to get the actual center.
*/ */
private Vector centerAccum = Vector.ZERO; private BlockVector3 centerAccum = BlockVector3.ZERO;
/** /**
* The last triangle that caused a {@link #contains(Vector)} to classify a point as "outside". Used for optimization. * The last triangle that caused a {@link #contains(Vector)} to classify a point as "outside". Used for optimization.
@ -104,7 +106,7 @@ public class PolyhedralRegion extends AbstractRegion {
minimumPoint = null; minimumPoint = null;
maximumPoint = null; maximumPoint = null;
centerAccum = Vector.ZERO; centerAccum = BlockVector3.ZERO;
lastTriangle = null; lastTriangle = null;
} }
@ -115,7 +117,7 @@ public class PolyhedralRegion extends AbstractRegion {
* @param vertex the vertex * @param vertex the vertex
* @return true, if something changed. * @return true, if something changed.
*/ */
public boolean addVertex(Vector vertex) { public boolean addVertex(BlockVector3 vertex) {
checkNotNull(vertex); checkNotNull(vertex);
lastTriangle = null; // Probably not necessary lastTriangle = null; // Probably not necessary
@ -141,8 +143,10 @@ public class PolyhedralRegion extends AbstractRegion {
if (minimumPoint == null) { if (minimumPoint == null) {
minimumPoint = maximumPoint = vertex; minimumPoint = maximumPoint = vertex;
} else { } else {
minimumPoint = new MutableBlockVector(Vector.getMinimum(minimumPoint, vertex)); // minimumPoint = new MutableBlockVector(minimumPoint.getMinimum(vertex));
maximumPoint = new MutableBlockVector(Vector.getMaximum(maximumPoint, vertex)); // maximumPoint = new MutableBlockVector(maximumPoint.getMaximum(vertex));
minimumPoint = minimumPoint.getMinimum(vertex);
maximumPoint = maximumPoint.getMaximum(vertex);
} }
int size = vertices.size(); int size = vertices.size();
@ -155,7 +159,7 @@ public class PolyhedralRegion extends AbstractRegion {
case 3: case 3:
// Generate minimal mesh to start from // Generate minimal mesh to start from
final Vector[] v = vertices.toArray(new Vector[vertices.size()]); final BlockVector3[] v = vertices.toArray(new BlockVector3[vertices.size()]);
triangles.add((new Triangle(v[0], v[size - 2], v[size - 1]))); triangles.add((new Triangle(v[0], v[size - 2], v[size - 1])));
triangles.add((new Triangle(v[0], v[size - 1], v[size - 2]))); triangles.add((new Triangle(v[0], v[size - 1], v[size - 2])));
@ -186,8 +190,8 @@ public class PolyhedralRegion extends AbstractRegion {
// Add triangles between the remembered edges and the new vertex. // Add triangles between the remembered edges and the new vertex.
for (Edge edge : borderEdges) { for (Edge edge : borderEdges) {
com.sk89q.worldedit.regions.polyhedron.Triangle triangle = edge.createTriangle(vertex); com.sk89q.worldedit.regions.polyhedron.Triangle triangle = edge.createTriangle(vertex.toVector3());
Triangle fTria = new Triangle(triangle.getVertex(0), triangle.getVertex(1), triangle.getVertex(2)); Triangle fTria = new Triangle(triangle.getVertex(0).toBlockPoint(), triangle.getVertex(1).toBlockPoint(), triangle.getVertex(2).toBlockPoint());
triangles.add(fTria); triangles.add(fTria);
} }
@ -196,9 +200,9 @@ public class PolyhedralRegion extends AbstractRegion {
vertices.remove(vertex); vertices.remove(vertex);
// Clone, clear and work through the backlog // Clone, clear and work through the backlog
final List<Vector> vertexBacklog2 = new ArrayList<Vector>(vertexBacklog); final List<BlockVector3> vertexBacklog2 = new ArrayList<BlockVector3>(vertexBacklog);
vertexBacklog.clear(); vertexBacklog.clear();
for (Vector vertex2 : vertexBacklog2) { for (BlockVector3 vertex2 : vertexBacklog2) {
addVertex(vertex2); addVertex(vertex2);
} }
@ -213,39 +217,39 @@ public class PolyhedralRegion extends AbstractRegion {
} }
@Override @Override
public Vector getMinimumPoint() { public BlockVector3 getMinimumPoint() {
return minimumPoint; return minimumPoint;
} }
@Override @Override
public Vector getMaximumPoint() { public BlockVector3 getMaximumPoint() {
return maximumPoint; return maximumPoint;
} }
@Override @Override
public Vector getCenter() { public Vector3 getCenter() {
return centerAccum.divide(vertices.size()); return centerAccum.divide(vertices.size()).toVector3();
} }
@Override @Override
public void expand(Vector... changes) throws RegionOperationException { public void expand(BlockVector3... changes) throws RegionOperationException {
} }
@Override @Override
public void contract(Vector... changes) throws RegionOperationException { public void contract(BlockVector3... changes) throws RegionOperationException {
} }
@Override @Override
public void shift(Vector change) throws RegionOperationException { public void shift(BlockVector3 change) throws RegionOperationException {
shiftCollection(vertices, change); shiftCollection(vertices, change);
shiftCollection(vertexBacklog, change); shiftCollection(vertexBacklog, change);
for (int i = 0; i < triangles.size(); ++i) { for (int i = 0; i < triangles.size(); ++i) {
final Triangle triangle = triangles.get(i); final Triangle triangle = triangles.get(i);
final Vector v0 = change.add(triangle.getVertex(0)); final BlockVector3 v0 = change.add(triangle.getVertex(0).toBlockPoint());
final Vector v1 = change.add(triangle.getVertex(1)); final BlockVector3 v1 = change.add(triangle.getVertex(1).toBlockPoint());
final Vector v2 = change.add(triangle.getVertex(2)); final BlockVector3 v2 = change.add(triangle.getVertex(2).toBlockPoint());
triangles.set(i, new Triangle(v0, v1, v2)); triangles.set(i, new Triangle(v0, v1, v2));
} }
@ -256,24 +260,24 @@ public class PolyhedralRegion extends AbstractRegion {
lastTriangle = null; lastTriangle = null;
} }
private static void shiftCollection(Collection<Vector> collection, Vector change) { private static void shiftCollection(Collection<BlockVector3> collection, BlockVector3 change) {
final List<Vector> tmp = new ArrayList<Vector>(collection); final List<BlockVector3> tmp = new ArrayList<BlockVector3>(collection);
collection.clear(); collection.clear();
for (Vector vertex : tmp) { for (BlockVector3 vertex : tmp) {
collection.add(change.add(vertex)); collection.add(change.add(vertex));
} }
} }
@Override @Override
public boolean contains(Vector position) { public boolean contains(BlockVector3 position) {
if (!isDefined()) { if (!isDefined()) {
return false; return false;
} }
final int x = position.getBlockX(); final int x = position.getBlockX();
final int y = position.getBlockY(); final int y = position.getBlockY();
final int z = position.getBlockZ(); final int z = position.getBlockZ();
final Vector min = getMinimumPoint(); final BlockVector3 min = getMinimumPoint();
final Vector max = getMaximumPoint(); final BlockVector3 max = getMaximumPoint();
if (x < min.getBlockX()) return false; if (x < min.getBlockX()) return false;
if (x > max.getBlockX()) return false; if (x > max.getBlockX()) return false;
if (z < min.getBlockZ()) return false; if (z < min.getBlockZ()) return false;
@ -283,7 +287,7 @@ public class PolyhedralRegion extends AbstractRegion {
return containsRaw(position); return containsRaw(position);
} }
private boolean containsRaw(Vector pt) { private boolean containsRaw(BlockVector3 pt) {
if (lastTriangle != null && lastTriangle.contains(pt)) { if (lastTriangle != null && lastTriangle.contains(pt)) {
return true; return true;
} }
@ -299,12 +303,12 @@ public class PolyhedralRegion extends AbstractRegion {
return false; return false;
} }
public Collection<Vector> getVertices() { public Collection<BlockVector3> getVertices() {
if (vertexBacklog.isEmpty()) { if (vertexBacklog.isEmpty()) {
return vertices; return vertices;
} }
final List<Vector> ret = new ArrayList<Vector>(vertices); final List<BlockVector3> ret = new ArrayList<BlockVector3>(vertices);
ret.addAll(vertexBacklog); ret.addAll(vertexBacklog);
return ret; return ret;

Datei anzeigen

@ -3,7 +3,8 @@ package com.boydti.fawe.object.regions;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.StringMan;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.polyhedron.Edge; import com.sk89q.worldedit.regions.polyhedron.Edge;
public class Triangle { public class Triangle {
@ -23,10 +24,10 @@ public class Triangle {
private final double[] vmin = new double[3]; private final double[] vmin = new double[3];
private final double[] vmax = new double[3]; private final double[] vmax = new double[3];
private final Vector normalVec; private final BlockVector3 normalVec;
private final double b; private final double b;
public Triangle(Vector pos1, Vector pos2, Vector pos3) { public Triangle(BlockVector3 pos1, BlockVector3 pos2, BlockVector3 pos3) {
verts[0] = new double[]{pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()}; verts[0] = new double[]{pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()};
verts[1] = new double[]{pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()}; verts[1] = new double[]{pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()};
verts[2] = new double[]{pos3.getBlockX(), pos3.getBlockY(), pos3.getBlockZ()}; verts[2] = new double[]{pos3.getBlockX(), pos3.getBlockY(), pos3.getBlockZ()};
@ -37,16 +38,16 @@ public class Triangle {
this.b = Math.max(Math.max(this.normalVec.dot(pos1), this.normalVec.dot(pos2)), this.normalVec.dot(pos3)); this.b = Math.max(Math.max(this.normalVec.dot(pos1), this.normalVec.dot(pos2)), this.normalVec.dot(pos3));
} }
public boolean above(Vector pt) { public boolean above(BlockVector3 pt) {
Preconditions.checkNotNull(pt); Preconditions.checkNotNull(pt);
return this.normalVec.dot(pt) > this.b; return this.normalVec.dot(pt) > this.b;
} }
public Edge getEdge(int index) { public Edge getEdge(int index) {
if (index == this.verts.length - 1) { if (index == this.verts.length - 1) {
return new Edge(new Vector(this.verts[index]), new Vector(this.verts[0])); return new Edge(new Vector3(this.verts[index][0], this.verts[index][1],this.verts[index][2]), new Vector3(this.verts[0][0], this.verts[0][1], this.verts[0][2]));
} else { } else {
return new Edge(new Vector(this.verts[index]), new Vector(this.verts[index + 1])); return new Edge(new Vector3(this.verts[index][0], this.verts[index][1],this.verts[index][2]), new Vector3(this.verts[index + 1][0], this.verts[index + 1][1], this.verts[index + 1][2]));
} }
} }
@ -55,11 +56,11 @@ public class Triangle {
return StringMan.getString(verts); return StringMan.getString(verts);
} }
public Vector getVertex(int index) { public Vector3 getVertex(int index) {
return new Vector(verts[index]); return new Vector3(verts[index][0], verts[index][1], verts[index][2]);
} }
public boolean contains(Vector pos) { public boolean contains(BlockVector3 pos) {
center[0] = pos.getBlockX() + RADIUS; center[0] = pos.getBlockX() + RADIUS;
center[1] = pos.getBlockY() + RADIUS; center[1] = pos.getBlockY() + RADIUS;
center[2] = pos.getBlockZ() + RADIUS; center[2] = pos.getBlockZ() + RADIUS;

Datei anzeigen

@ -6,15 +6,14 @@ import com.boydti.fawe.object.regions.FuzzyRegion;
import com.boydti.fawe.util.EditSessionBuilder; import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.ExtentTraverser; import com.boydti.fawe.util.ExtentTraverser;
import com.boydti.fawe.util.MaskTraverser; import com.boydti.fawe.util.MaskTraverser;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
@ -27,7 +26,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
private final Player player; private final Player player;
private FuzzyRegion region; private FuzzyRegion region;
private ArrayList<Vector> positions; private ArrayList<BlockVector3> positions;
public FuzzyRegionSelector(Player player, @Nullable World world, Mask mask) { public FuzzyRegionSelector(Player player, @Nullable World world, Mask mask) {
super(new EditSessionBuilder(world) super(new EditSessionBuilder(world)
@ -43,7 +42,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
} }
@Override @Override
public List<Vector> getVerticies() { public List<BlockVector3> getVerticies() {
return positions; return positions;
} }
@ -72,7 +71,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
} }
@Override @Override
public boolean selectPrimary(Vector position, SelectorLimits limits) { public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
setWorld(getWorld()); setWorld(getWorld());
new MaskTraverser(getMask()).reset(getExtent()); new MaskTraverser(getMask()).reset(getExtent());
positions.clear(); positions.clear();
@ -83,7 +82,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
} }
@Override @Override
public boolean selectSecondary(Vector position, SelectorLimits limits) { public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
this.positions.add(position); this.positions.add(position);
new MaskTraverser(getMask()).reset(getExtent()); new MaskTraverser(getMask()).reset(getExtent());
this.region.select(position.getBlockX(), position.getBlockY(), position.getBlockZ()); this.region.select(position.getBlockX(), position.getBlockY(), position.getBlockZ());
@ -91,13 +90,13 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
} }
@Override @Override
public void explainPrimarySelection(Actor actor, LocalSession session, Vector position) { public void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position) {
int size = this.region.getArea(); int size = this.region.getArea();
BBC.SELECTOR_FUZZY_POS1.send(player, position, "(" + region.getArea() + ")"); BBC.SELECTOR_FUZZY_POS1.send(player, position, "(" + region.getArea() + ")");
} }
@Override @Override
public void explainSecondarySelection(Actor actor, LocalSession session, Vector position) { public void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position) {
int size = this.region.getArea(); int size = this.region.getArea();
BBC.SELECTOR_FUZZY_POS2.send(player, position, "(" + region.getArea() + ")"); BBC.SELECTOR_FUZZY_POS2.send(player, position, "(" + region.getArea() + ")");
} }
@ -108,11 +107,11 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
} }
@Override @Override
public BlockVector getPrimaryPosition() throws IncompleteRegionException { public BlockVector3 getPrimaryPosition() throws IncompleteRegionException {
if (positions.isEmpty()) { if (positions.isEmpty()) {
throw new IncompleteRegionException(); throw new IncompleteRegionException();
} }
return new BlockVector(positions.get(0)); return positions.get(0);
} }
@Override @Override

Datei anzeigen

@ -21,14 +21,13 @@ package com.boydti.fawe.object.regions.selector;
import com.boydti.fawe.object.regions.PolyhedralRegion; import com.boydti.fawe.object.regions.PolyhedralRegion;
import com.boydti.fawe.object.regions.Triangle; import com.boydti.fawe.object.regions.Triangle;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent; import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
@ -46,7 +45,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class PolyhedralRegionSelector implements RegionSelector, CUIRegion { public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
private final transient PolyhedralRegion region; private final transient PolyhedralRegion region;
private transient BlockVector pos1; private transient BlockVector3 pos1;
/** /**
* Create a new selector with a {@code null} world. * Create a new selector with a {@code null} world.
@ -65,7 +64,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
} }
@Override @Override
public List<Vector> getVerticies() { public List<BlockVector3> getVerticies() {
return new ArrayList<>(region.getVertices()); return new ArrayList<>(region.getVertices());
} }
@ -81,15 +80,15 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
} }
@Override @Override
public boolean selectPrimary(Vector position, SelectorLimits limits) { public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
checkNotNull(position); checkNotNull(position);
clear(); clear();
pos1 = position.toBlockVector(); pos1 = position;
return region.addVertex(position); return region.addVertex(position);
} }
@Override @Override
public boolean selectSecondary(Vector position, SelectorLimits limits) { public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
checkNotNull(position); checkNotNull(position);
Optional<Integer> vertexLimit = limits.getPolyhedronVertexLimit(); Optional<Integer> vertexLimit = limits.getPolyhedronVertexLimit();
@ -102,7 +101,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
} }
@Override @Override
public BlockVector getPrimaryPosition() throws IncompleteRegionException { public BlockVector3 getPrimaryPosition() throws IncompleteRegionException {
return pos1; return pos1;
} }
@ -132,7 +131,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
@Override @Override
public void learnChanges() { public void learnChanges() {
pos1 = region.getVertices().iterator().next().toBlockVector(); pos1 = region.getVertices().iterator().next();
} }
@Override @Override
@ -157,7 +156,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
@Override @Override
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) {
checkNotNull(player); checkNotNull(player);
checkNotNull(session); checkNotNull(session);
checkNotNull(pos); checkNotNull(pos);
@ -168,7 +167,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
} }
@Override @Override
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) {
checkNotNull(player); checkNotNull(player);
checkNotNull(session); checkNotNull(session);
checkNotNull(pos); checkNotNull(pos);
@ -200,12 +199,12 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
checkNotNull(player); checkNotNull(player);
checkNotNull(session); checkNotNull(session);
Collection<Vector> vertices = region.getVertices(); Collection<BlockVector3> vertices = region.getVertices();
Collection<Triangle> triangles = region.getTriangles(); Collection<Triangle> triangles = region.getTriangles();
Map<Vector, Integer> vertexIds = new HashMap<Vector, Integer>(vertices.size()); Map<BlockVector3, Integer> vertexIds = new HashMap<BlockVector3, Integer>(vertices.size());
int lastVertexId = -1; int lastVertexId = -1;
for (Vector vertex : vertices) { for (BlockVector3 vertex : vertices) {
vertexIds.put(vertex, ++lastVertexId); vertexIds.put(vertex, ++lastVertexId);
session.dispatchCUIEvent(player, new SelectionPointEvent(lastVertexId, vertex, getArea())); session.dispatchCUIEvent(player, new SelectionPointEvent(lastVertexId, vertex, getArea()));
} }

Datei anzeigen

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

Datei anzeigen

@ -22,6 +22,7 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2D; import com.sk89q.worldedit.math.MutableBlockVector2D;
import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.math.transform.Transform;
@ -220,7 +221,7 @@ public class Schematic {
int zz = z + relz; int zz = z + relz;
if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) { if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) {
mpos2d.setComponents(xx, zz); mpos2d.setComponents(xx, zz);
extent.setBiome(mpos2d, bac.IMP.getBiome(x, z)); extent.setBiome(mpos2d.toBlockVector2(), bac.IMP.getBiome(x, z));
} }
if (!pasteAir && block.getBlockType().getMaterial().isAir()) { if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
return; return;
@ -245,7 +246,7 @@ public class Schematic {
final int rely = to.getBlockY() - origin.getBlockY(); final int rely = to.getBlockY() - origin.getBlockY();
final int relz = to.getBlockZ() - origin.getBlockZ(); final int relz = to.getBlockZ() - origin.getBlockZ();
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() { RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D(); // MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D();
MutableBlockVector2D mpos2d = new MutableBlockVector2D(); MutableBlockVector2D mpos2d = new MutableBlockVector2D();
{ {
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE); mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
@ -257,7 +258,8 @@ public class Schematic {
int zz = mutable.getBlockZ() + relz; int zz = mutable.getBlockZ() + relz;
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) { if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
mpos2d.setComponents(xx, zz); mpos2d.setComponents(xx, zz);
extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ()))); // extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ())));
extent.setBiome(mpos2d.toBlockVector2(), clipboard.getBiome(new BlockVector2(mutable.getBlockX(), mutable.getBlockZ())));
} }
if (!pasteAir && block.getBlockType().getMaterial().isAir()) { if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
return false; return false;

Datei anzeigen

@ -13,8 +13,6 @@ import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.jnbt.NamedTag; import com.sk89q.jnbt.NamedTag;
import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag; import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.MutableBlockVector;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
@ -23,6 +21,8 @@ import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.AbstractProperty;
@ -77,8 +77,8 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
int length = size.getInt(2); int length = size.getInt(2);
// Init clipboard // Init clipboard
Vector origin = new Vector(0, 0, 0); BlockVector3 origin = new BlockVector3(0, 0, 0);
CuboidRegion region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE)); CuboidRegion region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, clipboardId); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, clipboardId);
// Blocks // Blocks
ListTag blocks = (ListTag) tags.get("blocks"); ListTag blocks = (ListTag) tags.get("blocks");
@ -175,7 +175,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
// Palette // Palette
{ {
ArrayList<HashMap<String, Object>> palette = new ArrayList<>(); ArrayList<HashMap<String, Object>> palette = new ArrayList<>();
for (Vector point : region) { for (BlockVector3 point : region) {
BlockStateHolder block = clipboard.getBlock(point); BlockStateHolder block = clipboard.getBlock(point);
int combined = block.getInternalId(); int combined = block.getInternalId();
BlockTypes type = block.getBlockType(); BlockTypes type = block.getBlockType();
@ -215,8 +215,8 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
// Blocks // Blocks
{ {
ArrayList<Map<String, Object>> blocks = new ArrayList<>(); ArrayList<Map<String, Object>> blocks = new ArrayList<>();
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
for (Vector point : region) { for (BlockVector3 point : region) {
BlockStateHolder block = clipboard.getBlock(point); BlockStateHolder block = clipboard.getBlock(point);
switch (block.getBlockType()) { switch (block.getBlockType()) {
case STRUCTURE_VOID: case STRUCTURE_VOID:
@ -272,7 +272,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
} }
} }
private Tag writeVector(Vector vector, String name) { private Tag writeVector(BlockVector3 vector, String name) {
List<DoubleTag> list = new ArrayList<DoubleTag>(); List<DoubleTag> list = new ArrayList<DoubleTag>();
list.add(new DoubleTag(vector.getX())); list.add(new DoubleTag(vector.getX()));
list.add(new DoubleTag(vector.getY())); list.add(new DoubleTag(vector.getY()));

Datei anzeigen

@ -18,16 +18,20 @@ import com.google.common.io.Files;
import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.platform.InputType; import com.sk89q.worldedit.event.platform.InputType;
import com.sk89q.worldedit.event.platform.PlayerInputEvent; import com.sk89q.worldedit.event.platform.PlayerInputEvent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; 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.Vector3;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock; import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@ -53,8 +57,8 @@ public class SchemVis extends ImmutableVirtualWorld {
private final MutableBlockVector2D lastPos = new MutableBlockVector2D(); private final MutableBlockVector2D lastPos = new MutableBlockVector2D();
private final FawePlayer player; private final FawePlayer player;
private final Location origin; private final Location origin;
private final BlockVector2D chunkOffset; private final BlockVector2 chunkOffset;
private BlockVector2D lastPosition; private BlockVector2 lastPosition;
public static SchemVis create(FawePlayer player, Collection<File> files) throws IOException { public static SchemVis create(FawePlayer player, Collection<File> files) throws IOException {
checkNotNull(player); checkNotNull(player);
@ -76,12 +80,12 @@ public class SchemVis extends ImmutableVirtualWorld {
// Set the origin to somewhere around where the player currently is // Set the origin to somewhere around where the player currently is
FaweLocation pos = player.getLocation(); FaweLocation pos = player.getLocation();
this.origin = player.getPlayer().getLocation(); this.origin = player.getPlayer().getLocation();
this.chunkOffset = new BlockVector2D(pos.x >> 4,pos.z >> 4); this.chunkOffset = new BlockVector2(pos.x >> 4,pos.z >> 4);
} }
private Set<File> getFiles(BlockVector2D chunkPosA, BlockVector2D chunkPosB) { private Set<File> getFiles(BlockVector2 chunkPosA, BlockVector2 chunkPosB) {
BlockVector2D pos1 = new BlockVector2D(Math.min(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.min(chunkPosA.getBlockZ(), chunkPosB.getBlockZ())); BlockVector2 pos1 = new BlockVector2(Math.min(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.min(chunkPosA.getBlockZ(), chunkPosB.getBlockZ()));
BlockVector2D pos2 = new BlockVector2D(Math.max(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.max(chunkPosA.getBlockZ(), chunkPosB.getBlockZ())); BlockVector2 pos2 = new BlockVector2(Math.max(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.max(chunkPosA.getBlockZ(), chunkPosB.getBlockZ()));
Set<File> contained = new HashSet<>(); Set<File> contained = new HashSet<>();
for (Long2ObjectMap.Entry<Map.Entry<File, Long>> entry : files.long2ObjectEntrySet()) { for (Long2ObjectMap.Entry<Map.Entry<File, Long>> entry : files.long2ObjectEntrySet()) {
long key = entry.getLongKey(); long key = entry.getLongKey();
@ -116,8 +120,8 @@ public class SchemVis extends ImmutableVirtualWorld {
LocalSession session = this.player.getSession(); LocalSession session = this.player.getSession();
synchronized (this) { synchronized (this) {
try { try {
BlockVector2D tmpLastPosition = lastPosition; BlockVector2 tmpLastPosition = lastPosition;
lastPosition = new BlockVector2D(chunkX, chunkZ); lastPosition = new BlockVector2(chunkX, chunkZ);
boolean sneaking = this.player.isSneaking(); boolean sneaking = this.player.isSneaking();
if (event.getInputType() == InputType.PRIMARY && !sneaking) { if (event.getInputType() == InputType.PRIMARY && !sneaking) {
@ -251,8 +255,8 @@ public class SchemVis extends ImmutableVirtualWorld {
* @return offset vector * @return offset vector
*/ */
@Override @Override
public Vector getOrigin() { public Vector3 getOrigin() {
return new BlockVector(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4); return new Vector3(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
} }
/** /**
@ -313,15 +317,15 @@ public class SchemVis extends ImmutableVirtualWorld {
* @param schemDimensions * @param schemDimensions
* @return * @return
*/ */
private BlockVector2D registerAndGetChunkOffset(BlockVector2D schemDimensions, File file) { private BlockVector2 registerAndGetChunkOffset(BlockVector2 schemDimensions, File file) {
int chunkX = schemDimensions.getBlockX() >> 4; int chunkX = schemDimensions.getBlockX() >> 4;
int chunkZ = schemDimensions.getBlockZ() >> 4; int chunkZ = schemDimensions.getBlockZ() >> 4;
MutableBlockVector2D pos2 = new MutableBlockVector2D(); MutableBlockVector2D pos2 = new MutableBlockVector2D();
MutableBlockVector2D curPos = lastPos; MutableBlockVector2D curPos = lastPos;
// Find next free position // Find next free position
while (!isAreaFree(curPos, pos2.setComponents(curPos.getBlockX() + chunkX, curPos.getBlockZ() + chunkZ))) { while (!isAreaFree(curPos.toBlockVector2(), pos2.setComponents(curPos.getBlockX() + chunkX, curPos.getBlockZ() + chunkZ).toBlockVector2())) {
// if (curPos == lastPos && !files.containsKey(MathMan.pairInt(curPos.getBlockX(), curPos.getBlockZ()))) { // if (curPos == lastPos && !files.containsKey(MathMan.pairInt(curPos.getBlockX(), curPos.getBlockZ()))) {
// curPos = new MutableBlockVector2D(); // curPos = new MutableBlockVector2();
// curPos.setComponents(lastPos.getBlockX(), lastPos.getBlockZ()); // curPos.setComponents(lastPos.getBlockX(), lastPos.getBlockZ());
// } // }
curPos.nextPosition(); curPos.nextPosition();
@ -339,10 +343,10 @@ public class SchemVis extends ImmutableVirtualWorld {
} }
} }
for (int i = 0; i < Math.min(chunkX, chunkZ); i++) curPos.nextPosition(); for (int i = 0; i < Math.min(chunkX, chunkZ); i++) curPos.nextPosition();
return curPos.toBlockVector2D(); return curPos.toBlockVector2();
} }
private boolean isAreaFree(BlockVector2D chunkPos1, BlockVector2D chunkPos2 /* inclusive */) { private boolean isAreaFree(BlockVector2 chunkPos1, BlockVector2 chunkPos2 /* inclusive */) {
for (int x = chunkPos1.getBlockX(); x <= chunkPos2.getBlockX(); x++) { for (int x = chunkPos1.getBlockX(); x <= chunkPos2.getBlockX(); x++) {
for (int z = chunkPos1.getBlockZ(); z <= chunkPos2.getBlockZ(); z++) { for (int z = chunkPos1.getBlockZ(); z <= chunkPos2.getBlockZ(); z++) {
if (files.containsKey(MathMan.pairInt(x, z)) || (x == 0 && z == 0)) return false; if (files.containsKey(MathMan.pairInt(x, z)) || (x == 0 && z == 0)) return false;
@ -367,15 +371,15 @@ public class SchemVis extends ImmutableVirtualWorld {
if (dimensionPair != null) { if (dimensionPair != null) {
int width = (char) MathMan.unpairX(dimensionPair); int width = (char) MathMan.unpairX(dimensionPair);
int length = (char) MathMan.unpairY(dimensionPair); int length = (char) MathMan.unpairY(dimensionPair);
BlockVector2D dimensions = new BlockVector2D(width, length); BlockVector2 dimensions = new BlockVector2(width, length);
BlockVector2D offset = registerAndGetChunkOffset(dimensions, cached); BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
return; return;
} }
if (cached.exists() && file.lastModified() <= cached.lastModified()) { if (cached.exists() && file.lastModified() <= cached.lastModified()) {
try (InputStream fis = new BufferedInputStream(new FileInputStream(cached), 4)) { try (InputStream fis = new BufferedInputStream(new FileInputStream(cached), 4)) {
BlockVector2D dimensions = new BlockVector2D(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis)); BlockVector2 dimensions = new BlockVector2(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
DIMENSION_CACHE.put(file, MathMan.pair((short) dimensions.getBlockX(), (short) dimensions.getBlockZ())); DIMENSION_CACHE.put(file, MathMan.pair((short) dimensions.getBlockX(), (short) dimensions.getBlockZ()));
BlockVector2D offset = registerAndGetChunkOffset(dimensions, cached); BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
} }
} else { } else {
try { try {
@ -389,9 +393,9 @@ public class SchemVis extends ImmutableVirtualWorld {
clipboard.setOrigin(clipboard.getMinimumPoint()); clipboard.setOrigin(clipboard.getMinimumPoint());
try { try {
MCAQueue queue = new MCAQueue(null, null, false); MCAQueue queue = new MCAQueue(null, null, false);
BlockVector2D dimensions = clipboard.getDimensions().toVector2D().toBlockVector2D(); BlockVector2 dimensions = clipboard.getDimensions().toBlockVector2();
BlockVector2D offset = registerAndGetChunkOffset(dimensions, cached); BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
new Schematic(clipboard).paste(queue, Vector.ZERO, true); new Schematic(clipboard).paste(queue, BlockVector3.ZERO, true);
try (FileOutputStream fos = new FileOutputStream(cached)) { try (FileOutputStream fos = new FileOutputStream(cached)) {
IOUtil.writeVarInt(fos, dimensions.getBlockX()); IOUtil.writeVarInt(fos, dimensions.getBlockX());
IOUtil.writeVarInt(fos, dimensions.getBlockZ()); IOUtil.writeVarInt(fos, dimensions.getBlockZ());
@ -468,7 +472,7 @@ public class SchemVis extends ImmutableVirtualWorld {
int OCZ = MathMan.unpairIntY(origin); int OCZ = MathMan.unpairIntY(origin);
try { try {
try (FileInputStream fis = new FileInputStream(cached)) { try (FileInputStream fis = new FileInputStream(cached)) {
BlockVector2D dimensions = new BlockVector2D(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis)); BlockVector2 dimensions = new BlockVector2(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
try (FaweInputStream in = MainUtil.getCompressedIS(fis)) { try (FaweInputStream in = MainUtil.getCompressedIS(fis)) {
NonCloseableInputStream nonCloseable = new NonCloseableInputStream(in); NonCloseableInputStream nonCloseable = new NonCloseableInputStream(in);
try (NBTInputStream nis = new NBTInputStream(nonCloseable)) { try (NBTInputStream nis = new NBTInputStream(nonCloseable)) {
@ -616,4 +620,16 @@ public class SchemVis extends ImmutableVirtualWorld {
} }
} }
} }
@Override
public boolean playEffect(Vector3 position, int type, int data) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
// TODO Auto-generated method stub
return false;
}
} }

Datei anzeigen

@ -1,10 +1,11 @@
package com.boydti.fawe.object.visitor; package com.boydti.fawe.object.visitor;
import com.boydti.fawe.object.HasFaweQueue; import com.boydti.fawe.object.HasFaweQueue;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import java.util.Collection; import java.util.Collection;
@ -38,18 +39,18 @@ public class AboveVisitor extends RecursiveVisitor {
this.baseY = baseY; this.baseY = baseY;
Collection<Vector> directions = getDirections(); Collection<BlockVector3> directions = getDirections();
directions.clear(); directions.clear();
directions.add(new Vector(1, 0, 0)); directions.add(new BlockVector3(1, 0, 0));
directions.add(new Vector(-1, 0, 0)); directions.add(new BlockVector3(-1, 0, 0));
directions.add(new Vector(0, 0, 1)); directions.add(new BlockVector3(0, 0, 1));
directions.add(new Vector(0, 0, -1)); directions.add(new BlockVector3(0, 0, -1));
directions.add(new Vector(0, 1, 0)); directions.add(new BlockVector3(0, 1, 0));
directions.add(new Vector(0, -1, 0)); directions.add(new BlockVector3(0, -1, 0));
} }
@Override @Override
public boolean isVisitable(Vector from, Vector to) { public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
return (from.getBlockY() >= baseY) && super.isVisitable(from, to); return (from.getBlockY() >= baseY) && super.isVisitable(from, to);
} }
} }

Datei anzeigen

@ -77,8 +77,8 @@ public abstract class DFSVisitor implements Operation {
NodePair current; NodePair current;
Node from; Node from;
Node adjacent; Node adjacent;
MutableBlockVector mutable = new MutableBlockVector(); // MutableBlockVector mutable = new MutableBlockVector();
MutableBlockVector mutable2 = new MutableBlockVector(); // MutableBlockVector mutable2 = new MutableBlockVector();
int countAdd, countAttempt; int countAdd, countAttempt;
IntegerTrio[] dirs = getIntDirections(); IntegerTrio[] dirs = getIntDirections();
@ -89,18 +89,20 @@ public abstract class DFSVisitor implements Operation {
if (visited.containsKey(from)) { if (visited.containsKey(from)) {
continue; continue;
} }
mutable.mutX(from.getX()); // mutable.mutX(from.getX());
mutable.mutY(from.getY()); // mutable.mutY(from.getY());
mutable.mutZ(from.getZ()); // mutable.mutZ(from.getZ());
function.apply(mutable); BlockVector3 bv = new BlockVector3(from.getX(), from.getY(), from.getZ());
function.apply(bv);
countAdd = 0; countAdd = 0;
countAttempt = 0; countAttempt = 0;
for (IntegerTrio direction : dirs) { for (IntegerTrio direction : dirs) {
mutable2.mutX(from.getX() + direction.x); // mutable2.mutX(from.getX() + direction.x);
mutable2.mutY(from.getY() + direction.y); // mutable2.mutY(from.getY() + direction.y);
mutable2.mutZ(from.getZ() + direction.z); // mutable2.mutZ(from.getZ() + direction.z);
if (isVisitable(mutable, mutable2)) { BlockVector3 bv2 = new BlockVector3(from.getX() + direction.x, from.getY() + direction.y, from.getZ() + direction.z);
adjacent = new Node(mutable2.getBlockX(), mutable2.getBlockY(), mutable2.getBlockZ()); if (isVisitable(bv, bv2)) {
adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
if ((current.from == null || !adjacent.equals(current.from))) { if ((current.from == null || !adjacent.equals(current.from))) {
AtomicInteger adjacentCount = visited.get(adjacent); AtomicInteger adjacentCount = visited.get(adjacent);
if (adjacentCount == null) { if (adjacentCount == null) {

Datei anzeigen

@ -6,46 +6,47 @@ import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.HasFaweQueue; import com.boydti.fawe.object.HasFaweQueue;
import com.boydti.fawe.util.ExtentTraverser; import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class Fast2DIterator implements Iterable<Vector2D> { public class Fast2DIterator implements Iterable<BlockVector2> {
private final Iterable<? extends Vector2D> iterable; private final Iterable<? extends BlockVector2> iterable;
private final MappedFaweQueue queue; private final MappedFaweQueue queue;
public Fast2DIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable EditSession extent) { public Fast2DIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable EditSession extent) {
this(iter, (HasFaweQueue) extent); this(iter, (HasFaweQueue) extent);
} }
public Fast2DIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable Extent extent) { public Fast2DIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable Extent extent) {
this(iter, (HasFaweQueue) (extent != null ? (extent instanceof HasFaweQueue ? extent : new ExtentTraverser(extent).findAndGet(HasFaweQueue.class)) : null)); this(iter, (HasFaweQueue) (extent != null ? (extent instanceof HasFaweQueue ? extent : new ExtentTraverser(extent).findAndGet(HasFaweQueue.class)) : null));
} }
public Fast2DIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable HasFaweQueue editSession) { public Fast2DIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable HasFaweQueue editSession) {
this(iter, (FaweQueue) (editSession != null ? editSession.getQueue() : null)); this(iter, (FaweQueue) (editSession != null ? editSession.getQueue() : null));
} }
public Fast2DIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable FaweQueue faweQueue) { public Fast2DIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable FaweQueue faweQueue) {
this.iterable = iter; this.iterable = iter;
this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null; this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null;
} }
public Iterable<? extends Vector2D> getIterable() { public Iterable<? extends BlockVector2> getIterable() {
return iterable; return iterable;
} }
@Override @Override
public Iterator<Vector2D> iterator() { public Iterator<BlockVector2> iterator() {
if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) { if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) {
return (Iterator<Vector2D>) iterable.iterator(); return (Iterator<BlockVector2>) iterable.iterator();
} }
return new Iterator<Vector2D>() { return new Iterator<BlockVector2>() {
Iterator<? extends Vector2D> trailIter = iterable.iterator(); Iterator<? extends BlockVector2> trailIter = iterable.iterator();
Iterator<? extends Vector2D> leadIter = iterable.iterator(); Iterator<? extends BlockVector2> leadIter = iterable.iterator();
int lastTrailChunkX = Integer.MIN_VALUE; int lastTrailChunkX = Integer.MIN_VALUE;
int lastTrailChunkZ = Integer.MIN_VALUE; int lastTrailChunkZ = Integer.MIN_VALUE;
int lastLeadChunkX = Integer.MIN_VALUE; int lastLeadChunkX = Integer.MIN_VALUE;
@ -64,8 +65,8 @@ public class Fast2DIterator implements Iterable<Vector2D> {
} }
@Override @Override
public Vector2D next() { public BlockVector2 next() {
Vector2D pt = trailIter.next(); BlockVector2 pt = trailIter.next();
if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) { if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) {
if (leadIter.hasNext()) { if (leadIter.hasNext()) {
try { try {
@ -78,7 +79,7 @@ public class Fast2DIterator implements Iterable<Vector2D> {
amount = 1; amount = 1;
} }
for (int count = 0; count < amount; ) { for (int count = 0; count < amount; ) {
Vector2D v = leadIter.next(); BlockVector2 v = leadIter.next();
int vcx = v.getBlockX() >> 4; int vcx = v.getBlockX() >> 4;
int vcz = v.getBlockZ() >> 4; int vcz = v.getBlockZ() >> 4;
if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) { if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) {

Datei anzeigen

@ -6,54 +6,55 @@ import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.HasFaweQueue; import com.boydti.fawe.object.HasFaweQueue;
import com.boydti.fawe.util.ExtentTraverser; import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class FastChunkIterator implements Iterable<Vector2D> { public class FastChunkIterator implements Iterable<BlockVector2> {
private final Iterable<? extends Vector2D> iterable; private final Iterable<? extends BlockVector2> iterable;
private final MappedFaweQueue queue; private final MappedFaweQueue queue;
public FastChunkIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable EditSession extent) { public FastChunkIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable EditSession extent) {
this(iter, (HasFaweQueue) extent); this(iter, (HasFaweQueue) extent);
} }
public FastChunkIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable Extent extent) { public FastChunkIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable Extent extent) {
this(iter, (HasFaweQueue) (extent != null ? (extent instanceof HasFaweQueue ? extent : new ExtentTraverser(extent).findAndGet(HasFaweQueue.class)) : null)); this(iter, (HasFaweQueue) (extent != null ? (extent instanceof HasFaweQueue ? extent : new ExtentTraverser(extent).findAndGet(HasFaweQueue.class)) : null));
} }
public FastChunkIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable HasFaweQueue editSession) { public FastChunkIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable HasFaweQueue editSession) {
this(iter, (FaweQueue) (editSession != null ? editSession.getQueue() : null)); this(iter, (FaweQueue) (editSession != null ? editSession.getQueue() : null));
} }
public FastChunkIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable FaweQueue faweQueue) { public FastChunkIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable FaweQueue faweQueue) {
this.iterable = iter; this.iterable = iter;
this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null; this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null;
} }
public Iterable<? extends Vector2D> getIterable() { public Iterable<? extends BlockVector2> getIterable() {
return iterable; return iterable;
} }
@Override @Override
public Iterator<Vector2D> iterator() { public Iterator<BlockVector2> iterator() {
if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) { if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) {
return (Iterator<Vector2D>) iterable.iterator(); return (Iterator<BlockVector2>) iterable.iterator();
} }
final Iterator<? extends Vector2D> trailIter = iterable.iterator(); final Iterator<? extends BlockVector2> trailIter = iterable.iterator();
final Iterator<? extends Vector2D> leadIter = iterable.iterator(); final Iterator<? extends BlockVector2> leadIter = iterable.iterator();
int amount = Settings.IMP.QUEUE.PRELOAD_CHUNKS; int amount = Settings.IMP.QUEUE.PRELOAD_CHUNKS;
for (int i = 0; i < Settings.IMP.QUEUE.PRELOAD_CHUNKS && leadIter.hasNext(); i++) { for (int i = 0; i < Settings.IMP.QUEUE.PRELOAD_CHUNKS && leadIter.hasNext(); i++) {
Vector2D toLoad = leadIter.next(); BlockVector2 toLoad = leadIter.next();
queue.queueChunkLoad(toLoad.getBlockX(), toLoad.getBlockZ()); queue.queueChunkLoad(toLoad.getBlockX(), toLoad.getBlockZ());
} }
if (!leadIter.hasNext()) { if (!leadIter.hasNext()) {
return (Iterator<Vector2D>) trailIter; return (Iterator<BlockVector2>) trailIter;
} }
return new Iterator<Vector2D>() { return new Iterator<BlockVector2>() {
@Override @Override
public void remove() { public void remove() {
trailIter.remove(); trailIter.remove();
@ -65,9 +66,9 @@ public class FastChunkIterator implements Iterable<Vector2D> {
} }
@Override @Override
public Vector2D next() { public BlockVector2 next() {
if (leadIter.hasNext()) { if (leadIter.hasNext()) {
Vector2D toLoad = leadIter.next(); BlockVector2 toLoad = leadIter.next();
queue.queueChunkLoad(toLoad.getBlockX(), toLoad.getBlockZ()); queue.queueChunkLoad(toLoad.getBlockX(), toLoad.getBlockZ());
} }
return trailIter.next(); return trailIter.next();

Datei anzeigen

@ -6,46 +6,47 @@ import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.HasFaweQueue; import com.boydti.fawe.object.HasFaweQueue;
import com.boydti.fawe.util.ExtentTraverser; import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class FastIterator implements Iterable<Vector> { public class FastIterator implements Iterable<BlockVector3> {
private final Iterable<? extends Vector> iterable; private final Iterable<? extends BlockVector3> iterable;
private final MappedFaweQueue queue; private final MappedFaweQueue queue;
public FastIterator(@Nonnull Iterable<? extends Vector> iter, @Nullable EditSession extent) { public FastIterator(@Nonnull Iterable<? extends BlockVector3> iter, @Nullable EditSession extent) {
this(iter, (HasFaweQueue) extent); this(iter, (HasFaweQueue) extent);
} }
public FastIterator(@Nonnull Iterable<? extends Vector> iter, @Nullable Extent extent) { public FastIterator(@Nonnull Iterable<? extends BlockVector3> iter, @Nullable Extent extent) {
this(iter, (HasFaweQueue) (extent != null ? (extent instanceof HasFaweQueue ? extent : new ExtentTraverser(extent).findAndGet(HasFaweQueue.class)) : null)); this(iter, (HasFaweQueue) (extent != null ? (extent instanceof HasFaweQueue ? extent : new ExtentTraverser(extent).findAndGet(HasFaweQueue.class)) : null));
} }
public FastIterator(@Nonnull Iterable<? extends Vector> iter, @Nullable HasFaweQueue editSession) { public FastIterator(@Nonnull Iterable<? extends BlockVector3> iter, @Nullable HasFaweQueue editSession) {
this(iter, (FaweQueue) (editSession != null ? editSession.getQueue() : null)); this(iter, (FaweQueue) (editSession != null ? editSession.getQueue() : null));
} }
public FastIterator(@Nonnull Iterable<? extends Vector> iter, @Nullable FaweQueue faweQueue) { public FastIterator(@Nonnull Iterable<? extends BlockVector3> iter, @Nullable FaweQueue faweQueue) {
this.iterable = iter; this.iterable = iter;
this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null; this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null;
} }
public Iterable<? extends Vector> getIterable() { public Iterable<? extends BlockVector3> getIterable() {
return iterable; return iterable;
} }
@Override @Override
public Iterator<Vector> iterator() { public Iterator<BlockVector3> iterator() {
if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) { if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) {
return (Iterator<Vector>) iterable.iterator(); return (Iterator<BlockVector3>) iterable.iterator();
} }
return new Iterator<Vector>() { return new Iterator<BlockVector3>() {
Iterator<? extends Vector> trailIter = iterable.iterator(); Iterator<? extends BlockVector3> trailIter = iterable.iterator();
Iterator<? extends Vector> leadIter = iterable.iterator(); Iterator<? extends BlockVector3> leadIter = iterable.iterator();
int lastTrailChunkX = Integer.MIN_VALUE; int lastTrailChunkX = Integer.MIN_VALUE;
int lastTrailChunkZ = Integer.MIN_VALUE; int lastTrailChunkZ = Integer.MIN_VALUE;
int lastLeadChunkX = Integer.MIN_VALUE; int lastLeadChunkX = Integer.MIN_VALUE;
@ -64,8 +65,8 @@ public class FastIterator implements Iterable<Vector> {
} }
@Override @Override
public Vector next() { public BlockVector3 next() {
Vector pt = trailIter.next(); BlockVector3 pt = trailIter.next();
if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) { if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) {
if (leadIter.hasNext()) { if (leadIter.hasNext()) {
try { try {
@ -78,7 +79,7 @@ public class FastIterator implements Iterable<Vector> {
amount = 1; amount = 1;
} }
for (int count = 0; count < amount; ) { for (int count = 0; count < amount; ) {
Vector v = leadIter.next(); BlockVector3 v = leadIter.next();
int vcx = v.getBlockX() >> 4; int vcx = v.getBlockX() >> 4;
int vcz = v.getBlockZ() >> 4; int vcz = v.getBlockZ() >> 4;
if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) { if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) {

Datei anzeigen

@ -1,42 +1,42 @@
package com.boydti.fawe.regions; package com.boydti.fawe.regions;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
public abstract class SimpleRegion extends AbstractRegion { public abstract class SimpleRegion extends AbstractRegion {
private final Vector max; private final BlockVector3 max;
private final Vector min; private final BlockVector3 min;
public SimpleRegion(World world, Vector min, Vector max) { public SimpleRegion(World world, BlockVector3 min, BlockVector3 max) {
super(world); super(world);
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@Override @Override
public Vector getMinimumPoint() { public BlockVector3 getMinimumPoint() {
return min; return min;
} }
@Override @Override
public Vector getMaximumPoint() { public BlockVector3 getMaximumPoint() {
return max; return max;
} }
@Override @Override
public void expand(Vector... changes) throws RegionOperationException { public void expand(BlockVector3... changes) throws RegionOperationException {
throw new UnsupportedOperationException("Region is immutable"); throw new UnsupportedOperationException("Region is immutable");
} }
@Override @Override
public void contract(Vector... changes) throws RegionOperationException { public void contract(BlockVector3... changes) throws RegionOperationException {
throw new UnsupportedOperationException("Region is immutable"); throw new UnsupportedOperationException("Region is immutable");
} }
@Override @Override
public boolean contains(Vector p) { public boolean contains(BlockVector3 p) {
return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ()); return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ());
} }

Datei anzeigen

@ -8,9 +8,9 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ChunkManager;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
@ -50,8 +50,8 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) { synchronized (FaweChunkManager.class) {
EditSession sessionA = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build(); EditSession sessionA = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionB = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build(); EditSession sessionB = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion regionA = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ())); CuboidRegion regionA = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
CuboidRegion regionB = new CuboidRegion(new Vector(pos3.getX(), pos3.getY(), pos3.getZ()), new Vector(pos4.getX(), pos4.getY(), pos4.getZ())); CuboidRegion regionB = new CuboidRegion(new BlockVector3(pos3.getX(), pos3.getY(), pos3.getZ()), new BlockVector3(pos4.getX(), pos4.getY(), pos4.getZ()));
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint()); ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint());
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint()); ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
try { try {
@ -76,8 +76,8 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) { synchronized (FaweChunkManager.class) {
EditSession from = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build(); EditSession from = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession to = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build(); EditSession to = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ())); CuboidRegion region = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, new Vector(pos3.getX(), pos3.getY(), pos3.getZ())); ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, new BlockVector3(pos3.getX(), pos3.getY(), pos3.getZ()));
try { try {
Operations.completeLegacy(copy); Operations.completeLegacy(copy);
to.flushQueue(); to.flushQueue();
@ -99,7 +99,7 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) { synchronized (FaweChunkManager.class) {
EditSession editSession = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build(); EditSession editSession = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
World world = editSession.getWorld(); World world = editSession.getWorld();
CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ())); CuboidRegion region = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
world.regenerate(region, editSession); world.regenerate(region, editSession);
editSession.flushQueue(); editSession.flushQueue();
TaskManager.IMP.task(whenDone); TaskManager.IMP.task(whenDone);

Datei anzeigen

@ -18,9 +18,9 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.block.LocalBlockQueue; import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -53,7 +53,7 @@ public class FaweSchematicHandler extends SchematicHandler {
Location[] corners = MainUtil.getCorners(world, regions); Location[] corners = MainUtil.getCorners(world, regions);
Location pos1 = corners[0]; Location pos1 = corners[0];
Location pos2 = corners[1]; Location pos2 = corners[1];
final CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ())); final CuboidRegion region = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
final EditSession editSession = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build(); final EditSession editSession = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
final int mx = pos1.getX(); final int mx = pos1.getX();

Datei anzeigen

@ -4,7 +4,8 @@ import com.boydti.fawe.regions.general.CuboidRegionFilter;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.math.BlockVector2;
import java.util.ArrayList; import java.util.ArrayList;
@ -23,7 +24,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
for (Plot plot : plots) { for (Plot plot : plots) {
Location pos1 = plot.getBottom(); Location pos1 = plot.getBottom();
Location pos2 = plot.getTop(); Location pos2 = plot.getTop();
add(new BlockVector2D(pos1.getX(), pos1.getZ()), new BlockVector2D(pos2.getX(), pos2.getZ())); add(new BlockVector2(pos1.getX(), pos1.getZ()), new BlockVector2(pos2.getX(), pos2.getZ()));
} }
} }
} }

Datei anzeigen

@ -21,9 +21,9 @@ import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.Command; import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.biome.Biomes;
@ -84,7 +84,7 @@ public class PlotSetBiome extends Command {
.build(); .build();
long seed = PseudoRandom.random.nextLong(); long seed = PseudoRandom.random.nextLong();
for (RegionWrapper region : regions) { for (RegionWrapper region : regions) {
CuboidRegion cuboid = new CuboidRegion(new Vector(region.minX, 0, region.minZ), new Vector(region.maxX, 256, region.maxZ)); CuboidRegion cuboid = new CuboidRegion(new BlockVector3(region.minX, 0, region.minZ), new BlockVector3(region.maxX, 256, region.maxZ));
session.regenerate(cuboid, biome, seed); session.regenerate(cuboid, biome, seed);
} }
session.flushQueue(); session.flushQueue();

Datei anzeigen

@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue; import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
import com.intellectualcrafters.plot.util.block.QueueProvider; import com.intellectualcrafters.plot.util.block.QueueProvider;
import com.plotsquared.listener.WEManager; import com.plotsquared.listener.WEManager;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import java.util.HashSet; import java.util.HashSet;
@ -125,8 +125,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
faweRegions.add(new com.boydti.fawe.object.RegionWrapper(current.minX, current.maxX, min, max, current.minZ, current.maxZ)); faweRegions.add(new com.boydti.fawe.object.RegionWrapper(current.minX, current.maxX, min, max, current.minZ, current.maxZ));
} }
final RegionWrapper region = regions.iterator().next(); final RegionWrapper region = regions.iterator().next();
final BlockVector pos1 = new BlockVector(region.minX, min, region.minZ); final BlockVector3 pos1 = new BlockVector3(region.minX, min, region.minZ);
final BlockVector pos2 = new BlockVector(region.maxX, max, region.maxZ); final BlockVector3 pos2 = new BlockVector3(region.maxX, max, region.maxZ);
final Plot finalPlot = plot; final Plot finalPlot = plot;
if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(finalPlot) || regions.isEmpty()) { if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(finalPlot) || regions.isEmpty()) {
return null; return null;

Datei anzeigen

@ -8,7 +8,6 @@ import com.boydti.fawe.util.image.ImageUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.util.command.binding.Text; import com.sk89q.worldedit.util.command.binding.Text;
@ -16,6 +15,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
@ -42,7 +42,7 @@ public class TextureUtil implements TextureHolder{
public static TextureUtil fromClipboard(Clipboard clipboard) throws FileNotFoundException { public static TextureUtil fromClipboard(Clipboard clipboard) throws FileNotFoundException {
boolean[] ids = new boolean[BlockTypes.size()]; boolean[] ids = new boolean[BlockTypes.size()];
for (com.sk89q.worldedit.Vector pt : clipboard.getRegion()) { for (BlockVector3 pt : clipboard.getRegion()) {
ids[clipboard.getBlock(pt).getInternalBlockTypeId()] = true; ids[clipboard.getBlock(pt).getInternalBlockTypeId()] = true;
} }
HashSet<BlockType> blocks = new HashSet<>(); HashSet<BlockType> blocks = new HashSet<>();
@ -65,7 +65,7 @@ public class TextureUtil implements TextureHolder{
for (int typeId : tu.getValidBlockIds()) { for (int typeId : tu.getValidBlockIds()) {
BlockType block = BlockTypes.get(typeId); BlockType block = BlockTypes.get(typeId);
pattern.setBlock(block.getDefaultState()); pattern.setBlock(block.getDefaultState());
if (mask.test(Vector.ZERO)) blocks.add(block); if (mask.test(BlockVector3.ZERO)) blocks.add(block);
} }
return fromBlocks(blocks); return fromBlocks(blocks);
} }

Datei anzeigen

@ -9,10 +9,10 @@ import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.NullExtent; import com.boydti.fawe.object.extent.NullExtent;
import com.boydti.fawe.regions.FaweMask; import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.FaweMaskManager; import com.boydti.fawe.regions.FaweMaskManager;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
@ -160,10 +160,10 @@ public class WEManager {
public boolean intersects(final Region region1, final Region region2) { public boolean intersects(final Region region1, final Region region2) {
Vector rg1P1 = region1.getMinimumPoint(); BlockVector3 rg1P1 = region1.getMinimumPoint();
Vector rg1P2 = region1.getMaximumPoint(); BlockVector3 rg1P2 = region1.getMaximumPoint();
Vector rg2P1 = region2.getMinimumPoint(); BlockVector3 rg2P1 = region2.getMinimumPoint();
Vector rg2P2 = region2.getMaximumPoint(); BlockVector3 rg2P2 = region2.getMaximumPoint();
return (rg1P1.getBlockX() <= rg2P2.getBlockX()) && (rg1P2.getBlockX() >= rg2P1.getBlockX()) && (rg1P1.getBlockZ() <= rg2P2.getBlockZ()) && (rg1P2.getBlockZ() >= rg2P1.getBlockZ()); return (rg1P1.getBlockX() <= rg2P2.getBlockX()) && (rg1P2.getBlockX() >= rg2P1.getBlockX()) && (rg1P1.getBlockZ() <= rg2P2.getBlockZ()) && (rg1P2.getBlockZ() >= rg2P1.getBlockZ());
} }

Datei anzeigen

@ -4,7 +4,6 @@ import com.boydti.fawe.Fawe;
import com.boydti.fawe.object.FaweLocation; import com.boydti.fawe.object.FaweLocation;
import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.FawePlayer;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -15,6 +14,8 @@ import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.extension.platform.*; import com.sk89q.worldedit.extension.platform.*;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
@ -166,11 +167,12 @@ public class FakePlayer extends AbstractPlayerActor {
} }
@Override @Override
public void setPosition(Vector pos, float pitch, float yaw) { public void setPosition(Vector3 pos, float pitch, float yaw) {
if (pos instanceof Location) { //TODO: find replacement for following code
Extent extent = ((Location) pos).getExtent(); // if (pos instanceof Location) {
if (extent instanceof World) this.world = (World) extent; // Extent extent = ((Location) pos).getExtent();
} // if (extent instanceof World) this.world = (World) extent;
// }
this.pos = new Location(world, pos, yaw, pitch); this.pos = new Location(world, pos, yaw, pitch);
} }

Datei anzeigen

@ -1,7 +1,7 @@
package com.boydti.fawe.wrappers; package com.boydti.fawe.wrappers;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
public class LocationMaskedPlayerWrapper extends PlayerWrapper { public class LocationMaskedPlayerWrapper extends PlayerWrapper {
@ -32,7 +32,7 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
} }
@Override @Override
public void setPosition(Vector pos, float pitch, float yaw) { public void setPosition(Vector3 pos, float pitch, float yaw) {
this.position = new Location(position.getExtent(), pos, pitch, yaw); this.position = new Location(position.getExtent(), pos, pitch, yaw);
if (allowTeleport) { if (allowTeleport) {
super.setPosition(pos, pitch, yaw); super.setPosition(pos, pitch, yaw);

Datei anzeigen

@ -16,6 +16,8 @@ import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
@ -90,7 +92,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
} }
@Override @Override
public void setPosition(Vector pos, float pitch, float yaw) { public void setPosition(Vector3 pos, float pitch, float yaw) {
parent.setPosition(pos, pitch, yaw); parent.setPosition(pos, pitch, yaw);
} }
@ -233,13 +235,13 @@ public class PlayerWrapper extends AbstractPlayerActor {
Extent world = getLocation().getExtent(); Extent world = getLocation().getExtent();
// No free space above // No free space above
if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isAir()) { if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir()) {
return false; return false;
} }
while (y <= world.getMaximumPoint().getY()) { while (y <= world.getMaximumPoint().getY()) {
// Found a ceiling! // Found a ceiling!
if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
int platformY = Math.max(initialY, y - 3 - clearance); int platformY = Math.max(initialY, y - 3 - clearance);
floatAt(x, platformY + 1, z, alwaysGlass); floatAt(x, platformY + 1, z, alwaysGlass);
return true; return true;
@ -267,7 +269,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
final Extent world = getLocation().getExtent(); final Extent world = getLocation().getExtent();
while (y <= world.getMaximumPoint().getY() + 2) { while (y <= world.getMaximumPoint().getY() + 2) {
if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
break; // Hit something break; // Hit something
} else if (y > maxY + 1) { } else if (y > maxY + 1) {
break; break;
@ -287,7 +289,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
RuntimeException caught = null; RuntimeException caught = null;
try { try {
EditSession edit = new EditSessionBuilder(parent.getWorld()).player(FawePlayer.wrap(this)).build(); EditSession edit = new EditSessionBuilder(parent.getWorld()).player(FawePlayer.wrap(this)).build();
edit.setBlock(new Vector(x, y - 1, z), BlockTypes.GLASS); edit.setBlock(new BlockVector3(x, y - 1, z), BlockTypes.GLASS);
edit.flushQueue(); edit.flushQueue();
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this); LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
if (session != null) { if (session != null) {
@ -299,7 +301,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
TaskManager.IMP.sync(new RunnableVal<Object>() { TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override @Override
public void run(Object value) { public void run(Object value) {
setPosition(new Vector(x + 0.5, y, z + 0.5)); setPosition(new Vector3(x + 0.5, y, z + 0.5));
} }
}); });
if (caught != null) { if (caught != null) {
@ -359,7 +361,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
boolean inFree = false; boolean inFree = false;
while ((block = hitBlox.getNextBlock()) != null) { while ((block = hitBlox.getNextBlock()) != null) {
boolean free = !world.getBlock(block.toVector()).getBlockType().getMaterial().isMovementBlocker(); boolean free = !world.getBlock(new BlockVector3(block.getBlockX(), block.getBlockY(), block.getBlockZ())).getBlockType().getMaterial().isMovementBlocker();
if (firstBlock) { if (firstBlock) {
firstBlock = false; firstBlock = false;

Datei anzeigen

@ -10,6 +10,9 @@ import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
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.Region;
import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
@ -59,12 +62,12 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public boolean useItem(Vector position, BaseItem item, Direction face) { public boolean useItem(BlockVector3 position, BaseItem item, Direction face) {
return parent.useItem(position, item, face); return parent.useItem(position, item, face);
} }
@Override @Override
public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
return parent.setBlock(position, block, notifyAndLight); return parent.setBlock(position, block, notifyAndLight);
} }
@ -79,12 +82,12 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public void dropItem(Vector pt, BaseItemStack item, int times) { public void dropItem(Vector3 pt, BaseItemStack item, int times) {
parent.dropItem(pt, item, times); parent.dropItem(pt, item, times);
} }
@Override @Override
public void simulateBlockMine(final Vector pt) { public void simulateBlockMine(final BlockVector3 pt) {
TaskManager.IMP.sync(new RunnableVal<Object>() { TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override @Override
public void run(Object value) { public void run(Object value) {
@ -94,7 +97,7 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException { public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException {
return TaskManager.IMP.sync((Supplier<Boolean>) () -> { return TaskManager.IMP.sync((Supplier<Boolean>) () -> {
try { try {
return parent.generateTree(type, editSession, position); return parent.generateTree(type, editSession, position);
@ -105,27 +108,27 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public void checkLoadedChunk(Vector pt) { public void checkLoadedChunk(BlockVector3 pt) {
parent.checkLoadedChunk(pt); parent.checkLoadedChunk(pt);
} }
@Override @Override
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) { public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
parent.fixAfterFastMode(chunks); parent.fixAfterFastMode(chunks);
} }
@Override @Override
public void fixLighting(Iterable<BlockVector2D> chunks) { public void fixLighting(Iterable<BlockVector2> chunks) {
parent.fixLighting(chunks); parent.fixLighting(chunks);
} }
@Override @Override
public boolean playEffect(Vector position, int type, int data) { public boolean playEffect(Vector3 position, int type, int data) {
return parent.playEffect(position, type, data); return parent.playEffect(position, type, data);
} }
@Override @Override
public boolean queueBlockBreakEffect(Platform server, Vector position, BlockType blockType, double priority) { public boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) {
return parent.queueBlockBreakEffect(server, position, blockType, priority); return parent.queueBlockBreakEffect(server, position, blockType, priority);
} }
@ -150,12 +153,12 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public Vector getMinimumPoint() { public BlockVector3 getMinimumPoint() {
return parent.getMinimumPoint(); return parent.getMinimumPoint();
} }
@Override @Override
public Vector getMaximumPoint() { public BlockVector3 getMaximumPoint() {
return parent.getMaximumPoint(); return parent.getMaximumPoint();
} }
@ -171,17 +174,17 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public int getBlockLightLevel(Vector position) { public int getBlockLightLevel(BlockVector3 position) {
return parent.getBlockLightLevel(position); return parent.getBlockLightLevel(position);
} }
@Override @Override
public boolean clearContainerBlockContents(Vector position) { public boolean clearContainerBlockContents(BlockVector3 position) {
return parent.clearContainerBlockContents(position); return parent.clearContainerBlockContents(position);
} }
@Override @Override
public void dropItem(Vector position, BaseItemStack item) { public void dropItem(Vector3 position, BaseItemStack item) {
parent.dropItem(position, item); parent.dropItem(position, item);
} }
@ -227,27 +230,27 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public BlockState getBlock(Vector position) { public BlockState getBlock(BlockVector3 position) {
return parent.getBlock(position); return parent.getBlock(position);
} }
@Override @Override
public BlockState getLazyBlock(Vector position) { public BlockState getLazyBlock(BlockVector3 position) {
return parent.getLazyBlock(position); return parent.getLazyBlock(position);
} }
@Override @Override
public BlockState getFullBlock(Vector position) { public BlockState getFullBlock(BlockVector3 position) {
return parent.getFullBlock(position); return parent.getFullBlock(position);
} }
@Override @Override
public BaseBiome getBiome(Vector2D position) { public BaseBiome getBiome(BlockVector2 position) {
return parent.getBiome(position); return parent.getBiome(position);
} }
@Override @Override
public boolean setBiome(Vector2D position, BaseBiome biome) { public boolean setBiome(BlockVector2 position, BaseBiome biome) {
return parent.setBiome(position, biome); return parent.setBiome(position, biome);
} }
} }

Datei anzeigen

@ -31,6 +31,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -85,18 +86,18 @@ public class CuboidClipboard {
private BlockArrayClipboard clipboard; private BlockArrayClipboard clipboard;
private AffineTransform transform; private AffineTransform transform;
public Vector size; public BlockVector3 size;
/** /**
* Constructs the clipboard. * Constructs the clipboard.
* *
* @param size the dimensions of the clipboard (should be at least 1 on every dimension) * @param size the dimensions of the clipboard (should be at least 1 on every dimension)
*/ */
public CuboidClipboard(Vector size) { public CuboidClipboard(BlockVector3 size) {
checkNotNull(size); checkNotNull(size);
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class); MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
this.size = size; this.size = size;
this.clipboard = this.init(Vector.ZERO, Vector.ZERO); this.clipboard = this.init(BlockVector3.ZERO, BlockVector3.ZERO);
} }
public CuboidClipboard(BlockArrayClipboard clipboard) { public CuboidClipboard(BlockArrayClipboard clipboard) {
@ -111,12 +112,12 @@ public class CuboidClipboard {
* @param origin the origin point where the copy was made, which must be the * @param origin the origin point where the copy was made, which must be the
* {@link CuboidRegion#getMinimumPoint()} relative to the copy * {@link CuboidRegion#getMinimumPoint()} relative to the copy
*/ */
public CuboidClipboard(Vector size, Vector origin) { public CuboidClipboard(BlockVector3 size, BlockVector3 origin) {
checkNotNull(size); checkNotNull(size);
checkNotNull(origin); checkNotNull(origin);
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class); MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
this.size = size; this.size = size;
this.clipboard = init(Vector.ZERO, origin); this.clipboard = init(BlockVector3.ZERO, origin);
} }
/** /**
@ -127,7 +128,7 @@ public class CuboidClipboard {
* {@link CuboidRegion#getMinimumPoint()} relative to the copy * {@link CuboidRegion#getMinimumPoint()} relative to the copy
* @param offset the offset from the minimum point of the copy where the user was * @param offset the offset from the minimum point of the copy where the user was
*/ */
public CuboidClipboard(Vector size, Vector origin, Vector offset) { public CuboidClipboard(BlockVector3 size, BlockVector3 origin, BlockVector3 offset) {
checkNotNull(size); checkNotNull(size);
checkNotNull(origin); checkNotNull(origin);
checkNotNull(offset); checkNotNull(offset);
@ -138,9 +139,9 @@ public class CuboidClipboard {
/* ------------------------------------------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------------------------------------------- */
private BlockArrayClipboard init(Vector offset, Vector min) { private BlockArrayClipboard init(BlockVector3 offset, BlockVector3 min) {
Vector origin = min.subtract(offset); BlockVector3 origin = min.subtract(offset);
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(Vector.ONE)); CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(BlockVector3.ONE));
BlockArrayClipboard clipboard = new BlockArrayClipboard(region); BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
clipboard.setOrigin(origin); clipboard.setOrigin(origin);
return clipboard; return clipboard;
@ -153,7 +154,7 @@ public class CuboidClipboard {
/* ------------------------------------------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------------------------------------------- */
public BaseBlock getBlock(Vector position) { public BaseBlock getBlock(BlockVector3 position) {
return getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()); return getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ());
} }
@ -162,11 +163,11 @@ public class CuboidClipboard {
return adapt(clipboard.IMP.getBlock(x, y, z)); return adapt(clipboard.IMP.getBlock(x, y, z));
} }
public BaseBlock getLazyBlock(Vector position) { public BaseBlock getLazyBlock(BlockVector3 position) {
return getBlock(position); return getBlock(position);
} }
public void setBlock(Vector location, BaseBlock block) { public void setBlock(BlockVector3 location, BaseBlock block) {
setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block); setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
} }
@ -235,7 +236,7 @@ public class CuboidClipboard {
public void flip(FlipDirection dir, boolean aroundPlayer) { public void flip(FlipDirection dir, boolean aroundPlayer) {
checkNotNull(dir); checkNotNull(dir);
Direction direction = dir.direction; Direction direction = dir.direction;
AffineTransform newTransform = new AffineTransform().scale(direction.toVector().positive().multiply(-2).add(1, 1, 1)); AffineTransform newTransform = new AffineTransform().scale(direction.toVector().abs().multiply(-2).add(1, 1, 1));
this.transform = transform == null ? newTransform : newTransform.combine(transform); this.transform = transform == null ? newTransform : newTransform.combine(transform);
} }
@ -248,7 +249,7 @@ public class CuboidClipboard {
for (int x = 0; x < size.getBlockX(); ++x) { for (int x = 0; x < size.getBlockX(); ++x) {
for (int y = 0; y < size.getBlockY(); ++y) { for (int y = 0; y < size.getBlockY(); ++y) {
for (int z = 0; z < size.getBlockZ(); ++z) { for (int z = 0; z < size.getBlockZ(); ++z) {
setBlock(x, y, z, editSession.getBlock(new Vector(x, y, z).add(getOrigin()))); setBlock(x, y, z, editSession.getBlock(new BlockVector3(x, y, z).add(getOrigin())));
} }
} }
} }
@ -264,7 +265,7 @@ public class CuboidClipboard {
for (int x = 0; x < size.getBlockX(); ++x) { for (int x = 0; x < size.getBlockX(); ++x) {
for (int y = 0; y < size.getBlockY(); ++y) { for (int y = 0; y < size.getBlockY(); ++y) {
for (int z = 0; z < size.getBlockZ(); ++z) { for (int z = 0; z < size.getBlockZ(); ++z) {
final Vector pt = new Vector(x, y, z).add(getOrigin()); final BlockVector3 pt = new BlockVector3(x, y, z).add(getOrigin());
if (region.contains(pt)) { if (region.contains(pt)) {
setBlock(x, y, z, editSession.getBlock(pt)); setBlock(x, y, z, editSession.getBlock(pt));
} else { } else {
@ -288,7 +289,7 @@ public class CuboidClipboard {
* @param noAir true to not copy air blocks in the source * @param noAir true to not copy air blocks in the source
* @throws MaxChangedBlocksException thrown if too many blocks were changed * @throws MaxChangedBlocksException thrown if too many blocks were changed
*/ */
public void paste(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException { public void paste(EditSession editSession, BlockVector3 newOrigin, boolean noAir) throws MaxChangedBlocksException {
paste(editSession, newOrigin, noAir, false); paste(editSession, newOrigin, noAir, false);
} }
@ -306,7 +307,7 @@ public class CuboidClipboard {
* @param entities true to copy entities * @param entities true to copy entities
* @throws MaxChangedBlocksException thrown if too many blocks were changed * @throws MaxChangedBlocksException thrown if too many blocks were changed
*/ */
public void paste(EditSession editSession, Vector newOrigin, boolean noAir, boolean entities) throws MaxChangedBlocksException { public void paste(EditSession editSession, BlockVector3 newOrigin, boolean noAir, boolean entities) throws MaxChangedBlocksException {
new Schematic(clipboard).paste(editSession, newOrigin, false, !noAir, entities, transform); new Schematic(clipboard).paste(editSession, newOrigin, false, !noAir, entities, transform);
editSession.flushQueue(); editSession.flushQueue();
} }
@ -324,7 +325,7 @@ public class CuboidClipboard {
* @param noAir true to not copy air blocks in the source * @param noAir true to not copy air blocks in the source
* @throws MaxChangedBlocksException thrown if too many blocks were changed * @throws MaxChangedBlocksException thrown if too many blocks were changed
*/ */
public void place(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException { public void place(EditSession editSession, BlockVector3 newOrigin, boolean noAir) throws MaxChangedBlocksException {
paste(editSession, newOrigin, noAir, false); paste(editSession, newOrigin, noAir, false);
} }
@ -339,7 +340,7 @@ public class CuboidClipboard {
* @deprecated use {@link #getBlock(Vector)} instead * @deprecated use {@link #getBlock(Vector)} instead
*/ */
@Deprecated @Deprecated
public BaseBlock getPoint(Vector position) throws ArrayIndexOutOfBoundsException { public BaseBlock getPoint(BlockVector3 position) throws ArrayIndexOutOfBoundsException {
final BaseBlock block = getBlock(position); final BaseBlock block = getBlock(position);
if (block == null) { if (block == null) {
return new BaseBlock(BlockTypes.AIR); return new BaseBlock(BlockTypes.AIR);
@ -355,7 +356,7 @@ public class CuboidClipboard {
* *
* @return the origin * @return the origin
*/ */
public Vector getOrigin() { public BlockVector3 getOrigin() {
return clipboard.getMinimumPoint(); return clipboard.getMinimumPoint();
} }
@ -366,14 +367,14 @@ public class CuboidClipboard {
* *
* @param origin the origin to set * @param origin the origin to set
*/ */
public void setOrigin(Vector origin) { public void setOrigin(BlockVector3 origin) {
checkNotNull(origin); checkNotNull(origin);
setOriginAndOffset(getOffset(), origin); setOriginAndOffset(getOffset(), origin);
} }
public void setOriginAndOffset(Vector offset, Vector min) { public void setOriginAndOffset(BlockVector3 offset, BlockVector3 min) {
Vector origin = min.subtract(offset); BlockVector3 origin = min.subtract(offset);
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(Vector.ONE)); CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(BlockVector3.ONE));
clipboard.setRegion(region); clipboard.setRegion(region);
clipboard.setOrigin(origin); clipboard.setOrigin(origin);
} }
@ -386,10 +387,10 @@ public class CuboidClipboard {
* *
* @return the offset the offset * @return the offset the offset
*/ */
public Vector getOffset() { public BlockVector3 getOffset() {
Vector min = clipboard.getMinimumPoint(); BlockVector3 min = clipboard.getMinimumPoint();
Vector origin = clipboard.getOrigin(); BlockVector3 origin = clipboard.getOrigin();
Vector offset = min.subtract(origin); BlockVector3 offset = min.subtract(origin);
return offset; return offset;
} }
@ -401,7 +402,7 @@ public class CuboidClipboard {
* *
* @param offset the new offset * @param offset the new offset
*/ */
public void setOffset(Vector offset) { public void setOffset(BlockVector3 offset) {
checkNotNull(offset); checkNotNull(offset);
setOriginAndOffset(offset, getOrigin()); setOriginAndOffset(offset, getOrigin());
} }
@ -411,7 +412,7 @@ public class CuboidClipboard {
* *
* @return the dimensions, where (1, 1, 1) is 1 wide, 1 across, 1 deep * @return the dimensions, where (1, 1, 1) is 1 wide, 1 across, 1 deep
*/ */
public Vector getSize() { public BlockVector3 getSize() {
return size; return size;
} }
@ -448,7 +449,7 @@ public class CuboidClipboard {
@Deprecated @Deprecated
public static CuboidClipboard loadSchematic(File path) throws DataException, IOException { public static CuboidClipboard loadSchematic(File path) throws DataException, IOException {
checkNotNull(path); checkNotNull(path);
return new CuboidClipboard((Vector) ClipboardFormat.SCHEMATIC.load(path).getClipboard()); return new CuboidClipboard((BlockVector3) ClipboardFormat.SCHEMATIC.load(path).getClipboard());
} }
/** /**

Datei anzeigen

@ -72,6 +72,7 @@ import com.sk89q.worldedit.function.block.Naturalizer;
import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.generator.GardenPatchGenerator;
import com.sk89q.worldedit.function.operation.ChangeSetExecutor; import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
@ -1085,8 +1086,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
public boolean setBlock(int x, int y, int z, Pattern pattern) { public boolean setBlock(int x, int y, int z, Pattern pattern) {
this.changes++; this.changes++;
try { try {
mutablebv.setComponents(x, y, z); BlockVector3 bv = mutablebv.setComponents(x, y, z).toBlockVector3();
return pattern.apply(extent, mutablebv, mutablebv); return pattern.apply(extent, bv, bv);
} catch (WorldEditException e) { } catch (WorldEditException e) {
throw new RuntimeException("Unexpected exception", e); throw new RuntimeException("Unexpected exception", e);
} }
@ -2225,10 +2226,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
} }
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), 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).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), 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).toBlockVector3(), block);
} }
} }
} }
@ -2259,10 +2260,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
} }
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), 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).toBlockVector3(), block);
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), 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).toBlockVector3(), block);
} }
} }
} }
@ -2336,21 +2337,21 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
} }
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold) if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py + y, pz + z), block); setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold) if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py + y, pz + z), block); setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold) if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py - y, pz + z), block); setBlock(mutable.setComponents(px + x, py - y, pz + z).toBlockVector3(), block);
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold) if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py + y, pz - z), block); setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold) if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py - y, pz + z), block); setBlock(mutable.setComponents(px - x, py - y, pz + z).toBlockVector3(), block);
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold) if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px + x, py - y, pz - z), block); setBlock(mutable.setComponents(px + x, py - y, pz - z).toBlockVector3(), block);
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold) if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py + y, pz - z), block); setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold) if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold)
setBlock(mutable.setComponents(px - x, py - y, pz - z), block); setBlock(mutable.setComponents(px - x, py - y, pz - z).toBlockVector3(), block);
} }
} }
} }
@ -2956,9 +2957,9 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
@Override @Override
public BlockStateHolder getMaterial(final int x, final int y, final int z, final BlockStateHolder defaultMaterial) { public BlockStateHolder getMaterial(final int x, final int y, final int z, final BlockStateHolder defaultMaterial) {
//TODO Optimize - avoid vector creation (math) //TODO Optimize - avoid vector creation (math)
final Vector3 current = mutablev.setComponents(x, y, z); // final Vector3 current = mutablev.setComponents(x, y, z);
// protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { // protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) {
// final Vector3 current = new Vector3(x, y, z); final Vector3 current = new Vector3(x, y, z);
environment.setCurrentBlock(current); environment.setCurrentBlock(current);
final Vector3 scaled = current.subtract(zero).divide(unit); final Vector3 scaled = current.subtract(zero).divide(unit);
@ -3472,14 +3473,17 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
boolean containsAny = false; boolean containsAny = false;
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) { if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) {
containsAny = true; containsAny = true;
BlockVector3 mbv = mutable.toBlockVector3();
if (fcs != null) { if (fcs != null) {
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
int xx = x + bx; int xx = x + bx;
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
int zz = z + bz; int zz = z + bz;
for (int y = 0; y < getMaxY() + 1; y++) { for (int y = 0; y < getMaxY() + 1; y++) {
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz)); // BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState()); BlockVector3 bv = new BlockVector3(xx, y, zz);
BlockStateHolder block = getFullBlock(bv);
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState());
} }
} }
} }
@ -3502,17 +3506,18 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
mutable.mutZ(zz); mutable.mutZ(zz);
for (int y = 0; y < getMaxY() + 1; y++) { for (int y = 0; y < getMaxY() + 1; y++) {
mutable.mutY(y); mutable.mutY(y);
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mutable); BlockVector3 mbv = new BlockVector3(xx, y, zz);
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mbv);
if (contains) { if (contains) {
containsAny = true; containsAny = true;
if (fcs != null) { if (fcs != null) {
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz)); BlockStateHolder block = getFullBlock(mbv);
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState()); fcs.add(mbv, block, BlockTypes.AIR.getDefaultState());
} }
} else { } else {
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz)); BlockStateHolder block = getFullBlock(mbv);
try { try {
setBlock(mutable, block); setBlock(mbv, block);
} catch (MaxChangedBlocksException e) { } catch (MaxChangedBlocksException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -3602,5 +3607,4 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
return false; return false;
} }
} }

Datei anzeigen

@ -71,6 +71,7 @@ public abstract class LocalConfiguration {
public int butcherDefaultRadius = -1; public int butcherDefaultRadius = -1;
public int butcherMaxRadius = -1; public int butcherMaxRadius = -1;
public boolean allowSymlinks = false; public boolean allowSymlinks = false;
public boolean serverSideCUI = true;
/** /**
* Load the configuration. * Load the configuration.

Datei anzeigen

@ -40,6 +40,8 @@ import com.sk89q.jchronic.Chronic;
import com.sk89q.jchronic.Options; import com.sk89q.jchronic.Options;
import com.sk89q.jchronic.utils.Span; import com.sk89q.jchronic.utils.Span;
import com.sk89q.jchronic.utils.Time; import com.sk89q.jchronic.utils.Time;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
@ -140,6 +142,7 @@ public class LocalSession implements TextureHolder {
// Saved properties // Saved properties
private String lastScript; private String lastScript;
private RegionSelectorType defaultSelector; private RegionSelectorType defaultSelector;
private boolean useServerCUI = false; // Save this to not annoy players.
/** /**
* Construct the object. * Construct the object.

Datei anzeigen

@ -22,6 +22,8 @@ package com.sk89q.worldedit.blocks;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag; import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
@ -208,4 +210,5 @@ public class BaseBlock extends BlockState {
return getAsString(); return getAsString();
} }
} }
} }

Datei anzeigen

@ -42,12 +42,9 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Mask2D; import com.sk89q.worldedit.function.mask.Mask2D;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor; import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
<<<<<<< HEAD
import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.function.visitor.RegionVisitor;
=======
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.FlatRegion; import com.sk89q.worldedit.regions.FlatRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -153,54 +150,32 @@ public class BiomeCommands extends MethodCommands {
return; return;
} }
<<<<<<< HEAD
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toVector2D());
biomes[biome.getId()]++;
size = 1;
} else if (args.hasFlag('p')) {
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toVector2D());
biomes[biome.getId()]++;
size = 1;
=======
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2()); BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
biomes.add(biome); biomes[biome.getId()]++;
size = 1;
qualifier = "at line of sight point";
} else if (args.hasFlag('p')) { } else if (args.hasFlag('p')) {
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2()); BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
biomes.add(biome); biomes[biome.getId()]++;
size = 1;
qualifier = "at your position";
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} else { } else {
World world = player.getWorld(); World world = player.getWorld();
Region region = session.getSelection(world); Region region = session.getSelection(world);
if (region instanceof FlatRegion) { if (region instanceof FlatRegion) {
<<<<<<< HEAD for (BlockVector2 pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
for (Vector2D pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
biomes[editSession.getBiome(pt).getId()]++; biomes[editSession.getBiome(pt).getId()]++;
size++; size++;
} }
} else { } else {
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() { RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
@Override @Override
public boolean apply(Vector position) throws WorldEditException { public boolean apply(BlockVector3 position) throws WorldEditException {
biomes[editSession.getBiome(position.toVector2D()).getId()]++; biomes[editSession.getBiome(position.toBlockVector2()).getId()]++;
return true; return true;
} }
}, editSession); }, editSession);
Operations.completeBlindly(visitor); Operations.completeBlindly(visitor);
size += visitor.getAffected(); size += visitor.getAffected();
=======
for (BlockVector2 pt : ((FlatRegion) region).asFlatRegion()) {
biomes.add(world.getBiome(pt));
}
} else {
for (BlockVector3 pt : region) {
biomes.add(world.getBiome(pt.toBlockVector2()));
}
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
} }

Datei anzeigen

@ -24,13 +24,9 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
<<<<<<< HEAD
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
=======
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
@ -79,17 +75,10 @@ public class ChunkCommands {
String filename = "c." + Integer.toString(chunkX, 36) String filename = "c." + Integer.toString(chunkX, 36)
+ "." + Integer.toString(chunkZ, 36) + ".dat"; + "." + Integer.toString(chunkZ, 36) + ".dat";
<<<<<<< HEAD
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ); player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename); player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename( player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename(
new Vector2D(chunkX, chunkZ)));
=======
player.print("Chunk: " + chunkX + ", " + chunkZ);
player.print("Old format: " + folder1 + "/" + folder2 + "/" + filename);
player.print("McRegion: region/" + McRegionChunkStore.getFilename(
new BlockVector2(chunkX, chunkZ))); new BlockVector2(chunkX, chunkZ)));
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -100,19 +89,11 @@ public class ChunkCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.listchunks") @CommandPermissions("worldedit.listchunks")
<<<<<<< HEAD
public void listChunks(Player player, LocalSession session, CommandContext args) throws WorldEditException {
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
for (Vector2D chunk : chunks) {
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
=======
public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks(); Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
for (BlockVector2 chunk : chunks) { for (BlockVector2 chunk : chunks) {
player.print(LegacyChunkStore.getFilename(chunk)); player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
} }

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
<<<<<<< HEAD
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
@ -41,7 +40,6 @@ import com.boydti.fawe.util.gui.FormBuilder;
import com.boydti.fawe.wrappers.FakePlayer; import com.boydti.fawe.wrappers.FakePlayer;
import com.sk89q.minecraft.util.commands.*; import com.sk89q.minecraft.util.commands.*;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
=======
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
@ -53,7 +51,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.extent.PasteEvent; import com.sk89q.worldedit.event.extent.PasteEvent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
@ -127,15 +124,15 @@ public class ClipboardCommands extends MethodCommands {
public void lazyCopy(Player player, LocalSession session, EditSession editSession, public void lazyCopy(Player player, LocalSession session, EditSession editSession,
@Selection final Region region, @Switch('e') boolean skipEntities, @Selection final Region region, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = FawePlayer.wrap(player).getLimit(); FaweLimit limit = FawePlayer.wrap(player).getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS); throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
} }
session.setClipboard(null); session.setClipboard(null);
final Vector origin = region.getMinimumPoint(); final BlockVector3 origin = region.getMinimumPoint();
final int mx = origin.getBlockX(); final int mx = origin.getBlockX();
final int my = origin.getBlockY(); final int my = origin.getBlockY();
final int mz = origin.getBlockZ(); final int mz = origin.getBlockZ();
@ -167,14 +164,14 @@ public class ClipboardCommands extends MethodCommands {
public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@Selection Region region, @Switch('e') boolean skipEntities, @Selection Region region, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException {
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = FawePlayer.wrap(player).getLimit(); FaweLimit limit = FawePlayer.wrap(player).getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS); throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
} }
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
fp.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
session.setClipboard(null); session.setClipboard(null);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId()); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
@ -217,8 +214,8 @@ public class ClipboardCommands extends MethodCommands {
public void lazyCut(Player player, LocalSession session, EditSession editSession, public void lazyCut(Player player, LocalSession session, EditSession editSession,
@Selection final Region region, @Switch('e') boolean skipEntities, @Selection final Region region, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = FawePlayer.wrap(player).getLimit(); FaweLimit limit = FawePlayer.wrap(player).getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
@ -228,7 +225,7 @@ public class ClipboardCommands extends MethodCommands {
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES); throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
} }
session.setClipboard(null); session.setClipboard(null);
final Vector origin = region.getMinimumPoint(); final BlockVector3 origin = region.getMinimumPoint();
final int mx = origin.getBlockX(); final int mx = origin.getBlockX();
final int my = origin.getBlockY(); final int my = origin.getBlockY();
final int mz = origin.getBlockZ(); final int mz = origin.getBlockZ();
@ -258,8 +255,8 @@ public class ClipboardCommands extends MethodCommands {
public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean skipEntities, @Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean skipEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException {
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = FawePlayer.wrap(player).getLimit(); FaweLimit limit = FawePlayer.wrap(player).getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
@ -268,7 +265,7 @@ public class ClipboardCommands extends MethodCommands {
if (volume >= limit.MAX_CHANGES) { if (volume >= limit.MAX_CHANGES) {
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES); throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
} }
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
fp.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
session.setClipboard(null); session.setClipboard(null);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId()); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
@ -481,14 +478,8 @@ public class ClipboardCommands extends MethodCommands {
} }
Clipboard clipboard = holder.getClipboard(); Clipboard clipboard = holder.getClipboard();
Region region = clipboard.getRegion(); Region region = clipboard.getRegion();
<<<<<<< HEAD
Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
checkPaste(player, editSession, to, holder, clipboard);
=======
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player); BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner checkPaste(player, editSession, to, holder, clipboard);
Operation operation = holder Operation operation = holder
.createPaste(editSession) .createPaste(editSession)
.to(to) .to(to)
@ -499,27 +490,20 @@ public class ClipboardCommands extends MethodCommands {
Operations.completeLegacy(operation); Operations.completeLegacy(operation);
if (selectPasted) { if (selectPasted) {
<<<<<<< HEAD
Vector clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
Vector realTo = to.add(new Vector(holder.getTransform().apply(clipboardOffset)));
Vector max = realTo.add(new Vector(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()))));
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
=======
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3())); Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3())); Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint()); RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
session.setRegionSelector(player.getWorld(), selector); session.setRegionSelector(player.getWorld(), selector);
selector.learnChanges(); selector.learnChanges();
selector.explainRegionAdjust(player, session); selector.explainRegionAdjust(player, session);
} }
BBC.COMMAND_PASTE.send(player, to.toBlockVector()); BBC.COMMAND_PASTE.send(player, to);
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to); BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to);
} }
private void checkPaste(Player player, EditSession editSession, Vector to, ClipboardHolder holder, Clipboard clipboard) { private void checkPaste(Player player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) {
URI uri = null; URI uri = null;
if (holder instanceof URIClipboardHolder) uri = ((URIClipboardHolder) holder).getURI(clipboard); if (holder instanceof URIClipboardHolder) uri = ((URIClipboardHolder) holder).getURI(clipboard);
PasteEvent event = new PasteEvent(player, clipboard, uri, editSession, to); PasteEvent event = new PasteEvent(player, clipboard, uri, editSession, to);
@ -550,8 +534,8 @@ public class ClipboardCommands extends MethodCommands {
@Switch('s') boolean selectPasted) throws WorldEditException { @Switch('s') boolean selectPasted) throws WorldEditException {
ClipboardHolder holder = session.getClipboard(); ClipboardHolder holder = session.getClipboard();
final Clipboard clipboard = holder.getClipboard(); final Clipboard clipboard = holder.getClipboard();
final Vector origin = clipboard.getOrigin(); final BlockVector3 origin = clipboard.getOrigin();
final Vector to = atOrigin ? origin : session.getPlacementPosition(player); final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(player);
checkPaste(player, editSession, to, holder, clipboard); checkPaste(player, editSession, to, holder, clipboard);
Schematic schem = new Schematic(clipboard); Schematic schem = new Schematic(clipboard);
@ -559,9 +543,9 @@ public class ClipboardCommands extends MethodCommands {
Region region = clipboard.getRegion().clone(); Region region = clipboard.getRegion().clone();
if (selectPasted) { if (selectPasted) {
Vector clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
Vector realTo = to.add(new Vector(holder.getTransform().apply(clipboardOffset))); BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
Vector max = realTo.add(new Vector(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint())))); BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint());
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max); RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
session.setRegionSelector(player.getWorld(), selector); session.setRegionSelector(player.getWorld(), selector);
selector.learnChanges(); selector.learnChanges();
@ -605,24 +589,13 @@ public class ClipboardCommands extends MethodCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.clipboard.flip") @CommandPermissions("worldedit.clipboard.flip")
<<<<<<< HEAD
public void flip(Player player, LocalSession session,
@Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException {
=======
public void flip(Player player, LocalSession session, EditSession editSession, public void flip(Player player, LocalSession session, EditSession editSession,
@Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException { @Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException {
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
ClipboardHolder holder = session.getClipboard(); ClipboardHolder holder = session.getClipboard();
AffineTransform transform = new AffineTransform(); AffineTransform transform = new AffineTransform();
<<<<<<< HEAD transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1));
holder.setTransform(transform.combine(holder.getTransform())); holder.setTransform(transform.combine(holder.getTransform()));
BBC.COMMAND_FLIPPED.send(player); BBC.COMMAND_FLIPPED.send(player);
=======
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
holder.setTransform(holder.getTransform().combine(transform));
player.print("The clipboard copy has been flipped.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Deprecated // See SchematicCommands#clear @Deprecated // See SchematicCommands#clear

Datei anzeigen

@ -19,17 +19,15 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
<<<<<<< HEAD
import com.sk89q.worldedit.Vector;
=======
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.CombinedTransform; import com.sk89q.worldedit.math.transform.CombinedTransform;
@ -82,19 +80,6 @@ public class FlattenedClipboardTransform {
transform, transform,
new AffineTransform().translate(original.getOrigin())); new AffineTransform().translate(original.getOrigin()));
<<<<<<< HEAD
// new Vector(minimum.getX(), minimum.getY(), minimum.getZ())
// new Vector(maximum.getX(), maximum.getY(), maximum.getZ())
Vector[] corners = new Vector[]{
minimum,
maximum,
new Vector(maximum.getX(), minimum.getY(), minimum.getZ()),
new Vector(minimum.getX(), maximum.getY(), minimum.getZ()),
new Vector(minimum.getX(), minimum.getY(), maximum.getZ()),
new Vector(minimum.getX(), maximum.getY(), maximum.getZ()),
new Vector(maximum.getX(), minimum.getY(), maximum.getZ()),
new Vector(maximum.getX(), maximum.getY(), minimum.getZ())};
=======
Vector3[] corners = new Vector3[] { Vector3[] corners = new Vector3[] {
minimum, minimum,
maximum, maximum,
@ -104,34 +89,27 @@ public class FlattenedClipboardTransform {
maximum.withX(minimum.getX()), maximum.withX(minimum.getX()),
maximum.withY(minimum.getY()), maximum.withY(minimum.getY()),
maximum.withZ(minimum.getZ()) }; maximum.withZ(minimum.getZ()) };
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
for (int i = 0; i < corners.length; i++) { for (int i = 0; i < corners.length; i++) {
corners[i] = transformAround.apply(new Vector(corners[i])); corners[i] = transformAround.apply(new Vector3(corners[i]));
} }
Vector3 newMinimum = corners[0]; MutableVector newMinimum = new MutableVector(corners[0]);
Vector3 newMaximum = corners[0]; MutableVector newMaximum = new MutableVector(corners[0]);
// MutableVector cbv = new MutableVector();
for (int i = 1; i < corners.length; i++) { for (int i = 1; i < corners.length; i++) {
newMinimum = newMinimum.getMinimum(corners[i]); MutableVector cbv = new MutableVector(corners[i]);
newMaximum = newMaximum.getMaximum(corners[i]); newMinimum = newMinimum.setComponents(newMinimum.getMinimum(cbv));
newMaximum = newMaximum.setComponents(newMaximum.getMaximum(cbv));
} }
// After transformation, the points may not really sit on a block, // After transformation, the points may not really sit on a block,
// so we should expand the region for edge cases // so we should expand the region for edge cases
<<<<<<< HEAD
newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX()))); newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX())));
newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY()))); newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ()))); newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));
return new CuboidRegion(newMinimum, newMaximum); return new CuboidRegion(new BlockVector3(newMinimum.getX(), newMinimum.getY(), newMinimum.getZ()), new BlockVector3(newMaximum.getX(), newMaximum.getY(), newMaximum.getZ()));
=======
newMinimum = newMinimum.floor();
newMaximum = newMaximum.ceil();
return new CuboidRegion(newMinimum.toBlockPoint(), newMaximum.toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
/** /**

Datei anzeigen

@ -31,16 +31,13 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.minecraft.util.commands.Logging;
<<<<<<< HEAD
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
=======
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
@ -49,12 +46,11 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.ExpressionException;
<<<<<<< HEAD
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
======= import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.TreeGenerator.TreeType;
@ -134,7 +130,7 @@ public class GenerationCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.generation.image") @CommandPermissions("worldedit.generation.image")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional Vector2D dimensions) throws WorldEditException, ParameterException, IOException { public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, ParameterException, IOException {
TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold); TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold);
URL url = new URL(arg); URL url = new URL(arg);
if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) { if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) {
@ -146,14 +142,16 @@ public class GenerationCommands extends MethodCommands {
image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false); image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
} }
MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector()); // MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector().toBlockPoint());
MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1)); // MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
BlockVector3 pos1 = player.getLocation().toVector().toBlockPoint();
BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1);
CuboidRegion region = new CuboidRegion(pos1, pos2); CuboidRegion region = new CuboidRegion(pos1, pos2);
int[] count = new int[1]; int[] count = new int[1];
final BufferedImage finalImage = image; final BufferedImage finalImage = image;
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() { RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
@Override @Override
public boolean apply(Vector pos) throws WorldEditException { public boolean apply(BlockVector3 pos) throws WorldEditException {
try { try {
int x = pos.getBlockX() - pos1.getBlockX(); int x = pos.getBlockX() - pos1.getBlockX();
int z = pos.getBlockZ() - pos1.getBlockZ(); int z = pos.getBlockZ() - pos1.getBlockZ();
@ -203,17 +201,16 @@ public class GenerationCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.generation.cylinder") @CommandPermissions("worldedit.generation.cylinder")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector2D radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException, ParameterException { public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException, ParameterException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ()); double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
worldEdit.checkMaxRadius(max); worldEdit.checkMaxRadius(max);
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
fp.checkConfirmationRadius(() -> { fp.checkConfirmationRadius(() -> {
int affected = editSession.makeHollowCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), thickness - 1); int affected = editSession.makeHollowCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), thickness - 1);
BBC.VISITOR_BLOCK.send(fp, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), (int) max, context); }, getArguments(context), (int) max, context);
} }
<<<<<<< HEAD
@Command( @Command(
aliases = {"/cyl"}, aliases = {"/cyl"},
usage = "<pattern> <radius>[,<radius>] [height]", usage = "<pattern> <radius>[,<radius>] [height]",
@ -229,19 +226,14 @@ public class GenerationCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.generation.cylinder") @CommandPermissions("worldedit.generation.cylinder")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector2D radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException { public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ()); double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
worldEdit.checkMaxRadius(max); worldEdit.checkMaxRadius(max);
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
fp.checkConfirmationRadius(() -> { fp.checkConfirmationRadius(() -> {
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow); int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
BBC.VISITOR_BLOCK.send(fp, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), (int) max, context); }, getArguments(context), (int) max, context);
=======
BlockVector3 pos = session.getPlacementPosition(player);
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
player.print(affected + " block(s) have been created.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -258,7 +250,7 @@ public class GenerationCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.generation.sphere") @CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException { public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException {
sphere(fp, player, session, editSession, pattern, radius, raised, true, context); sphere(fp, player, session, editSession, pattern, radius, raised, true, context);
} }
@ -277,50 +269,16 @@ public class GenerationCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.generation.sphere") @CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT) @Logging(PLACEMENT)
<<<<<<< HEAD public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ()); double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ());
worldEdit.checkMaxRadius(max); worldEdit.checkMaxRadius(max);
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
Vector finalPos = raised ? pos.add(0, radius.getY(), 0) : pos; BlockVector3 finalPos = raised ? pos.add(0, radius.getY(), 0) : pos;
fp.checkConfirmationRadius(() -> { fp.checkConfirmationRadius(() -> {
int affected = editSession.makeSphere(finalPos, pattern, radius.getX(), radius.getY(), radius.getZ(), !hollow); int affected = editSession.makeSphere(finalPos, pattern, radius.getX(), radius.getY(), radius.getZ(), !hollow);
player.findFreePosition(); player.findFreePosition();
BBC.VISITOR_BLOCK.send(fp, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), (int) max, context); }, getArguments(context), (int) max, context);
=======
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow) throws WorldEditException {
String[] radii = radiusString.split(",");
final double radiusX, radiusY, radiusZ;
switch (radii.length) {
case 1:
radiusX = radiusY = radiusZ = Math.max(1, Double.parseDouble(radii[0]));
break;
case 3:
radiusX = Math.max(1, Double.parseDouble(radii[0]));
radiusY = Math.max(1, Double.parseDouble(radii[1]));
radiusZ = Math.max(1, Double.parseDouble(radii[2]));
break;
default:
player.printError("You must either specify 1 or 3 radius values.");
return;
}
worldEdit.checkMaxRadius(radiusX);
worldEdit.checkMaxRadius(radiusY);
worldEdit.checkMaxRadius(radiusZ);
BlockVector3 pos = session.getPlacementPosition(player);
if (raised) {
pos = pos.add(0, (int) radiusY, 0);
}
int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow);
player.findFreePosition();
player.print(affected + " block(s) have been created.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -376,14 +334,9 @@ public class GenerationCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.generation.pyramid") @CommandPermissions("worldedit.generation.pyramid")
@Logging(PLACEMENT) @Logging(PLACEMENT)
<<<<<<< HEAD
public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException { public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
=======
public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException {
BlockVector3 pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
worldEdit.checkMaxRadius(size); worldEdit.checkMaxRadius(size);
Vector pos = session.getPlacementPosition(player);
fp.checkConfirmationRadius(() -> { fp.checkConfirmationRadius(() -> {
int affected = editSession.makePyramid(pos, pattern, size, !hollow); int affected = editSession.makePyramid(pos, pattern, size, !hollow);
player.findFreePosition(); player.findFreePosition();
@ -391,6 +344,7 @@ public class GenerationCommands extends MethodCommands {
}, getArguments(context), size, context); }, getArguments(context), size, context);
} }
@Command( @Command(
aliases = {"/generate", "/gen", "/g"}, aliases = {"/generate", "/gen", "/g"},
usage = "<pattern> <expression>", usage = "<pattern> <expression>",
@ -419,17 +373,10 @@ public class GenerationCommands extends MethodCommands {
@Switch('h') boolean hollow, @Switch('h') boolean hollow,
@Switch('r') boolean useRawCoords, @Switch('r') boolean useRawCoords,
@Switch('o') boolean offset, @Switch('o') boolean offset,
<<<<<<< HEAD @Switch('c') boolean offsetCenter, CommandContext context) throws WorldEditException {
@Switch('c') boolean offsetCenter,
CommandContext context) throws WorldEditException, ParameterException {
final Vector zero;
Vector unit;
=======
@Switch('c') boolean offsetCenter) throws WorldEditException {
final Vector3 zero; final Vector3 zero;
Vector3 unit; Vector3 unit;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (useRawCoords) { if (useRawCoords) {
zero = Vector3.ZERO; zero = Vector3.ZERO;
@ -450,20 +397,16 @@ public class GenerationCommands extends MethodCommands {
zero = max.add(min).multiply(0.5); zero = max.add(min).multiply(0.5);
unit = max.subtract(zero); unit = max.subtract(zero);
<<<<<<< HEAD
if (unit.getX() == 0) unit.mutX(1);
if (unit.getY() == 0) unit.mutY(1);
if (unit.getZ() == 0) unit.mutZ(1);
=======
if (unit.getX() == 0) unit = unit.withX(1.0); if (unit.getX() == 0) unit = unit.withX(1.0);
if (unit.getY() == 0) unit = unit.withY(1.0); if (unit.getY() == 0) unit = unit.withY(1.0);
if (unit.getZ() == 0) unit = unit.withZ(1.0); if (unit.getZ() == 0) unit = unit.withZ(1.0);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
final Vector3 unit1 = unit;
fp.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
try { try {
final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow); final int affected = editSession.makeShape(region, zero, unit1, pattern, expression, hollow);
player.findFreePosition(); player.findFreePosition();
BBC.VISITOR_BLOCK.send(fp, affected); BBC.VISITOR_BLOCK.send(fp, affected);
} catch (ExpressionException e) { } catch (ExpressionException e) {
@ -500,16 +443,9 @@ public class GenerationCommands extends MethodCommands {
@Switch('h') boolean hollow, @Switch('h') boolean hollow,
@Switch('r') boolean useRawCoords, @Switch('r') boolean useRawCoords,
@Switch('o') boolean offset, @Switch('o') boolean offset,
<<<<<<< HEAD @Switch('c') boolean offsetCenter, CommandContext context) throws WorldEditException {
@Switch('c') boolean offsetCenter,
CommandContext context) throws WorldEditException, ParameterException {
final Vector zero;
Vector unit;
=======
@Switch('c') boolean offsetCenter) throws WorldEditException {
final Vector3 zero; final Vector3 zero;
Vector3 unit; Vector3 unit;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (useRawCoords) { if (useRawCoords) {
zero = Vector3.ZERO; zero = Vector3.ZERO;
@ -530,27 +466,16 @@ public class GenerationCommands extends MethodCommands {
zero = max.add(min).multiply(0.5); zero = max.add(min).multiply(0.5);
unit = max.subtract(zero); unit = max.subtract(zero);
<<<<<<< HEAD
if (unit.getX() == 0) unit.mutX(1);
if (unit.getY() == 0) unit.mutY(1);
if (unit.getZ() == 0) unit.mutZ(1);
=======
if (unit.getX() == 0) unit = unit.withX(1.0); if (unit.getX() == 0) unit = unit.withX(1.0);
if (unit.getY() == 0) unit = unit.withY(1.0); if (unit.getY() == 0) unit = unit.withY(1.0);
if (unit.getZ() == 0) unit = unit.withZ(1.0); if (unit.getZ() == 0) unit = unit.withZ(1.0);
} }
try { final Vector3 unit1 = unit;
final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow);
player.findFreePosition();
player.print("" + affected + " columns affected.");
} catch (ExpressionException e) {
player.printError(e.getMessage());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
fp.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
try { try {
final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow); final int affected = editSession.makeBiomeShape(region, zero, unit1, target, expression, hollow);
player.findFreePosition(); player.findFreePosition();
BBC.VISITOR_FLAT.send(fp, affected); BBC.VISITOR_FLAT.send(fp, affected);
} catch (ExpressionException e) { } catch (ExpressionException e) {

Datei anzeigen

@ -39,6 +39,8 @@ import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.entity.Player; 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.regions.Region;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Range;
@ -112,7 +114,7 @@ public class HistoryCommands extends MethodCommands {
RollbackOptimizedHistory rollback = new RollbackOptimizedHistory(world, uuid, Integer.parseInt(name.substring(0, name.length() - 3))); RollbackOptimizedHistory rollback = new RollbackOptimizedHistory(world, uuid, Integer.parseInt(name.substring(0, name.length() - 3)));
DiskStorageHistory.DiskStorageSummary summary = rollback.summarize(RegionWrapper.GLOBAL(), false); DiskStorageHistory.DiskStorageSummary summary = rollback.summarize(RegionWrapper.GLOBAL(), false);
if (summary != null) { if (summary != null) {
rollback.setDimensions(new Vector(summary.minX, 0, summary.minZ), new Vector(summary.maxX, 255, summary.maxZ)); rollback.setDimensions(new BlockVector3(summary.minX, 0, summary.minZ), new BlockVector3(summary.maxX, 255, summary.maxZ));
rollback.setTime(historyFile.lastModified()); rollback.setTime(historyFile.lastModified());
RollbackDatabase db = DBHandler.IMP.getDatabase(world); RollbackDatabase db = DBHandler.IMP.getDatabase(world);
db.logEdit(rollback); db.logEdit(rollback);
@ -165,10 +167,12 @@ public class HistoryCommands extends MethodCommands {
radius = Math.max(Math.min(500, radius), 0); radius = Math.max(Math.min(500, radius), 0);
final World world = player.getWorld(); final World world = player.getWorld();
Location origin = player.getLocation(); Location origin = player.getLocation();
Vector bot = origin.toVector().subtract(radius, radius, radius); BlockVector3 bot = origin.toVector().toBlockPoint().subtract(radius, radius, radius);
bot.mutY(Math.max(0, bot.getY())); bot = bot.withY(Math.max(0, bot.getY()));
Vector top = origin.toVector().add(radius, radius, radius); // bot.mutY(Math.max(0, bot.getY()));
top.mutY(Math.min(255, top.getY())); BlockVector3 top = origin.toVector().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); RollbackDatabase database = DBHandler.IMP.getDatabase(world);
final AtomicInteger count = new AtomicInteger(); final AtomicInteger count = new AtomicInteger();
final FawePlayer fp = FawePlayer.wrap(player); final FawePlayer fp = FawePlayer.wrap(player);

Datei anzeigen

@ -4,7 +4,6 @@ import com.boydti.fawe.object.mask.*;
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -13,6 +12,8 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.*; import com.sk89q.worldedit.function.mask.*;
import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
import com.sk89q.worldedit.session.request.RequestSelection; import com.sk89q.worldedit.session.request.RequestSelection;
import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Switch;
@ -129,7 +130,7 @@ public class MaskCommands extends MethodCommands {
max = 4 max = 4
) )
public Mask offset(double x, double y, double z, Mask mask) { public Mask offset(double x, double y, double z, Mask mask) {
return new OffsetMask(mask, new Vector(x, y, z)); return new OffsetMask(mask, new BlockVector3(x, y, z));
} }
@Command( @Command(
@ -389,7 +390,7 @@ public class MaskCommands extends MethodCommands {
max = 1 max = 1
) )
public Mask below(Mask mask) throws ExpressionException { public Mask below(Mask mask) throws ExpressionException {
OffsetMask offsetMask = new OffsetMask(mask, new Vector(0, 1, 0)); OffsetMask offsetMask = new OffsetMask(mask, new BlockVector3(0, 1, 0));
return new MaskIntersection(offsetMask, Masks.negate(mask)); return new MaskIntersection(offsetMask, Masks.negate(mask));
} }
@ -401,7 +402,7 @@ public class MaskCommands extends MethodCommands {
max = 1 max = 1
) )
public Mask above(Mask mask) throws ExpressionException { public Mask above(Mask mask) throws ExpressionException {
OffsetMask offsetMask = new OffsetMask(mask, new Vector(0, -1, 0)); OffsetMask offsetMask = new OffsetMask(mask, new BlockVector3(0, -1, 0));
return new MaskIntersection(offsetMask, Masks.negate(mask)); return new MaskIntersection(offsetMask, Masks.negate(mask));
} }
@ -438,7 +439,7 @@ public class MaskCommands extends MethodCommands {
) )
public Mask expression(Extent extent, String input) throws ExpressionException { public Mask expression(Extent extent, String input) throws ExpressionException {
Expression exp = Expression.compile(input, "x", "y", "z"); Expression exp = Expression.compile(input, "x", "y", "z");
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector.ONE, Vector.ZERO); WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
exp.setEnvironment(env); exp.setEnvironment(env);
return new ExpressionMask(exp); return new ExpressionMask(exp);
} }

Datei anzeigen

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

Datei anzeigen

@ -22,6 +22,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Range;
@ -426,7 +427,7 @@ public class PatternCommands extends MethodCommands {
) )
public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException { public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException {
Expression exp = Expression.compile(input, "x", "y", "z"); Expression exp = Expression.compile(input, "x", "y", "z");
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector.ONE, Vector.ZERO); WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
exp.setEnvironment(env); exp.setEnvironment(env);
return new ExpressionPattern(exp); return new ExpressionPattern(exp);
} }

Datei anzeigen

@ -34,16 +34,13 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.minecraft.util.commands.Logging;
<<<<<<< HEAD
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
=======
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.function.GroundFunction; import com.sk89q.worldedit.function.GroundFunction;
@ -58,6 +55,7 @@ import com.sk89q.worldedit.function.visitor.LayerVisitor;
import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.Direction;
import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.convolution.GaussianKernel; import com.sk89q.worldedit.math.convolution.GaussianKernel;
@ -122,7 +120,7 @@ public class RegionCommands extends MethodCommands {
if (selection == null) { if (selection == null) {
final int cx = loc.x >> 4; final int cx = loc.x >> 4;
final int cz = loc.z >> 4; final int cz = loc.z >> 4;
selection = new CuboidRegion(new Vector(cx - 8, 0, cz - 8).multiply(16), new Vector(cx + 8, 0, cz + 8).multiply(16)); selection = new CuboidRegion(new BlockVector3(cx - 8, 0, cz - 8).multiply(16), new BlockVector3(cx + 8, 0, cz + 8).multiply(16));
} }
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.ALL); int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.ALL);
BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count); BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count);
@ -156,7 +154,7 @@ public class RegionCommands extends MethodCommands {
if (selection == null) { if (selection == null) {
final int cx = loc.x >> 4; final int cx = loc.x >> 4;
final int cz = loc.z >> 4; final int cz = loc.z >> 4;
selection = new CuboidRegion(new Vector(cx - 8, 0, cz - 8).multiply(16), new Vector(cx + 8, 0, cz + 8).multiply(16)); selection = new CuboidRegion(new BlockVector3(cx - 8, 0, cz - 8).multiply(16), new BlockVector3(cx + 8, 0, cz + 8).multiply(16));
} }
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.NONE); int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.NONE);
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count); BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
@ -173,7 +171,7 @@ public class RegionCommands extends MethodCommands {
BBC.NO_BLOCK.send(player); BBC.NO_BLOCK.send(player);
return; return;
} }
CompoundTag nbt = editSession.getBlock(pos.toVector()).getNbtData(); CompoundTag nbt = editSession.getBlock(pos.toVector().toBlockPoint()).getNbtData();
if (nbt != null) { if (nbt != null) {
player.print(nbt.getValue().toString()); player.print(nbt.getValue().toString());
} else { } else {
@ -194,11 +192,11 @@ public class RegionCommands extends MethodCommands {
final int cx = loc.x >> 4; final int cx = loc.x >> 4;
final int cz = loc.z >> 4; final int cz = loc.z >> 4;
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false); final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
for (Vector pt : region) { for (BlockVector3 pt : region) {
queue.setBlockLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value); queue.setBlockLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
} }
int count = 0; int count = 0;
for (Vector2D chunk : region.getChunks()) { for (BlockVector2 chunk : region.getChunks()) {
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ())); queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
count++; count++;
} }
@ -218,11 +216,11 @@ public class RegionCommands extends MethodCommands {
final int cx = loc.x >> 4; final int cx = loc.x >> 4;
final int cz = loc.z >> 4; final int cz = loc.z >> 4;
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false); final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
for (Vector pt : region) { for (BlockVector3 pt : region) {
queue.setSkyLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value); queue.setSkyLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
} }
int count = 0; int count = 0;
for (Vector2D chunk : region.getChunks()) { for (BlockVector2 chunk : region.getChunks()) {
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ())); queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
count++; count++;
} }
@ -290,14 +288,9 @@ public class RegionCommands extends MethodCommands {
} }
worldEdit.checkMaxRadius(thickness); worldEdit.checkMaxRadius(thickness);
<<<<<<< HEAD
player.checkConfirmationRegion(() -> { player.checkConfirmationRegion(() -> {
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
List<Vector> vectors = new ArrayList<Vector>(cpregion.getVertices());
=======
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices()); List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
@ -378,20 +371,19 @@ public class RegionCommands extends MethodCommands {
@Logging(REGION) @Logging(REGION)
public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, CommandContext context) throws WorldEditException { public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(() -> { player.checkConfirmationRegion(() -> {
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
int maxY = max.getBlockY(); int maxY = max.getBlockY();
int width = region.getWidth(); int width = region.getWidth();
int height = region.getLength(); int height = region.getLength();
int bx = min.getBlockX(); int bx = min.getBlockX();
int bz = min.getBlockZ(); int bz = min.getBlockZ();
Iterable<Vector2D> flat = Regions.asFlatRegion(region).asFlatRegion(); Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
Iterator<Vector2D> iter = new Fast2DIterator(flat, editSession).iterator(); Iterator<BlockVector2> iter = new Fast2DIterator(flat, editSession).iterator();
int y = 0; int y = 0;
int affected = 0; int affected = 0;
MutableBlockVector mutable = new MutableBlockVector();
while (iter.hasNext()) { while (iter.hasNext()) {
Vector2D pos = iter.next(); BlockVector2 pos = iter.next();
int x = pos.getBlockX(); int x = pos.getBlockX();
int z = pos.getBlockZ(); int z = pos.getBlockZ();
y = editSession.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY); y = editSession.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY);
@ -479,8 +471,8 @@ public class RegionCommands extends MethodCommands {
@CommandPermissions("worldedit.region.smoothsnow") @CommandPermissions("worldedit.region.smoothsnow")
@Logging(REGION) @Logging(REGION)
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Switch('n') boolean affectNatural, @Switch('s') boolean snow, CommandContext context) throws WorldEditException { public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Switch('n') boolean affectNatural, @Switch('s') boolean snow, CommandContext context) throws WorldEditException {
Vector min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
Vector max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = FawePlayer.wrap(player).getLimit(); FaweLimit limit = FawePlayer.wrap(player).getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
@ -551,8 +543,7 @@ public class RegionCommands extends MethodCommands {
public void move(FawePlayer player, LocalSession session, EditSession editSession, public void move(FawePlayer player, LocalSession session, EditSession editSession,
@Selection Region region, @Selection Region region,
@Optional("1") @Range(min = 1) int count, @Optional("1") @Range(min = 1) int count,
<<<<<<< HEAD @Optional(Direction.AIM) @Direction BlockVector3 direction,
@Optional(Direction.AIM) @Direction Vector direction,
@Optional("air") Pattern replace, @Optional("air") Pattern replace,
@Switch('b') boolean copyBiomes, @Switch('b') boolean copyBiomes,
@Switch('e') boolean skipEntities, @Switch('e') boolean skipEntities,
@ -571,22 +562,6 @@ public class RegionCommands extends MethodCommands {
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.sendMessage(BBC.getPrefix() + e.getMessage()); player.sendMessage(BBC.getPrefix() + e.getMessage());
} }
=======
@Optional(Direction.AIM) @Direction BlockVector3 direction,
@Optional("air") BlockStateHolder replace,
@Switch('s') boolean moveSelection) throws WorldEditException {
int affected = editSession.moveRegion(region, direction, count, true, replace);
if (moveSelection) {
try {
region.shift(direction.multiply(count));
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
} catch (RegionOperationException e) {
player.printError(e.getMessage());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(player, affected);
@ -637,7 +612,6 @@ public class RegionCommands extends MethodCommands {
@Optional("1") @Range(min = 1) int count, @Optional("1") @Range(min = 1) int count,
@Optional(Direction.AIM) @Direction BlockVector3 direction, @Optional(Direction.AIM) @Direction BlockVector3 direction,
@Switch('s') boolean moveSelection, @Switch('s') boolean moveSelection,
<<<<<<< HEAD
@Switch('b') boolean copyBiomes, @Switch('b') boolean copyBiomes,
@Switch('e') boolean skipEntities, @Switch('e') boolean skipEntities,
@Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException { @Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException {
@ -649,8 +623,8 @@ public class RegionCommands extends MethodCommands {
if (moveSelection) { if (moveSelection) {
try { try {
final Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1); final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
Vector shiftVector = new Vector(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count); BlockVector3 shiftVector = new BlockVector3(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
region.shift(shiftVector); region.shift(shiftVector);
session.getRegionSelector(player.getWorld()).learnChanges(); session.getRegionSelector(player.getWorld()).learnChanges();
@ -658,22 +632,6 @@ public class RegionCommands extends MethodCommands {
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.sendMessage(BBC.getPrefix() + e.getMessage()); player.sendMessage(BBC.getPrefix() + e.getMessage());
} }
=======
@Switch('a') boolean ignoreAirBlocks) throws WorldEditException {
int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks);
if (moveSelection) {
try {
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint();
region.shift(shiftVector);
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
} catch (RegionOperationException e) {
player.printError(e.getMessage());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(player, affected);
@ -699,17 +657,10 @@ public class RegionCommands extends MethodCommands {
@Selection Region region, @Selection Region region,
@Text String expression, @Text String expression,
@Switch('r') boolean useRawCoords, @Switch('r') boolean useRawCoords,
<<<<<<< HEAD
@Switch('o') boolean offset, @Switch('o') boolean offset,
CommandContext context) throws WorldEditException { CommandContext context) throws WorldEditException {
final Vector zero;
Vector unit;
=======
@Switch('o') boolean offset) throws WorldEditException {
final Vector3 zero; final Vector3 zero;
Vector3 unit; Vector3 unit;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (useRawCoords) { if (useRawCoords) {
zero = Vector3.ZERO; zero = Vector3.ZERO;
unit = Vector3.ONE; unit = Vector3.ONE;
@ -723,19 +674,15 @@ public class RegionCommands extends MethodCommands {
zero = max.add(min).divide(2); zero = max.add(min).divide(2);
unit = max.subtract(zero); unit = max.subtract(zero);
<<<<<<< HEAD
if (unit.getX() == 0) unit.mutX(1);
if (unit.getY() == 0) unit.mutY(1);
if (unit.getZ() == 0) unit.mutZ(1);
=======
if (unit.getX() == 0) unit = unit.withX(1.0); if (unit.getX() == 0) unit = unit.withX(1.0);
if (unit.getY() == 0) unit = unit.withY(1.0); if (unit.getY() == 0) unit = unit.withY(1.0);
if (unit.getZ() == 0) unit = unit.withZ(1.0); if (unit.getZ() == 0) unit = unit.withZ(1.0);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
final Vector3 unit1 = unit;
fp.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
try { try {
final int affected = editSession.deformRegion(region, zero, unit, expression); final int affected = editSession.deformRegion(region, zero, unit1, expression);
player.findFreePosition(); player.findFreePosition();
BBC.VISITOR_BLOCK.send(fp, affected); BBC.VISITOR_BLOCK.send(fp, affected);
} catch (ExpressionException e) { } catch (ExpressionException e) {

Datei anzeigen

@ -43,12 +43,10 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
<<<<<<< HEAD
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
=======
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
@ -69,10 +67,7 @@ import com.sk89q.worldedit.util.formatting.StyledFragment;
import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.util.formatting.component.CommandListBox;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
<<<<<<< HEAD
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
=======
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.storage.ChunkStore; import com.sk89q.worldedit.world.storage.ChunkStore;
import java.io.File; import java.io.File;
@ -109,21 +104,20 @@ public class SelectionCommands {
) )
@Logging(POSITION) @Logging(POSITION)
@CommandPermissions("worldedit.selection.pos") @CommandPermissions("worldedit.selection.pos")
public void pos1(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void pos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Vector pos; BlockVector3 pos;
if (args.argsLength() == 1) { if (args.argsLength() == 1) {
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) { if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
String[] coords = args.getString(0).split(","); String[] coords = args.getString(0).split(",");
pos = new Vector(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])); pos = new BlockVector3(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]));
} else { } else {
BBC.SELECTOR_INVALID_COORDINATES.send(player, args.getString(0)); BBC.SELECTOR_INVALID_COORDINATES.send(player, args.getString(0));
return; return;
} }
} else { } else {
pos = player.getBlockIn().toVector(); pos = player.getBlockIn().toVector().toBlockPoint();
} }
<<<<<<< HEAD
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY()); pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) { if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
BBC.SELECTOR_ALREADY_SET.send(player); BBC.SELECTOR_ALREADY_SET.send(player);
@ -131,16 +125,6 @@ public class SelectionCommands {
} }
session.getRegionSelector(player.getWorld()).explainPrimarySelection(player, session, pos); session.getRegionSelector(player.getWorld()).explainPrimarySelection(player, session, pos);
=======
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
player.printError("Position already set.");
return;
}
session.getRegionSelector(player.getWorld())
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -152,12 +136,12 @@ public class SelectionCommands {
) )
@Logging(POSITION) @Logging(POSITION)
@CommandPermissions("worldedit.selection.pos") @CommandPermissions("worldedit.selection.pos")
public void pos2(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void pos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Vector pos; BlockVector3 pos;
if (args.argsLength() == 1) { if (args.argsLength() == 1) {
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) { if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
String[] coords = args.getString(0).split(","); String[] coords = args.getString(0).split(",");
pos = new Vector(Integer.parseInt(coords[0]), pos = new BlockVector3(Integer.parseInt(coords[0]),
Integer.parseInt(coords[1]), Integer.parseInt(coords[1]),
Integer.parseInt(coords[2])); Integer.parseInt(coords[2]));
} else { } else {
@ -165,26 +149,16 @@ public class SelectionCommands {
return; return;
} }
} else { } else {
pos = player.getBlockIn().toVector(); pos = player.getBlockIn().toVector().toBlockPoint();
} }
<<<<<<< HEAD
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY()); pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) { if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
BBC.SELECTOR_ALREADY_SET.send(player); BBC.SELECTOR_ALREADY_SET.send(player);
=======
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
player.printError("Position already set.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return; return;
} }
session.getRegionSelector(player.getWorld()) session.getRegionSelector(player.getWorld())
<<<<<<< HEAD
.explainSecondarySelection(player, session, pos); .explainSecondarySelection(player, session, pos);
=======
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -195,26 +169,17 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.hpos") @CommandPermissions("worldedit.selection.hpos")
public void hpos1(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Vector pos = player.getBlockTrace(300).toVector(); BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
if (pos != null) { if (pos != null) {
<<<<<<< HEAD
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) { if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
BBC.SELECTOR_ALREADY_SET.send(player); BBC.SELECTOR_ALREADY_SET.send(player);
=======
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
player.printError("Position already set.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return; return;
} }
session.getRegionSelector(player.getWorld()) session.getRegionSelector(player.getWorld())
<<<<<<< HEAD
.explainPrimarySelection(player, session, pos); .explainPrimarySelection(player, session, pos);
=======
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} else { } else {
player.printError("No block in sight!"); player.printError("No block in sight!");
} }
@ -228,26 +193,17 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.hpos") @CommandPermissions("worldedit.selection.hpos")
public void hpos2(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Vector pos = player.getBlockTrace(300).toVector(); BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
if (pos != null) { if (pos != null) {
<<<<<<< HEAD
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) { if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
BBC.SELECTOR_ALREADY_SET.send(player); BBC.SELECTOR_ALREADY_SET.send(player);
=======
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
player.printError("Position already set.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return; return;
} }
session.getRegionSelector(player.getWorld()) session.getRegionSelector(player.getWorld())
<<<<<<< HEAD
.explainSecondarySelection(player, session, pos); .explainSecondarySelection(player, session, pos);
=======
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} else { } else {
player.printError("No block in sight!"); player.printError("No block in sight!");
} }
@ -271,15 +227,9 @@ public class SelectionCommands {
) )
@Logging(POSITION) @Logging(POSITION)
@CommandPermissions("worldedit.selection.chunk") @CommandPermissions("worldedit.selection.chunk")
<<<<<<< HEAD
public void chunk(Player player, LocalSession session, CommandContext args) throws WorldEditException {
final Vector min;
final Vector max;
=======
public void chunk(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void chunk(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
final BlockVector3 min; final BlockVector3 min;
final BlockVector3 max; final BlockVector3 max;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
final World world = player.getWorld(); final World world = player.getWorld();
if (args.hasFlag('s')) { if (args.hasFlag('s')) {
Region region = session.getSelection(world); Region region = session.getSelection(world);
@ -336,7 +286,7 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.wand") @CommandPermissions("worldedit.wand")
public void wand(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void wand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
player.giveItem(new BaseItemStack(we.getConfiguration().wandItem, 1)); player.giveItem(new BaseItemStack(we.getConfiguration().wandItem, 1));
BBC.SELECTION_WAND.send(player); BBC.SELECTION_WAND.send(player);
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
@ -370,7 +320,7 @@ public class SelectionCommands {
) )
@Logging(REGION) @Logging(REGION)
@CommandPermissions("worldedit.selection.expand") @CommandPermissions("worldedit.selection.expand")
public void expand(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void expand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
// Special syntax (//expand vert) to expand the selection between // Special syntax (//expand vert) to expand the selection between
// sky and bedrock. // sky and bedrock.
if (args.getString(0).equalsIgnoreCase("vert") || args.getString(0).equalsIgnoreCase("vertical")) { if (args.getString(0).equalsIgnoreCase("vert") || args.getString(0).equalsIgnoreCase("vertical")) {
@ -390,12 +340,7 @@ public class SelectionCommands {
return; return;
} }
<<<<<<< HEAD
List<Vector> dirs = new ArrayList<Vector>();
=======
List<BlockVector3> dirs = new ArrayList<>(); List<BlockVector3> dirs = new ArrayList<>();
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
int change = args.getInteger(0); int change = args.getInteger(0);
int reverseChange = 0; int reverseChange = 0;
@ -465,14 +410,9 @@ public class SelectionCommands {
) )
@Logging(REGION) @Logging(REGION)
@CommandPermissions("worldedit.selection.contract") @CommandPermissions("worldedit.selection.contract")
<<<<<<< HEAD
public void contract(Player player, LocalSession session, CommandContext args) throws WorldEditException {
List<Vector> dirs = new ArrayList<Vector>();
=======
public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
List<BlockVector3> dirs = new ArrayList<>(); List<BlockVector3> dirs = new ArrayList<>();
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
int change = args.getInteger(0); int change = args.getInteger(0);
int reverseChange = 0; int reverseChange = 0;
@ -544,14 +484,9 @@ public class SelectionCommands {
) )
@Logging(REGION) @Logging(REGION)
@CommandPermissions("worldedit.selection.shift") @CommandPermissions("worldedit.selection.shift")
<<<<<<< HEAD
public void shift(Player player, LocalSession session, CommandContext args) throws WorldEditException {
List<Vector> dirs = new ArrayList<Vector>();
=======
public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
List<BlockVector3> dirs = new ArrayList<>(); List<BlockVector3> dirs = new ArrayList<>();
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
int change = args.getInteger(0); int change = args.getInteger(0);
if (args.argsLength() == 2) { if (args.argsLength() == 2) {
if (args.getString(1).contains(",")) { if (args.getString(1).contains(",")) {
@ -596,7 +531,7 @@ public class SelectionCommands {
) )
@Logging(REGION) @Logging(REGION)
@CommandPermissions("worldedit.selection.outset") @CommandPermissions("worldedit.selection.outset")
public void outset(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void outset(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
region.expand(getChangesForEachDir(args)); region.expand(getChangesForEachDir(args));
session.getRegionSelector(player.getWorld()).learnChanges(); session.getRegionSelector(player.getWorld()).learnChanges();
@ -619,7 +554,7 @@ public class SelectionCommands {
) )
@Logging(REGION) @Logging(REGION)
@CommandPermissions("worldedit.selection.inset") @CommandPermissions("worldedit.selection.inset")
public void inset(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void inset(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
region.contract(getChangesForEachDir(args)); region.contract(getChangesForEachDir(args));
session.getRegionSelector(player.getWorld()).learnChanges(); session.getRegionSelector(player.getWorld()).learnChanges();
@ -627,13 +562,8 @@ public class SelectionCommands {
BBC.SELECTION_INSET.send(player); BBC.SELECTION_INSET.send(player);
} }
<<<<<<< HEAD
private Vector[] getChangesForEachDir(CommandContext args) {
List<Vector> changes = new ArrayList<Vector>(6);
=======
private BlockVector3[] getChangesForEachDir(CommandContext args) { private BlockVector3[] getChangesForEachDir(CommandContext args) {
List<BlockVector3> changes = new ArrayList<>(6); List<BlockVector3> changes = new ArrayList<>(6);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
int change = args.getInteger(0); int change = args.getInteger(0);
if (!args.hasFlag('h')) { if (!args.hasFlag('h')) {
@ -660,8 +590,7 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.size") @CommandPermissions("worldedit.selection.size")
<<<<<<< HEAD public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException {
if (args.hasFlag('c')) { if (args.hasFlag('c')) {
ClipboardHolder root = session.getClipboard(); ClipboardHolder root = session.getClipboard();
// Clipboard clipboard = holder.getClipboard(); // Clipboard clipboard = holder.getClipboard();
@ -681,8 +610,8 @@ public class SelectionCommands {
} }
Region region = clipboard.getRegion(); Region region = clipboard.getRegion();
Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(Vector.ONE); BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(BlockVector3.ONE);
Vector origin = clipboard.getOrigin(); BlockVector3 origin = clipboard.getOrigin();
String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ(); String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ();
String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ(); String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ();
@ -701,20 +630,19 @@ public class SelectionCommands {
// player.print(BBC.getPrefix() + "Offset: " + origin); // player.print(BBC.getPrefix() + "Offset: " + origin);
// player.print(BBC.getPrefix() + "Cuboid distance: " + size.distance(Vector.ONE)); // player.print(BBC.getPrefix() + "Cuboid distance: " + size.distance(Vector.ONE));
// player.print(BBC.getPrefix() + "# of blocks: " + (int) (size.getX() * size.getY() * size.getZ())); // player.print(BBC.getPrefix() + "# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
======= //=======
public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { // public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
if (args.hasFlag('c')) { // if (args.hasFlag('c')) {
ClipboardHolder holder = session.getClipboard(); // ClipboardHolder holder = session.getClipboard();
Clipboard clipboard = holder.getClipboard(); // Clipboard clipboard = holder.getClipboard();
Region region = clipboard.getRegion(); // Region region = clipboard.getRegion();
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()); // BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
BlockVector3 origin = clipboard.getOrigin(); // BlockVector3 origin = clipboard.getOrigin();
//
player.print("Cuboid dimensions (max - min): " + size); // player.print("Cuboid dimensions (max - min): " + size);
player.print("Offset: " + origin); // player.print("Offset: " + origin);
player.print("Cuboid distance: " + size.distance(BlockVector3.ONE)); // player.print("Cuboid distance: " + size.distance(BlockVector3.ONE));
player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ())); // player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return; return;
} }
@ -723,11 +651,7 @@ public class SelectionCommands {
.subtract(region.getMinimumPoint()) .subtract(region.getMinimumPoint())
.add(1, 1, 1); .add(1, 1, 1);
<<<<<<< HEAD
player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld()) player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld())
=======
player.print("Type: " + session.getRegionSelector(player.getWorld())
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
.getTypeName()); .getTypeName());
for (String line : session.getRegionSelector(player.getWorld()) for (String line : session.getRegionSelector(player.getWorld())
@ -735,15 +659,9 @@ public class SelectionCommands {
player.print(BBC.getPrefix() + line); player.print(BBC.getPrefix() + line);
} }
<<<<<<< HEAD
player.print(BBC.getPrefix() + "Size: " + size); player.print(BBC.getPrefix() + "Size: " + size);
player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint())); player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
player.print(BBC.getPrefix() + "# of blocks: " + region.getArea()); player.print(BBC.getPrefix() + "# of blocks: " + region.getArea());
=======
player.print("Size: " + size);
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
player.print("# of blocks: " + region.getArea());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
<<<<<<< HEAD
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.command.FaweParser; import com.boydti.fawe.command.FaweParser;
@ -40,10 +39,8 @@ import com.boydti.fawe.util.gui.FormBuilder;
import com.boydti.fawe.util.image.ImageUtil; import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.minecraft.util.commands.*; import com.sk89q.minecraft.util.commands.*;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
=======
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
@ -57,7 +54,6 @@ import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.command.util.CreatureButcher; import com.sk89q.worldedit.command.util.CreatureButcher;
import com.sk89q.worldedit.command.util.EntityRemover; import com.sk89q.worldedit.command.util.EntityRemover;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
@ -260,7 +256,6 @@ public class UtilityCommands extends MethodCommands {
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled); BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
} }
<<<<<<< HEAD
@Command( @Command(
aliases = {"/fill"}, aliases = {"/fill"},
usage = "<pattern> <radius> [depth] [direction]", usage = "<pattern> <radius> [depth] [direction]",
@ -270,17 +265,12 @@ public class UtilityCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.fill") @CommandPermissions("worldedit.fill")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void fill(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("1") double depth, @Optional("down") @Direction Vector direction) throws WorldEditException { public void fill(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("1") double depth, @Optional("down") @Direction BlockVector3 direction) throws WorldEditException {
worldEdit.checkMaxRadius(radius); worldEdit.checkMaxRadius(radius);
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
int affected; int affected;
affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction); affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction);
player.print(BBC.getPrefix() + affected + " block(s) have been created."); player.print(BBC.getPrefix() + affected + " block(s) have been created.");
=======
BlockVector3 pos = session.getPlacementPosition(player);
int affected = editSession.fillXZ(pos, pattern, radius, depth, false);
player.print(affected + " block(s) have been created.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -292,35 +282,34 @@ public class UtilityCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.fill.recursive") @CommandPermissions("worldedit.fill.recursive")
@Logging(PLACEMENT) @Logging(PLACEMENT)
<<<<<<< HEAD
public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException { public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException {
worldEdit.checkMaxRadius(radius); worldEdit.checkMaxRadius(radius);
Vector pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);
if (depth == -1) depth = Integer.MAX_VALUE; if (depth == -1) depth = Integer.MAX_VALUE;
int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true); int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true);
player.print(BBC.getPrefix() + affected + " block(s) have been created."); player.print(BBC.getPrefix() + affected + " block(s) have been created.");
======= //=======
public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { // public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
//
ParserContext context = new ParserContext(); // ParserContext context = new ParserContext();
context.setActor(player); // context.setActor(player);
context.setWorld(player.getWorld()); // context.setWorld(player.getWorld());
context.setSession(session); // context.setSession(session);
Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); // Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
//
double radius = Math.max(1, args.getDouble(1)); // double radius = Math.max(1, args.getDouble(1));
we.checkMaxRadius(radius); // we.checkMaxRadius(radius);
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE; // int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE;
//
BlockVector3 pos = session.getPlacementPosition(player); // BlockVector3 pos = session.getPlacementPosition(player);
int affected = 0; // int affected = 0;
if (pattern instanceof BlockPattern) { // if (pattern instanceof BlockPattern) {
affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true); // affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true);
} else { // } else {
affected = editSession.fillXZ(pos, pattern, radius, depth, true); // affected = editSession.fillXZ(pos, pattern, radius, depth, true);
} // }
player.print(affected + " block(s) have been created."); // player.print(affected + " block(s) have been created.");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner //>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Command( @Command(
@ -430,16 +419,10 @@ public class UtilityCommands extends MethodCommands {
if (from == null) { if (from == null) {
from = new ExistingBlockMask(editSession); from = new ExistingBlockMask(editSession);
} }
<<<<<<< HEAD
Vector base = session.getPlacementPosition(player);
Vector min = base.subtract(size, size, size);
Vector max = base.add(size, size, size);
=======
BlockVector3 base = session.getPlacementPosition(player); BlockVector3 base = session.getPlacementPosition(player);
BlockVector3 min = base.subtract(size, size, size); BlockVector3 min = base.subtract((int)size, (int)size, (int)size);
BlockVector3 max = base.add(size, size, size); BlockVector3 max = base.add((int)size, (int)size, (int)size);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
Region region = new CuboidRegion(player.getWorld(), min, max); Region region = new CuboidRegion(player.getWorld(), min, max);
int affected = editSession.replaceBlocks(region, from, to); int affected = editSession.replaceBlocks(region, from, to);
@ -574,13 +557,8 @@ public class UtilityCommands extends MethodCommands {
EditSession editSession = null; EditSession editSession = null;
if (player != null) { if (player != null) {
<<<<<<< HEAD
session = worldEdit.getSessionManager().get(player); session = worldEdit.getSessionManager().get(player);
Vector center = session.getPlacementPosition(player);
=======
session = we.getSessionManager().get(player);
BlockVector3 center = session.getPlacementPosition(player); BlockVector3 center = session.getPlacementPosition(player);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
editSession = session.createEditSession(player); editSession = session.createEditSession(player);
List<? extends Entity> entities; List<? extends Entity> entities;
if (radius >= 0) { if (radius >= 0) {
@ -639,13 +617,8 @@ public class UtilityCommands extends MethodCommands {
EditSession editSession = null; EditSession editSession = null;
if (player != null) { if (player != null) {
<<<<<<< HEAD
session = worldEdit.getSessionManager().get(player); session = worldEdit.getSessionManager().get(player);
Vector center = session.getPlacementPosition(player);
=======
session = we.getSessionManager().get(player);
BlockVector3 center = session.getPlacementPosition(player); BlockVector3 center = session.getPlacementPosition(player);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
editSession = session.createEditSession(player); editSession = session.createEditSession(player);
List<? extends Entity> entities; List<? extends Entity> entities;
if (radius >= 0) { if (radius >= 0) {

Datei anzeigen

@ -3,18 +3,12 @@ package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
<<<<<<< HEAD
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
=======
import com.sk89q.worldedit.MaxChangedBlocksException; 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.math.BlockVector3;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
@ -49,7 +43,6 @@ public class AreaPickaxe implements BlockTool {
return true; return true;
} }
<<<<<<< HEAD
EditSession editSession = session.createEditSession(player); EditSession editSession = session.createEditSession(player);
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
@ -58,24 +51,22 @@ public class AreaPickaxe implements BlockTool {
for (int y = oy + range; y >= oy - range; --y) { for (int y = oy + range; y >= oy - range; --y) {
if (initialType.equals(editSession.getLazyBlock(x, y, z))) { if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
continue; continue;
======= // try (EditSession editSession = session.createEditSession(player)) {
try (EditSession editSession = session.createEditSession(player)) { // editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); //
// try {
try { // for (int x = ox - range; x <= ox + range; ++x) {
for (int x = ox - range; x <= ox + range; ++x) { // for (int y = oy - range; y <= oy + range; ++y) {
for (int y = oy - range; y <= oy + range; ++y) { // for (int z = oz - range; z <= oz + range; ++z) {
for (int z = oz - range; z <= oz + range; ++z) { // BlockVector3 pos = new BlockVector3(x, y, z);
BlockVector3 pos = new BlockVector3(x, y, z); // if (editSession.getBlock(pos).getBlockType() != initialType) {
if (editSession.getBlock(pos).getBlockType() != initialType) { // continue;
continue; // }
} //
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos)); //
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); // }
}
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState()); editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
} }

Datei anzeigen

@ -19,6 +19,12 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
@ -26,13 +32,11 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
<<<<<<< HEAD
=======
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.Property;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
/** /**
@ -45,17 +49,16 @@ public class BlockDataCyler implements DoubleActionBlockTool {
return player.hasPermission("worldedit.tool.data-cycler"); return player.hasPermission("worldedit.tool.data-cycler");
} }
private Map<UUID, Property<?>> selectedProperties = new HashMap<>();
private boolean handleCycle(Platform server, LocalConfiguration config, private boolean handleCycle(Platform server, LocalConfiguration config,
Player player, LocalSession session, Location clicked, boolean forward) { Player player, LocalSession session, Location clicked, boolean forward) {
World world = (World) clicked.getExtent(); World world = (World) clicked.getExtent();
<<<<<<< HEAD // BlockStateHolder block = world.getBlock(clicked.toVector());
BlockStateHolder block = world.getBlock(clicked.toVector());
=======
BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
BlockState block = world.getBlock(blockPoint); BlockState block = world.getBlock(blockPoint);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (!config.allowedDataCycleBlocks.isEmpty() if (!config.allowedDataCycleBlocks.isEmpty()
&& !player.hasPermission("worldedit.override.data-cycler") && !player.hasPermission("worldedit.override.data-cycler")
@ -64,25 +67,10 @@ public class BlockDataCyler implements DoubleActionBlockTool {
return true; return true;
} }
if (block.getBlockType().getProperties().isEmpty()) { if (block.getStates().keySet().isEmpty()) {
player.printError("That block's data cannot be cycled!"); player.printError("That block's data cannot be cycled!");
} else { } else {
<<<<<<< HEAD Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
BlockStateHolder newBlock = block;
// TODO Forward = cycle value, Backward = Next property
// int increment = forward ? 1 : -1;
// BaseBlock newBlock = new BaseBlock(type, BlockData.cycle(type, data, increment));
EditSession editSession = session.createEditSession(player);
try {
editSession.setBlock(clicked.toVector(), newBlock);
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
session.remember(editSession);
=======
Property currentProperty = selectedProperties.get(player.getUniqueId());
if (currentProperty == null || (forward && block.getState(currentProperty) == null)) { if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
currentProperty = block.getStates().keySet().stream().findFirst().get(); currentProperty = block.getStates().keySet().stream().findFirst().get();
@ -93,11 +81,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
block.getState(currentProperty); block.getState(currentProperty);
int index = currentProperty.getValues().indexOf(block.getState(currentProperty)); int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
index = (index + 1) % currentProperty.getValues().size(); index = (index + 1) % currentProperty.getValues().size();
BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index)); @SuppressWarnings("unchecked")
Property<Object> objProp = (Property<Object>) currentProperty;
try (EditSession editSession = session.createEditSession(player)) { BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));
editSession.disableBuffering();
try {
EditSession editSession = session.createEditSession(player);
try { try {
editSession.setBlock(blockPoint, newBlock); editSession.setBlock(blockPoint, newBlock);
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
@ -106,7 +95,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
} finally { } finally {
session.remember(editSession); session.remember(editSession);
} }
} }catch (Exception e) {}
} else { } else {
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet()); List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
int index = properties.indexOf(currentProperty); int index = properties.indexOf(currentProperty);
@ -114,10 +103,8 @@ public class BlockDataCyler implements DoubleActionBlockTool {
currentProperty = properties.get(index); currentProperty = properties.get(index);
selectedProperties.put(player.getUniqueId(), currentProperty); selectedProperties.put(player.getUniqueId(), currentProperty);
player.print("Now cycling " + currentProperty.getName()); player.print("Now cycling " + currentProperty.getName());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
} }
return true; return true;
} }

Datei anzeigen

@ -58,22 +58,10 @@ public class BlockReplacer implements DoubleActionBlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
BlockBag bag = session.getBlockBag(player); BlockBag bag = session.getBlockBag(player);
<<<<<<< HEAD
EditSession editSession = session.createEditSession(player); EditSession editSession = session.createEditSession(player);
try { try {
editSession.setBlock(clicked.toVector(), pattern); editSession.setBlock(clicked.toVector().toBlockPoint(), pattern);
=======
try (EditSession editSession = session.createEditSession(player)) {
try {
editSession.disableBuffering();
BlockVector3 position = clicked.toVector().toBlockPoint();
editSession.setBlock(position, pattern.apply(position));
} catch (MaxChangedBlocksException ignored) {
} finally {
session.remember(editSession);
}
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} finally { } finally {
if (bag != null) { if (bag != null) {
bag.flushChanges(); bag.flushChanges();
@ -87,13 +75,9 @@ public class BlockReplacer implements DoubleActionBlockTool {
@Override @Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
<<<<<<< HEAD
EditSession editSession = session.createEditSession(player); EditSession editSession = session.createEditSession(player);
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector()); BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector().toBlockPoint());
BlockType type = targetBlock.getBlockType(); BlockType type = targetBlock.getBlockType();
=======
BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (type != null) { if (type != null) {
this.pattern = targetBlock; this.pattern = targetBlock;

Datei anzeigen

@ -24,6 +24,8 @@ import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.internal.expression.Expression; 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.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.command.tool.brush.Brush;
@ -379,19 +381,19 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
this.range = range; this.range = range;
} }
public Vector getPosition(EditSession editSession, Player player) { public BlockVector3 getPosition(EditSession editSession, Player player) {
Location loc = player.getLocation(); Location loc = player.getLocation();
switch (targetMode) { switch (targetMode) {
case TARGET_BLOCK_RANGE: case TARGET_BLOCK_RANGE:
return offset(new MutableBlockVector(trace(editSession, player, getRange(), true)), loc.toVector()); return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
case FOWARD_POINT_PITCH: { case FOWARD_POINT_PITCH: {
int d = 0; int d = 0;
float pitch = loc.getPitch(); float pitch = loc.getPitch();
pitch = 23 - (pitch / 4); pitch = 23 - (pitch / 4);
d += (int) (Math.sin(Math.toRadians(pitch)) * 50); d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
final Vector vector = loc.getDirection().setY(0).normalize().multiply(d); final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
vector.add(loc.getX(), loc.getY(), loc.getZ()).toBlockVector(); // vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
return offset(new MutableBlockVector(vector), loc.toVector()); return offset(vector, loc.toVector()).toBlockPoint();
} }
case TARGET_POINT_HEIGHT: { case TARGET_POINT_HEIGHT: {
final int height = loc.getBlockY(); final int height = loc.getBlockY();
@ -405,34 +407,33 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
} }
} }
final int distance = (height - y) + 8; final int distance = (height - y) + 8;
return offset(new MutableBlockVector(trace(editSession, player, distance, true)), loc.toVector()); return offset(trace(editSession, player, distance, true), loc.toVector()).toBlockPoint();
} }
case TARGET_FACE_RANGE: case TARGET_FACE_RANGE:
return offset(new MutableBlockVector(trace(editSession, player, getRange(), true)), loc.toVector()); return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
default: default:
return null; return null;
} }
} }
private Vector offset(Vector target, Vector playerPos) { private Vector3 offset(Vector3 target, Vector3 playerPos) {
if (targetOffset == 0) return target; if (targetOffset == 0) return target;
return target.subtract(target.subtract(playerPos).normalize().multiply(targetOffset)); return target.subtract(target.subtract(playerPos).normalize().multiply(targetOffset));
} }
private Vector trace(EditSession editSession, Player player, int range, boolean useLastBlock) { private Vector3 trace(EditSession editSession, Player player, int range, boolean useLastBlock) {
Mask mask = targetMask == null ? new SolidBlockMask(editSession) : targetMask; Mask mask = targetMask == null ? new SolidBlockMask(editSession) : targetMask;
new MaskTraverser(mask).reset(editSession); new MaskTraverser(mask).reset(editSession);
MaskedTargetBlock tb = new MaskedTargetBlock(mask, player, range, 0.2); MaskedTargetBlock tb = new MaskedTargetBlock(mask, player, range, 0.2);
return TaskManager.IMP.sync(new RunnableVal<Vector>() { return TaskManager.IMP.sync(new RunnableVal<Vector3>() {
@Override @Override
public void run(Vector value) { public void run(Vector3 value) {
Location result = tb.getMaskedTargetBlock(useLastBlock); Location result = tb.getMaskedTargetBlock(useLastBlock);
this.value = result.toVector(); this.value = result.toVector();
} }
}); });
} }
<<<<<<< HEAD
public boolean act(BrushAction action, Platform server, LocalConfiguration config, Player player, LocalSession session) { public boolean act(BrushAction action, Platform server, LocalConfiguration config, Player player, LocalSession session) {
switch (action) { switch (action) {
case PRIMARY: case PRIMARY:
@ -454,7 +455,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
return false; return false;
} }
Vector target = getPosition(editSession, player); BlockVector3 target = getPosition(editSession, player);
if (target == null) { if (target == null) {
editSession.cancel(); editSession.cancel();
@ -475,14 +476,14 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
MaskIntersection newMask = new MaskIntersection(existingMask); MaskIntersection newMask = new MaskIntersection(existingMask);
newMask.add(mask); newMask.add(mask);
editSession.setMask(newMask); editSession.setMask(newMask);
======= //=======
try { // try {
brush.build(editSession, target.toVector().toBlockPoint(), material, size); // brush.build(editSession, target.toVector().toBlockPoint(), material, size);
} catch (MaxChangedBlocksException e) { // } catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached."); // player.printError("Max blocks change limit reached.");
} finally { // } finally {
session.remember(editSession); // session.remember(editSession);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner //>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
} }
Mask sourceMask = current.getSourceMask(); Mask sourceMask = current.getSourceMask();
@ -622,7 +623,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
.combineStages(false) .combineStages(false)
.build(); .build();
VisualExtent newVisualExtent = new VisualExtent(editSession.getExtent(), editSession.getQueue()); VisualExtent newVisualExtent = new VisualExtent(editSession.getExtent(), editSession.getQueue());
Vector position = getPosition(editSession, player); BlockVector3 position = getPosition(editSession, player);
if (position != null) { if (position != null) {
editSession.setExtent(newVisualExtent); editSession.setExtent(newVisualExtent);
switch (mode) { switch (mode) {

Datei anzeigen

@ -75,24 +75,8 @@ public class FloatingTreeRemover implements BlockTool {
player.printError("That's not a tree."); player.printError("That's not a tree.");
return true; return true;
} }
<<<<<<< HEAD
final EditSession editSession = session.createEditSession(player); final EditSession editSession = session.createEditSession(player);
try /*(EditSession editSession = session.createEditSession(player))*/ {
try {
final Set<Vector> blockSet = bfs(world, clicked.toVector());
if (blockSet == null) {
player.printError("That's not a floating tree.");
return true;
}
for (Vector blockVector : blockSet) {
final BlockState otherState = editSession.getBlock(blockVector);
if (isTreeBlock(otherState.getBlockType())) {
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
=======
try (EditSession editSession = session.createEditSession(player)) {
try {
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint()); final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
if (blockSet == null) { if (blockSet == null) {
player.printError("That's not a floating tree."); player.printError("That's not a floating tree.");
@ -104,8 +88,6 @@ public class FloatingTreeRemover implements BlockTool {
if (isTreeBlock(otherState.getBlockType())) { if (isTreeBlock(otherState.getBlockType())) {
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState()); editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
} }
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
} }
} catch (MaxChangedBlocksException e) { } catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached."); player.printError("Max blocks change limit reached.");

Datei anzeigen

@ -19,14 +19,11 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
<<<<<<< HEAD
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
=======
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
@ -62,12 +59,8 @@ public class FloodFillTool implements BlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
World world = (World) clicked.getExtent(); World world = (World) clicked.getExtent();
<<<<<<< HEAD
BlockType initialType = world.getBlockType(clicked.toVector());
=======
BlockVector3 origin = clicked.toVector().toBlockPoint(); BlockVector3 origin = clicked.toVector().toBlockPoint();
BlockType initialType = world.getBlock(origin).getBlockType(); BlockType initialType = world.getBlock(origin).getBlockType();
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (initialType.getMaterial().isAir()) { if (initialType.getMaterial().isAir()) {
return true; return true;
@ -77,10 +70,7 @@ public class FloodFillTool implements BlockTool {
return true; return true;
} }
<<<<<<< HEAD
EditSession editSession = session.createEditSession(player); EditSession editSession = session.createEditSession(player);
=======
try (EditSession editSession = session.createEditSession(player)) {
try { try {
recurse(editSession, origin, origin, range, initialType, new HashSet<>()); recurse(editSession, origin, origin, range, initialType, new HashSet<>());
} catch (MaxChangedBlocksException e) { } catch (MaxChangedBlocksException e) {
@ -88,27 +78,14 @@ public class FloodFillTool implements BlockTool {
} finally { } finally {
session.remember(editSession); session.remember(editSession);
} }
}
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
try {
recurse(editSession, clicked.toVector().toBlockVector(),
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
editSession.flushQueue(); editSession.flushQueue();
session.remember(editSession); session.remember(editSession);
return true; return true;
} }
<<<<<<< HEAD
private void recurse(EditSession editSession, BlockVector pos, Vector origin, int size, BlockType initialType,
Set<BlockVector> visited) throws WorldEditException {
=======
private void recurse(EditSession editSession, BlockVector3 pos, BlockVector3 origin, int size, BlockType initialType, private void recurse(EditSession editSession, BlockVector3 pos, BlockVector3 origin, int size, BlockType initialType,
Set<BlockVector3> visited) throws MaxChangedBlocksException { Set<BlockVector3> visited) throws MaxChangedBlocksException {
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
if (origin.distance(pos) > size || visited.contains(pos)) { if (origin.distance(pos) > size || visited.contains(pos)) {
return; return;

Datei anzeigen

@ -56,11 +56,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) { public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location pos = getTargetFace(player); Location pos = getTargetFace(player);
if (pos == null) return false; if (pos == null) return false;
<<<<<<< HEAD
EditSession eS = session.createEditSession(player); EditSession eS = session.createEditSession(player);
======= try {
try (EditSession eS = session.createEditSession(player)) { // eS.disableBuffering();
eS.disableBuffering();
BlockVector3 blockPoint = pos.toVector().toBlockPoint(); BlockVector3 blockPoint = pos.toVector().toBlockPoint();
BlockStateHolder applied = secondary.apply(blockPoint); BlockStateHolder applied = secondary.apply(blockPoint);
if (applied.getBlockType().getMaterial().isAir()) { if (applied.getBlockType().getMaterial().isAir()) {
@ -73,31 +71,16 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
// one block? eat it // one block? eat it
} }
return false; return false;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
BlockStateHolder applied = secondary.apply(pos.toVector());
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), secondary);
} else {
eS.setBlock(pos.add(pos.getDirection()), secondary);
}
return true;
} }
@Override @Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location pos = getTargetFace(player); Location pos = getTargetFace(player);
if (pos == null) return false; if (pos == null) return false;
<<<<<<< HEAD
EditSession eS = session.createEditSession(player); EditSession eS = session.createEditSession(player);
BlockStateHolder applied = primary.apply(pos.toVector());
if (applied.getBlockType().getMaterial().isAir()) { try {
eS.setBlock(pos.toVector(), primary); // eS.disableBuffering();
} else {
eS.setBlock(pos.add(pos.getDirection()), primary);
=======
try (EditSession eS = session.createEditSession(player)) {
eS.disableBuffering();
BlockVector3 blockPoint = pos.toVector().toBlockPoint(); BlockVector3 blockPoint = pos.toVector().toBlockPoint();
BlockStateHolder applied = primary.apply(blockPoint); BlockStateHolder applied = primary.apply(blockPoint);
if (applied.getBlockType().getMaterial().isAir()) { if (applied.getBlockType().getMaterial().isAir()) {
@ -108,7 +91,6 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
return true; return true;
} catch (MaxChangedBlocksException e) { } catch (MaxChangedBlocksException e) {
// one block? eat it // one block? eat it
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
return true; return true;
} }

Datei anzeigen

@ -1,11 +1,11 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
<<<<<<< HEAD import java.util.Set;
import com.boydti.fawe.object.mask.IdMask; import com.boydti.fawe.object.mask.IdMask;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
@ -13,7 +13,6 @@ import com.sk89q.worldedit.function.block.BlockReplace;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
=======
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
@ -22,9 +21,9 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
/** /**
@ -46,14 +45,11 @@ public class RecursivePickaxe implements BlockTool {
@Override @Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent(); World world = (World) clicked.getExtent();
final Vector pos = clicked.toVector(); final BlockVector3 pos = clicked.toVector().toBlockPoint();
<<<<<<< HEAD
EditSession editSession = session.createEditSession(player); EditSession editSession = session.createEditSession(player);
=======
BlockVector3 origin = clicked.toVector().toBlockPoint(); BlockVector3 origin = clicked.toVector().toBlockPoint();
BlockType initialType = world.getBlock(origin).getBlockType(); BlockType initialType = world.getBlock(origin).getBlockType();
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
BlockStateHolder block = editSession.getBlock(pos); BlockStateHolder block = editSession.getBlock(pos);
if (block.getBlockType().getMaterial().isAir()) { if (block.getBlockType().getMaterial().isAir()) {
@ -66,7 +62,7 @@ public class RecursivePickaxe implements BlockTool {
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
<<<<<<< HEAD //<<<<<<< HEAD
final int radius = (int) range; final int radius = (int) range;
final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock)); final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock));
editSession.setMask((Mask) null); editSession.setMask((Mask) null);
@ -76,54 +72,51 @@ public class RecursivePickaxe implements BlockTool {
editSession.flushQueue(); editSession.flushQueue();
session.remember(editSession); session.remember(editSession);
======= //=======
try { // try {
recurse(server, editSession, world, clicked.toVector().toBlockPoint(), // recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>()); // clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
} catch (MaxChangedBlocksException e) { // } catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached."); // player.printError("Max blocks change limit reached.");
} finally { // } finally {
session.remember(editSession); // session.remember(editSession);
} // }
} // }
>>>>>>> 399e0ad5... Refactor vector system to be cleaner //>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return true; return true;
} }
<<<<<<< HEAD // private static void recurse(Platform server, EditSession editSession, World world, BlockVector3 pos,
======= // BlockVector3 origin, double size, BlockType initialType, Set<BlockVector3> visited) throws MaxChangedBlocksException {
private static void recurse(Platform server, EditSession editSession, World world, BlockVector3 pos, //
BlockVector3 origin, double size, BlockType initialType, Set<BlockVector3> visited) throws MaxChangedBlocksException { // final double distanceSq = origin.distanceSq(pos);
// if (distanceSq > size*size || visited.contains(pos)) {
final double distanceSq = origin.distanceSq(pos); // return;
if (distanceSq > size*size || visited.contains(pos)) { // }
return; //
} // visited.add(pos);
//
visited.add(pos); // if (editSession.getBlock(pos).getBlockType() != initialType) {
// return;
if (editSession.getBlock(pos).getBlockType() != initialType) { // }
return; //
} // world.queueBlockBreakEffect(server, pos, initialType, distanceSq);
//
world.queueBlockBreakEffect(server, pos, initialType, distanceSq); // editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
//
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); // recurse(server, editSession, world, pos.add(1, 0, 0),
// origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(1, 0, 0), // recurse(server, editSession, world, pos.add(-1, 0, 0),
origin, size, initialType, visited); // origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(-1, 0, 0), // recurse(server, editSession, world, pos.add(0, 0, 1),
origin, size, initialType, visited); // origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, 0, 1), // recurse(server, editSession, world, pos.add(0, 0, -1),
origin, size, initialType, visited); // origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, 0, -1), // recurse(server, editSession, world, pos.add(0, 1, 0),
origin, size, initialType, visited); // origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, 1, 0), // recurse(server, editSession, world, pos.add(0, -1, 0),
origin, size, initialType, visited); // origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, -1, 0), // }
origin, size, initialType, visited);
}
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
@ -43,29 +44,19 @@ public class SinglePickaxe implements BlockTool {
@Override @Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent(); World world = (World) clicked.getExtent();
<<<<<<< HEAD
final BlockType blockType = world.getLazyBlock(clicked.toVector()).getBlockType();
if (blockType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) {
return true;
}
EditSession editSession = session.createEditSession(player);
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
=======
BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
final BlockType blockType = world.getBlock(blockPoint).getBlockType(); final BlockType blockType = world.getBlock(blockPoint).getBlockType();
if (blockType == BlockTypes.BEDROCK if (blockType == BlockTypes.BEDROCK
&& !player.canDestroyBedrock()) { && !player.canDestroyBedrock()) {
return true; return true;
} }
final EditSession editSession = session.createEditSession(player);
try (EditSession editSession = session.createEditSession(player)) { try {
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop); editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState()); editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
} catch (MaxChangedBlocksException e) { } catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached."); player.printError("Max blocks change limit reached.");
} }
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
try { try {
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) { if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {

Datei anzeigen

@ -50,22 +50,13 @@ public class TreePlanter implements BlockTool {
EditSession editSession = session.createEditSession(player); EditSession editSession = session.createEditSession(player);
<<<<<<< HEAD
try { try {
boolean successful = false; boolean successful = false;
for (int i = 0; i < 10; i++) {
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) {
successful = true;
break;
=======
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) { if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
successful = true; successful = true;
break; break;
} }
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
} }
if (!successful) { if (!successful) {

Datei anzeigen

@ -20,13 +20,9 @@
package com.sk89q.worldedit.event.extent; package com.sk89q.worldedit.event.extent;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
<<<<<<< HEAD
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Cancellable;
=======
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
@ -59,11 +55,7 @@ import static com.sk89q.worldedit.EditSession.Stage;
* is set to {@link Stage#BEFORE_HISTORY}, then you can drop (or log) changes * is set to {@link Stage#BEFORE_HISTORY}, then you can drop (or log) changes
* before the change has reached the history, reordering, and actual change * before the change has reached the history, reordering, and actual change
* extents, <em>but</em> that means that any changes made with * extents, <em>but</em> that means that any changes made with
<<<<<<< HEAD
* {@link EditSession#rawSetBlock(Vector, BaseBlock)} will skip your
=======
* {@link EditSession#rawSetBlock(BlockVector3, BlockStateHolder)} will skip your * {@link EditSession#rawSetBlock(BlockVector3, BlockStateHolder)} will skip your
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
* custom {@link Extent} because that method bypasses history (and reorder). * custom {@link Extent} because that method bypasses history (and reorder).
* It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE} * It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE}
* and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and * and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and

Datei anzeigen

@ -19,12 +19,13 @@
package com.sk89q.worldedit.event.extent; package com.sk89q.worldedit.event.extent;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import java.net.URI; import java.net.URI;
@ -35,11 +36,11 @@ public class PasteEvent extends Event implements Cancellable {
private final Player player; private final Player player;
private final Clipboard clipboard; private final Clipboard clipboard;
private final URI uri; private final URI uri;
private final Vector to; private final BlockVector3 to;
private final Extent extent; private final Extent extent;
private boolean cancelled; private boolean cancelled;
public PasteEvent(Player player, Clipboard clipboard, URI uri, Extent extent, Vector to) { public PasteEvent(Player player, Clipboard clipboard, URI uri, Extent extent, BlockVector3 to) {
this.player = player; this.player = player;
this.clipboard = clipboard; this.clipboard = clipboard;
this.uri = uri; this.uri = uri;
@ -59,7 +60,7 @@ public class PasteEvent extends Event implements Cancellable {
return uri; return uri;
} }
public Vector getPosition() { public BlockVector3 getPosition() {
return to; return to;
} }

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.extension.factory; package com.sk89q.worldedit.extension.factory;
<<<<<<< HEAD
import com.boydti.fawe.command.SuggestInputParseException; import com.boydti.fawe.command.SuggestInputParseException;
import com.boydti.fawe.jnbt.JSON2NBT; import com.boydti.fawe.jnbt.JSON2NBT;
import com.boydti.fawe.jnbt.NBTException; import com.boydti.fawe.jnbt.NBTException;
@ -31,13 +30,10 @@ import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
=======
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.blocks.MobSpawnerBlock; import com.sk89q.worldedit.blocks.MobSpawnerBlock;
import com.sk89q.worldedit.blocks.SignBlock; import com.sk89q.worldedit.blocks.SignBlock;
import com.sk89q.worldedit.blocks.SkullBlock; import com.sk89q.worldedit.blocks.SkullBlock;
@ -52,11 +48,8 @@ import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.extent.inventory.SlottableBlockBag; import com.sk89q.worldedit.extent.inventory.SlottableBlockBag;
import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.internal.registry.InputParser;
<<<<<<< HEAD
=======
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.Property;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -211,11 +204,7 @@ public class DefaultBlockParser extends InputParser<BlockStateHolder> {
int index = Integer.parseInt(typeString.replaceAll("[a-z]+", "")); int index = Integer.parseInt(typeString.replaceAll("[a-z]+", ""));
// Get the block type from the "primary position" // Get the block type from the "primary position"
final World world = context.requireWorld(); final World world = context.requireWorld();
<<<<<<< HEAD
final Vector primaryPosition;
=======
final BlockVector3 primaryPosition; final BlockVector3 primaryPosition;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
try { try {
primaryPosition = context.requireSession().getRegionSelector(world).getVerticies().get(index - 1); primaryPosition = context.requireSession().getRegionSelector(world).getVerticies().get(index - 1);
} catch (IncompleteRegionException e) { } catch (IncompleteRegionException e) {

Datei anzeigen

@ -1,15 +1,12 @@
package com.sk89q.worldedit.extension.factory; package com.sk89q.worldedit.extension.factory;
<<<<<<< HEAD
import com.boydti.fawe.command.FaweParser; import com.boydti.fawe.command.FaweParser;
import com.boydti.fawe.command.SuggestInputParseException; import com.boydti.fawe.command.SuggestInputParseException;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.StringMan;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandLocals;
=======
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.MaskCommands; import com.sk89q.worldedit.command.MaskCommands;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
@ -20,11 +17,9 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.BlockMaskBuilder; import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.MaskIntersection; import com.sk89q.worldedit.function.mask.MaskIntersection;
<<<<<<< HEAD
import com.sk89q.worldedit.function.mask.MaskUnion; import com.sk89q.worldedit.function.mask.MaskUnion;
import com.sk89q.worldedit.internal.command.ActorAuthorizer; import com.sk89q.worldedit.internal.command.ActorAuthorizer;
import com.sk89q.worldedit.internal.command.WorldEditBinding; import com.sk89q.worldedit.internal.command.WorldEditBinding;
=======
import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.function.mask.NoiseFilter; import com.sk89q.worldedit.function.mask.NoiseFilter;
import com.sk89q.worldedit.function.mask.OffsetMask; import com.sk89q.worldedit.function.mask.OffsetMask;
@ -37,7 +32,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.math.noise.RandomNoise;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.util.command.Dispatcher;
import com.sk89q.worldedit.util.command.SimpleDispatcher; import com.sk89q.worldedit.util.command.SimpleDispatcher;
@ -169,7 +163,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
} }
} }
} else { } else {
<<<<<<< HEAD //<<<<<<< HEAD
List<String> args = entry.getValue(); List<String> args = entry.getValue();
String cmdArgs = ((args.isEmpty()) ? "" : " " + StringMan.join(args, " ")); String cmdArgs = ((args.isEmpty()) ? "" : " " + StringMan.join(args, " "));
try { try {
@ -198,55 +192,55 @@ public class DefaultMaskParser extends FaweParser<Mask> {
throw new InputParseException(e2.getMessage()); throw new InputParseException(e2.getMessage());
} }
}); });
======= //=======
throw new NoMatchException("Unrecognized mask '" + component + '\''); // throw new NoMatchException("Unrecognized mask '" + component + '\'');
} // }
//
case '>': // case '>':
case '<': // case '<':
Mask submask; // Mask submask;
if (component.length() > 1) { // if (component.length() > 1) {
submask = getBlockMaskComponent(masks, component.substring(1), context); // submask = getBlockMaskComponent(masks, component.substring(1), context);
} else { // } else {
submask = new ExistingBlockMask(extent); // submask = new ExistingBlockMask(extent);
} // }
OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0)); // OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0));
return new MaskIntersection(offsetMask, Masks.negate(submask)); // return new MaskIntersection(offsetMask, Masks.negate(submask));
//
case '$': // case '$':
Set<BaseBiome> biomes = new HashSet<>(); // Set<BaseBiome> biomes = new HashSet<>();
String[] biomesList = component.substring(1).split(","); // String[] biomesList = component.substring(1).split(",");
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() // BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); // .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
List<BaseBiome> knownBiomes = biomeRegistry.getBiomes(); // List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
for (String biomeName : biomesList) { // for (String biomeName : biomesList) {
BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); // BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
if (biome == null) { // if (biome == null) {
throw new InputParseException("Unknown biome '" + biomeName + '\''); // throw new InputParseException("Unknown biome '" + biomeName + '\'');
>>>>>>> 399e0ad5... Refactor vector system to be cleaner //>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
} }
<<<<<<< HEAD //<<<<<<< HEAD
if (pe.and) { if (pe.and) {
masks.add(new ArrayList<>()); masks.add(new ArrayList<>());
======= //=======
//
return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes)); // return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
//
case '%': // case '%':
int i = Integer.parseInt(component.substring(1)); // int i = Integer.parseInt(component.substring(1));
return new NoiseFilter(new RandomNoise(), ((double) i) / 100); // return new NoiseFilter(new RandomNoise(), ((double) i) / 100);
//
case '=': // case '=':
try { // try {
Expression exp = Expression.compile(component.substring(1), "x", "y", "z"); // Expression exp = Expression.compile(component.substring(1), "x", "y", "z");
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment( // WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO); // Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO);
exp.setEnvironment(env); // exp.setEnvironment(env);
return new ExpressionMask(exp); // return new ExpressionMask(exp);
} catch (ExpressionException e) { // } catch (ExpressionException e) {
throw new InputParseException("Invalid expression: " + e.getMessage()); // throw new InputParseException("Invalid expression: " + e.getMessage());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner //>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
masks.get(masks.size() - 1).add(mask); masks.get(masks.size() - 1).add(mask);
} }

Datei anzeigen

@ -22,10 +22,8 @@ package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
<<<<<<< HEAD
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.blocks.BlockMaterial;
=======
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
@ -35,8 +33,6 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock; import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.world.block.BaseBlock;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -127,13 +123,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (free == 2) { if (free == 2) {
if (y - 1 != origY) { if (y - 1 != origY) {
<<<<<<< HEAD final BlockVector3 pos = new BlockVector3(x, y - 2, z);
final Vector pos = new Vector(x, y - 2, z);
final BlockStateHolder state = world.getBlock(pos); final BlockStateHolder state = world.getBlock(pos);
setPosition(new Vector(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5)); setPosition(new Vector3(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5));
======= // setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5));
setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5));
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
return; return;
@ -151,17 +144,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
int z = searchPos.getBlockZ(); int z = searchPos.getBlockZ();
while (y >= 0) { while (y >= 0) {
<<<<<<< HEAD
final Vector pos = new Vector(x, y, z);
final BlockStateHolder id = world.getBlock(pos);
if (id.getBlockType().getMaterial().isMovementBlocker()) {
setPosition(new Vector(x + 0.5, y + BlockType.centralTopLimit(id), z + 0.5));
=======
final BlockVector3 pos = new BlockVector3(x, y, z); final BlockVector3 pos = new BlockVector3(x, y, z);
final BlockState id = world.getBlock(pos); final BlockState id = world.getBlock(pos);
if (id.getBlockType().getMaterial().isMovementBlocker()) { if (id.getBlockType().getMaterial().isMovementBlocker()) {
setPosition(new Vector3(x + 0.5, y + 1, z + 0.5)); setPosition(new Vector3(x + 0.5, y + + BlockType.centralTopLimit(id), z + 0.5));
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return; return;
} }
@ -185,8 +171,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
int maxY = world.getMaxY(); int maxY = world.getMaxY();
if (y >= maxY) return false; if (y >= maxY) return false;
<<<<<<< HEAD BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
BlockMaterial initialMaterial = world.getBlockType(new Vector(x, y, z)).getMaterial();
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube(); boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
@ -196,7 +181,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
for (int level = y + 1; level <= maxY + 2; level++) { for (int level = y + 1; level <= maxY + 2; level++) {
BlockState state; BlockState state;
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState(); if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
else state = world.getBlock(new Vector(x, level, z)); else state = world.getBlock(new BlockVector3(x, level, z));
BlockTypes type = state.getBlockType(); BlockTypes type = state.getBlockType();
BlockMaterial material = type.getMaterial(); BlockMaterial material = type.getMaterial();
@ -204,29 +189,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (!lastState) { if (!lastState) {
lastState = BlockType.centralBottomLimit(state) != 1; lastState = BlockType.centralBottomLimit(state) != 1;
continue; continue;
=======
while (y <= world.getMaximumPoint().getY() + 2) {
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
++free;
} else {
free = 0;
}
if (free == 2) {
++spots;
if (spots == 2) {
final BlockVector3 platform = new BlockVector3(x, y - 2, z);
final BlockStateHolder block = world.getBlock(platform);
final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType();
// Don't get put in lava!
if (type == BlockTypes.LAVA) {
return false;
}
setPosition(platform.toVector3().add(0.5, 1, 0.5));
return true;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
if (freeStart == -1) { if (freeStart == -1) {
freeStart = level + BlockType.centralTopLimit(state); freeStart = level + BlockType.centralTopLimit(state);
@ -234,7 +196,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
double bottomLimit = BlockType.centralBottomLimit(state); double bottomLimit = BlockType.centralBottomLimit(state);
double space = level + bottomLimit - freeStart; double space = level + bottomLimit - freeStart;
if (space >= height) { if (space >= height) {
setPosition(new Vector(x + 0.5, freeStart, z + 0.5)); setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
return true; return true;
} }
// Not enough room, reset the free position // Not enough room, reset the free position
@ -258,9 +220,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
final int z = pos.getBlockZ(); final int z = pos.getBlockZ();
final Extent world = pos.getExtent(); final Extent world = pos.getExtent();
BlockMaterial initialMaterial = world.getBlockType(new Vector(x, y, z)).getMaterial(); BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
<<<<<<< HEAD
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube(); boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
double height = 1.85; double height = 1.85;
@ -272,7 +233,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
for (int level = y + 1; level > 0; level--) { for (int level = y + 1; level > 0; level--) {
BlockState state; BlockState state;
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState(); if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
else state = world.getBlock(new Vector(x, level, z)); else state = world.getBlock(new BlockVector3(x, level, z));
BlockTypes type = state.getBlockType(); BlockTypes type = state.getBlockType();
BlockMaterial material = type.getMaterial(); BlockMaterial material = type.getMaterial();
@ -288,29 +249,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
double freeStart = level + topLimit; double freeStart = level + topLimit;
double space = freeEnd - freeStart; double space = freeEnd - freeStart;
if (space >= height) { if (space >= height) {
setPosition(new Vector(x + 0.5, freeStart, z + 0.5)); setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
=======
while (y >= 1) {
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
++free;
} else {
free = 0;
}
if (free == 2) {
// So we've found a spot, but we have to drop the player
// lightly and also check to see if there's something to
// stand upon
while (y >= 0) {
final BlockVector3 platform = new BlockVector3(x, y, z);
final BlockStateHolder block = world.getBlock(platform);
final BlockType type = block.getBlockType();
// Don't want to end up in lava
if (!type.getMaterial().isAir() && type != BlockTypes.LAVA) {
// Found a block!
setPosition(platform.toVector3().add(0.5, 1, 0.5));
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return true; return true;
} }
// Not enough room, reset the free position // Not enough room, reset the free position
@ -392,41 +331,25 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override @Override
public void floatAt(int x, int y, int z, boolean alwaysGlass) { public void floatAt(int x, int y, int z, boolean alwaysGlass) {
<<<<<<< HEAD
Vector spot = new Vector(x, y - 1, z);
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
try {
getLocation().getExtent().setBlock(new Vector(x, y - 1, z), BlockTypes.GLASS.getDefaultState());
} catch (WorldEditException e) {
e.printStackTrace();
=======
try { try {
BlockVector3 spot = new BlockVector3(x, y - 1, z); BlockVector3 spot = new BlockVector3(x, y - 1, z);
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) { if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState()); getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
}catch (WorldEditException e) {
e.printStackTrace();
} }
setPosition(new Vector3(x + 0.5, y, z + 0.5)); setPosition(new Vector3(x + 0.5, y, z + 0.5));
} }
@Override @Override
public Location getBlockIn() { public Location getBlockIn() {
<<<<<<< HEAD
Location loc = getLocation();
return new Location(loc.getExtent(), loc.toBlockVector(), loc.getDirection());
=======
return getLocation().setPosition(getLocation().toVector().floor()); return getLocation().setPosition(getLocation().toVector().floor());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Override @Override
public Location getBlockOn() { public Location getBlockOn() {
<<<<<<< HEAD
return getLocation().setY(getLocation().getY() - 1);
=======
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor()); return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
} }
@Override @Override
@ -607,12 +530,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
return false; return false;
} }
<<<<<<< HEAD
}
=======
@Override @Override
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
} }
} }
>>>>>>> 399e0ad5... Refactor vector system to be cleaner

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen