Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Current Progress #3
Dieser Commit ist enthalten in:
Ursprung
d4157b7e0e
Commit
842b1307c7
@ -22,11 +22,11 @@ package com.sk89q.worldedit.blocks;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
private final Extent extent;
|
||||
private final Vector position;
|
||||
private final BlockVector3 position;
|
||||
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 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);
|
||||
checkNotNull(extent);
|
||||
checkNotNull(position);
|
||||
@ -67,7 +67,7 @@ public class LazyBlock extends BaseBlock {
|
||||
* @param extent the extent 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);
|
||||
checkNotNull(extent);
|
||||
checkNotNull(position);
|
||||
|
@ -526,7 +526,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
int newHeight = table.average(x, z, index);
|
||||
setLayerHeightRaw(index, newHeight);
|
||||
}
|
||||
@ -581,7 +581,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (!mask.test(mutable)) {
|
||||
if (!mask.test(mutable.toBlockVector3())) {
|
||||
continue;
|
||||
}
|
||||
if (placed.containsRadius(x, z, distance)) {
|
||||
@ -601,9 +601,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
Schematic schematic = new Schematic(clipboard);
|
||||
Transform transform = holder.getTransform();
|
||||
if (transform.isIdentity()) {
|
||||
schematic.paste(this, mutable, false);
|
||||
schematic.paste(this, mutable.toBlockVector3(), false);
|
||||
} else {
|
||||
schematic.paste(this, mutable, false, transform);
|
||||
schematic.paste(this, mutable.toBlockVector3(), false, transform);
|
||||
}
|
||||
if (x + distance < getWidth()) {
|
||||
x += distance;
|
||||
@ -629,7 +629,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (!mask.test(mutable)) {
|
||||
if (!mask.test(mutable.toBlockVector3())) {
|
||||
continue;
|
||||
}
|
||||
if (placed.containsRadius(x, z, distance)) {
|
||||
@ -650,9 +650,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
Schematic schematic = new Schematic(clipboard);
|
||||
Transform transform = holder.getTransform();
|
||||
if (transform.isIdentity()) {
|
||||
schematic.paste(this, mutable, false);
|
||||
schematic.paste(this, mutable.toBlockVector3(), false);
|
||||
} else {
|
||||
schematic.paste(this, mutable, false, transform);
|
||||
schematic.paste(this, mutable.toBlockVector3(), false, transform);
|
||||
}
|
||||
if (x + distance < getWidth()) {
|
||||
x += distance;
|
||||
@ -1132,7 +1132,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
if (mask != null) {
|
||||
mutable.mutX(z);
|
||||
mutable.mutY(heights.getByte(index) & 0xFF);
|
||||
if (!mask.test(mutable)) continue;
|
||||
if (!mask.test(mutable.toBlockVector3())) continue;
|
||||
}
|
||||
if (imgMask != null) {
|
||||
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++) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(heights.getByte(index) & 0xFF);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
int color = img.getRGB(x, z);
|
||||
BlockType block = textureUtil.getNearestBlock(color);
|
||||
if (block != null) {
|
||||
@ -1327,7 +1327,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights.getByte(index) & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
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) {
|
||||
mutable.mutX(x);
|
||||
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) {
|
||||
mutable.mutX(x);
|
||||
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) {
|
||||
mutable.mutX(x);
|
||||
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) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(height);
|
||||
int combined = pattern.apply(mutable).getInternalId();
|
||||
int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
||||
mainArr[index] = combined;
|
||||
floorArr[index] = combined;
|
||||
}
|
||||
@ -1457,8 +1457,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights.getByte(index) & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
overlay.setInt(index, pattern.apply(mutable).getInternalId());
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
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;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
floor.setInt(index, pattern.apply(mutable).getInternalId());
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
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;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
main.setInt(index, pattern.apply(mutable).getInternalId());
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
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;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
int combined = pattern.apply(mutable).getInternalId();
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
||||
floor.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;
|
||||
mutable.mutX(x);
|
||||
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;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
int combined = value.apply(mutable).getInternalId();
|
||||
int combined = value.apply(mutable.toBlockVector3()).getInternalId();
|
||||
mainArr[index] = combined;
|
||||
floorArr[index] = combined;
|
||||
}
|
||||
@ -1586,7 +1586,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights.getByte(index) & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mainArr[index] = value.apply(mutable).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;
|
||||
mutable.mutX(x);
|
||||
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;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
overlay.setInt(index, combined);
|
||||
}
|
||||
}
|
||||
@ -2009,7 +2009,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights.getByte(index) & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
floor.setInt(index, combined);
|
||||
}
|
||||
}
|
||||
@ -2025,7 +2025,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights.getByte(index) & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
main.setInt(index, combined);
|
||||
}
|
||||
}
|
||||
@ -2041,7 +2041,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int y = heights.getByte(index) & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
if (mask.test(mutable)) {
|
||||
if (mask.test(mutable.toBlockVector3())) {
|
||||
floor.setInt(index, combined);
|
||||
main.setInt(index, combined);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class OreGen extends Resource {
|
||||
@Override
|
||||
public boolean spawn(Random rand, int x, int z) throws WorldEditException {
|
||||
int y = rand.nextInt(maxY - minY) + minY;
|
||||
if (!mask.test(mutable.setComponents(x, y, z))) {
|
||||
if (!mask.test(mutable.setComponents(x, y, z).toBlockVector3())) {
|
||||
return false;
|
||||
}
|
||||
double f = rand.nextDouble() * Math.PI;
|
||||
@ -106,8 +106,8 @@ public class OreGen extends Resource {
|
||||
double dz = (zz + 0.5D - d9) * id11o2;
|
||||
double dxyz2 = dxy2 + dz * dz;
|
||||
if ((dxyz2 < 1)) {
|
||||
if (mask.test(mutable))
|
||||
pattern.apply(extent, mutable, mutable);
|
||||
if (mask.test(mutable.toBlockVector3()))
|
||||
pattern.apply(extent, mutable.toBlockVector3(), mutable.toBlockVector3());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class SchemGen extends Resource {
|
||||
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
|
||||
if (y == -1) return false;
|
||||
mutable.mutY(y);
|
||||
if (!mask.test(mutable)) {
|
||||
if (!mask.test(mutable.toBlockVector3())) {
|
||||
return false;
|
||||
}
|
||||
mutable.mutY(y + 1);
|
||||
@ -48,9 +48,9 @@ public class SchemGen extends Resource {
|
||||
Schematic schematic = new Schematic(clipboard);
|
||||
Transform transform = holder.getTransform();
|
||||
if (transform.isIdentity()) {
|
||||
schematic.paste(extent, mutable, false);
|
||||
schematic.paste(extent, mutable.toBlockVector3(), false);
|
||||
} else {
|
||||
schematic.paste(extent, mutable, false, transform);
|
||||
schematic.paste(extent, mutable.toBlockVector3(), false, transform);
|
||||
}
|
||||
mutable.mutY(y);
|
||||
return true;
|
||||
|
@ -286,9 +286,9 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
CompoundTag tile = getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
|
||||
onEach.run(mutable, block);
|
||||
onEach.run(mutable.toBlockVector3(), block);
|
||||
} else {
|
||||
onEach.run(mutable, state);
|
||||
onEach.run(mutable.toBlockVector3(), state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,7 +316,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
mutable.mutZ(zz);
|
||||
mutable.mutY(y);
|
||||
BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
|
||||
onEach.run(mutable, block);
|
||||
onEach.run(mutable.toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class BlobBrush implements Brush {
|
||||
mutable.mutY(yr);
|
||||
for (int zr = -sizeInt; zr <= sizeInt; zr++) {
|
||||
mutable.mutZ(zr);
|
||||
Vector3 pt = transform.apply(mutable);
|
||||
Vector3 pt = transform.apply(mutable.toVector3());
|
||||
int x = MathMan.roundInt(pt.getX());
|
||||
int y = MathMan.roundInt(pt.getY());
|
||||
int z = MathMan.roundInt(pt.getZ());
|
||||
|
@ -98,11 +98,11 @@ public class ImageBrush implements Brush {
|
||||
int dy = vector.getBlockY() - cy;
|
||||
int dz = vector.getBlockZ() - cz;
|
||||
|
||||
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5));
|
||||
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5).toVector3());
|
||||
int x1 = (int) (pos1.getX() * scale + centerX);
|
||||
int z1 = (int) (pos1.getZ() * scale + centerZ);
|
||||
|
||||
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5));
|
||||
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5).toVector3());
|
||||
int x2 = (int) (pos2.getX() * scale + centerX);
|
||||
int z2 = (int) (pos2.getZ() * scale + centerZ);
|
||||
if (x2 < x1) {
|
||||
|
@ -53,9 +53,9 @@ public class LayerBrush implements Brush {
|
||||
int previous2 = layers[depth - 2].getInternalId();
|
||||
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
|
||||
if (visitor.isVisited(mutable) && 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);
|
||||
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;
|
||||
break;
|
||||
} else {
|
||||
|
@ -77,7 +77,8 @@ public class ShatterBrush extends ScatterBrush {
|
||||
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
||||
if (dSqr <= radius2) {
|
||||
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
|
||||
if (!placed.add(x2, y2, z2)) {
|
||||
if (!frontierVisited.contains(x2, y2, z2)) {
|
||||
|
@ -157,7 +157,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
sum.mutY(sum.getY() + p.getY());
|
||||
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) {
|
||||
|
@ -73,7 +73,7 @@ public class StencilBrush extends HeightBrush {
|
||||
int dy = vector.getBlockY() - cy;
|
||||
int dz = vector.getBlockZ() - cz;
|
||||
|
||||
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
||||
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz).toVector3());
|
||||
dx = MathMan.roundInt(srcPos.getX());
|
||||
dz = MathMan.roundInt(srcPos.getZ());
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class SurfaceSpline implements Brush {
|
||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
|
||||
if (tipy == -1) continue;
|
||||
if (radius == 0) {
|
||||
BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz);
|
||||
BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz).toBlockVector3();
|
||||
try {
|
||||
pattern.apply(editSession, set, set);
|
||||
} catch (WorldEditException e) {
|
||||
|
@ -22,7 +22,7 @@ public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
||||
public double getHeight(int x, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutZ(z);
|
||||
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint();
|
||||
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z).toVector3()).toBlockPoint();
|
||||
return super.getHeight(pos.getBlockX(), pos.getBlockZ());
|
||||
}
|
||||
}
|
@ -81,7 +81,7 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
||||
MutableBlockVector bv = new MutableBlockVector(pos);
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
bv.mutY(y);
|
||||
BlockStateHolder block = clipboard.getBlock(bv);
|
||||
BlockStateHolder block = clipboard.getBlock(bv.toBlockVector3());
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
highestY = y + 1;
|
||||
}
|
||||
|
@ -25,11 +25,11 @@ public class MutableBiomeChange implements Change {
|
||||
|
||||
@Override
|
||||
public void undo(UndoContext context) throws WorldEditException {
|
||||
context.getExtent().setBiome(mutable, from);
|
||||
context.getExtent().setBiome(mutable.toBlockVector2(), from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void redo(UndoContext context) throws WorldEditException {
|
||||
context.getExtent().setBiome(mutable, to);
|
||||
context.getExtent().setBiome(mutable.toBlockVector2(), to);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -137,7 +137,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
||||
pos.mutX(x);
|
||||
int xx = pos.getBlockX() - mx;
|
||||
if (region.contains(pos)) {
|
||||
if (region.contains(pos.toBlockVector3())) {
|
||||
BlockState block = getBlockAbs(x, y, z);
|
||||
if (!air && block.getBlockType().getMaterial().isAir()) {
|
||||
continue;
|
||||
|
@ -50,7 +50,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
|
||||
int cz = MathMan.unpairY(pair);
|
||||
pos.mutX((cx << 11) + pos.getBlockX());
|
||||
pos.mutZ((cz << 11) + pos.getBlockZ());
|
||||
return pos;
|
||||
return pos.toBlockVector3();
|
||||
}
|
||||
}
|
||||
count += newSize;
|
||||
@ -117,7 +117,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
|
||||
int pair = entry.getIntKey();
|
||||
int cx = MathMan.unpairX(pair);
|
||||
int cz = MathMan.unpairY(pair);
|
||||
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ());
|
||||
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ()).toBlockVector3();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
||||
if (index != -1) {
|
||||
int x = MathMan.unpairSearchCoordsX(index);
|
||||
int y = MathMan.unpairSearchCoordsY(index);
|
||||
return mutable.setComponents(x, y);
|
||||
return mutable.setComponents(x, y).toBlockVector2();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
||||
mutable.setComponents(x, y);
|
||||
previous = index;
|
||||
index = set.nextSetBit(index + 1);
|
||||
return mutable;
|
||||
return mutable.toBlockVector2();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
||||
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
||||
int y = b1;
|
||||
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
|
||||
return MutableBlockVector.get(x, y, z);
|
||||
return MutableBlockVector.get(x, y, z).toBlockVector3();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -151,7 +151,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
||||
mutable.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21));
|
||||
previous = index;
|
||||
index = set.nextSetBit(index + 1);
|
||||
return mutable;
|
||||
return mutable.toBlockVector3();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -310,7 +310,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
||||
public void forEach(BlockVectorSetVisitor visitor) {
|
||||
int size = size();
|
||||
int index = -1;
|
||||
BlockVector3 mVec = MutableBlockVector.get(0, 0, 0);
|
||||
BlockVector3 mVec = MutableBlockVector.get(0, 0, 0).toBlockVector3();
|
||||
for (int i = 0; i < size; i++) {
|
||||
index = set.nextSetBit(index + 1);
|
||||
int b1 = (index & 0xFF);
|
||||
|
@ -28,7 +28,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
mutable.mutX((location.getX() + dx));
|
||||
mutable.mutY((location.getY() + dy));
|
||||
mutable.mutZ((location.getZ() + dz));
|
||||
return getExtent().setBlock(mutable, block);
|
||||
return getExtent().setBlock(mutable.toBlockVector3(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,7 +36,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
mutable.mutX(x + dx);
|
||||
mutable.mutY(y + dy);
|
||||
mutable.mutZ(z + dz);
|
||||
return getExtent().setBlock(mutable, block);
|
||||
return getExtent().setBlock(mutable.toBlockVector3(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,7 @@ public class OffsetExtent extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz), biome);
|
||||
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz).toBlockVector2(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,7 +83,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.getBiome(getPos(mutable).toBlockVector2());
|
||||
return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,7 +102,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
|
||||
return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
|
||||
}
|
||||
|
||||
public void setTransform(Transform transform) {
|
||||
|
@ -30,7 +30,7 @@ public class RandomOffsetTransform extends ResettableExtent {
|
||||
public boolean setBiome(BlockVector2 pos, BaseBiome biome) {
|
||||
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
||||
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
||||
return getExtent().setBiome(mutable.setComponents(x, z), biome);
|
||||
return getExtent().setBiome(mutable.setComponents(x, z).toBlockVector2(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +46,7 @@ public class ScaleTransform extends ResettableExtent {
|
||||
mutable.mutX((min.getX() + (pos.getX() - min.getX()) * dx));
|
||||
mutable.mutY((min.getY() + (pos.getY() - min.getY()) * dy));
|
||||
mutable.mutZ((min.getZ() + (pos.getZ() - min.getZ()) * dz));
|
||||
return mutable;
|
||||
return mutable.toBlockVector3();
|
||||
}
|
||||
|
||||
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.mutY((min.getY() + (y - min.getY()) * dy));
|
||||
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.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||
result |= super.setBlock(pos, 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.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||
result |= super.setBlock(pos, block);
|
||||
result |= super.setBlock(pos.toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,6 @@ public class SourceMaskExtent extends TemporalExtent {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return mask.test(mutable) && super.setBlock(x, y, z, block);
|
||||
return mask.test(mutable.toBlockVector3()) && super.setBlock(x, y, z, block);
|
||||
}
|
||||
}
|
||||
|
@ -34,15 +34,15 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
BlockVector3 pos1 = new MutableBlockVector(getPos(super.getMinimumPoint()));
|
||||
BlockVector3 pos2 = new MutableBlockVector(getPos(super.getMaximumPoint()));
|
||||
BlockVector3 pos1 = getPos(super.getMinimumPoint());
|
||||
BlockVector3 pos2 = getPos(super.getMaximumPoint());
|
||||
return pos1.getMinimum(pos2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
BlockVector3 pos1 = new MutableBlockVector(getPos(super.getMinimumPoint()));
|
||||
BlockVector3 pos2 = new MutableBlockVector(getPos(super.getMaximumPoint()));
|
||||
BlockVector3 pos1 = getPos(super.getMinimumPoint());
|
||||
BlockVector3 pos2 = getPos(super.getMaximumPoint());
|
||||
return pos1.getMaximum(pos2);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.getBiome(getPos(mutable).toBlockVector2());
|
||||
return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,6 +118,6 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
|
||||
return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
||||
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
||||
if (layer != -1) {
|
||||
lastY = layer;
|
||||
return function.apply(mutable.setComponents(x, layer, z));
|
||||
return function.apply(mutable.setComponents(x, layer, z).toBlockVector3());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.boydti.fawe.object.function.block;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
||||
|
||||
@ -24,7 +25,8 @@ public class BiomeCopy implements RegionFunction {
|
||||
int z = position.getBlockZ();
|
||||
if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) {
|
||||
mPos2d.setComponents(x, z);
|
||||
return destination.setBiome(mPos2d, source.getBiome(mPos2d));
|
||||
BlockVector2 bv = mPos2d.toBlockVector2();
|
||||
return destination.setBiome( bv, source.getBiome(bv));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -58,23 +58,23 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
||||
int y = v.getBlockY();
|
||||
int z = v.getBlockZ();
|
||||
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)) {
|
||||
return mutable.setComponents(-1, 0, 0);
|
||||
}
|
||||
mutable.setComponents(-1, 0, 0);
|
||||
}else
|
||||
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)) {
|
||||
return mutable.setComponents(0, 0, -1);
|
||||
}
|
||||
if (y < 256 && mask.test(x, y + 1, z)) {
|
||||
return mutable.setComponents(0, 1, 0);
|
||||
}
|
||||
if (y > 0 && mask.test(x, y - 1, z)) {
|
||||
return mutable.setComponents(0, -1, 0);
|
||||
}
|
||||
return null;
|
||||
mutable.setComponents(0, 0, -1);
|
||||
}else
|
||||
if (y < 256 && mask.test(x, y + 1, z)) {
|
||||
mutable.setComponents(0, 1, 0);
|
||||
}else
|
||||
if (y > 0 && mask.test(x, y - 1, z)) {
|
||||
mutable.setComponents(0, -1, 0);
|
||||
}
|
||||
return (mutable.getX() == 0 && mutable.getY() == 0 && mutable.getZ() == 0) ? null : mutable.toBlockVector3();
|
||||
}
|
||||
}
|
@ -21,38 +21,38 @@ public class AdjacentMask extends AbstractMask {
|
||||
public boolean test(BlockVector3 bv) {
|
||||
v.setComponents(bv);
|
||||
int count = 0;
|
||||
double x = v.getX();
|
||||
double y = v.getY();
|
||||
double z = v.getZ();
|
||||
double x = bv.getX();
|
||||
double y = bv.getY();
|
||||
double z = bv.getZ();
|
||||
v.mutX(x + 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutX(x);
|
||||
return true;
|
||||
}
|
||||
v.mutX(x - 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutX(x);
|
||||
return true;
|
||||
}
|
||||
v.mutX(x);
|
||||
v.mutY(y + 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutY(y);
|
||||
return true;
|
||||
}
|
||||
v.mutY(y - 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutY(y);
|
||||
return true;
|
||||
}
|
||||
v.mutY(y);
|
||||
v.mutZ(z + 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutZ(z);
|
||||
return true;
|
||||
}
|
||||
v.mutZ(z - 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutZ(z);
|
||||
return true;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class BiomeMask extends AbstractExtentMask implements ResettableMask {
|
||||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
||||
if (!check) {
|
||||
return cache_results.contains(x, y, z);
|
||||
}
|
||||
boolean result = getMask().test(mutable.setComponents(x, y, z));
|
||||
boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
|
||||
if (result) cache_results.add(x, y, z);
|
||||
return result;
|
||||
} 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;
|
||||
resetCache();
|
||||
cache_checked.setOffset(x, z);
|
||||
|
@ -34,13 +34,13 @@ public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
|
||||
originZ = vector.getBlockZ();
|
||||
mode = 0;
|
||||
Extent extent = getExtent();
|
||||
if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ)).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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (Integer.bitCount(mode) >= 3) {
|
||||
|
@ -25,23 +25,23 @@ public class WallMask extends AbstractMask {
|
||||
double y = v.getY();
|
||||
double z = v.getZ();
|
||||
v.mutX(x + 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutX(x);
|
||||
return true;
|
||||
}
|
||||
v.mutX(x - 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutX(x);
|
||||
return true;
|
||||
}
|
||||
v.mutX(x);
|
||||
v.mutZ(z + 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutZ(z);
|
||||
return true;
|
||||
}
|
||||
v.mutZ(z - 1);
|
||||
if (mask.test(v) && ++count == min && max >= 8) {
|
||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
||||
v.mutZ(z);
|
||||
return true;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
public class NoXPattern extends AbstractPattern {
|
||||
|
||||
private final Pattern pattern;
|
||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
public NoXPattern(Pattern pattern) {
|
||||
this.pattern = pattern;
|
||||
@ -23,20 +23,21 @@ public class NoXPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 pos) {
|
||||
mutable.mutY((pos.getY()));
|
||||
mutable.mutZ((pos.getZ()));
|
||||
return pattern.apply(mutable);
|
||||
// mutable.mutY((pos.getY()));
|
||||
// mutable.mutZ((pos.getZ()));
|
||||
// return pattern.apply(mutable.toBlockVector3());
|
||||
return pattern.apply(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
mutable.mutY((get.getY()));
|
||||
mutable.mutZ((get.getZ()));
|
||||
return pattern.apply(extent, set, mutable);
|
||||
// mutable.mutY((get.getY()));
|
||||
// mutable.mutZ((get.getZ()));
|
||||
return pattern.apply(extent, set, get);
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
mutable = new MutableBlockVector();
|
||||
// mutable = new MutableBlockVector();
|
||||
}
|
||||
}
|
||||
|
@ -20,24 +20,24 @@ public class NoYPattern extends AbstractPattern {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 pos) {
|
||||
mutable.mutX((pos.getX()));
|
||||
mutable.mutZ((pos.getZ()));
|
||||
return pattern.apply(mutable);
|
||||
// mutable.mutX((pos.getX()));
|
||||
// mutable.mutZ((pos.getZ()));
|
||||
return pattern.apply(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
mutable.mutX((get.getX()));
|
||||
mutable.mutZ((get.getZ()));
|
||||
return pattern.apply(extent, set, mutable);
|
||||
// mutable.mutX((get.getX()));
|
||||
// mutable.mutZ((get.getZ()));
|
||||
return pattern.apply(extent, set, get);
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
mutable = new MutableBlockVector();
|
||||
// mutable = new MutableBlockVector();
|
||||
}
|
||||
}
|
||||
|
@ -20,24 +20,24 @@ public class NoZPattern extends AbstractPattern {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 pos) {
|
||||
mutable.mutX((pos.getX()));
|
||||
mutable.mutY((pos.getY()));
|
||||
return pattern.apply(mutable);
|
||||
// mutable.mutX((pos.getX()));
|
||||
// mutable.mutY((pos.getY()));
|
||||
return pattern.apply(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
mutable.mutX((get.getX()));
|
||||
mutable.mutY((get.getY()));
|
||||
return pattern.apply(extent, set, mutable);
|
||||
// mutable.mutX((get.getX()));
|
||||
// mutable.mutY((get.getY()));
|
||||
return pattern.apply(extent, set, get);
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
mutable = new MutableBlockVector();
|
||||
// mutable = new MutableBlockVector();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
public class OffsetPattern extends AbstractPattern {
|
||||
|
||||
private final int dx, dy, dz;
|
||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
||||
private final Pattern pattern;
|
||||
|
||||
public OffsetPattern(Pattern pattern, int dx, int dy, int dz) {
|
||||
@ -27,22 +27,24 @@ public class OffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
mutable.mutX((position.getX() + dx));
|
||||
mutable.mutY((position.getY() + dy));
|
||||
mutable.mutZ((position.getZ() + dz));
|
||||
return pattern.apply(mutable);
|
||||
// mutable.mutX((position.getX() + dx));
|
||||
// mutable.mutY((position.getY() + dy));
|
||||
// mutable.mutZ((position.getZ() + dz));
|
||||
// return pattern.apply(mutable);
|
||||
return pattern.apply(new BlockVector3(position.getX() + dx, position.getY() + dy, position.getZ() + dz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
mutable.mutX((get.getX() + dx));
|
||||
mutable.mutY((get.getY() + dy));
|
||||
mutable.mutZ((get.getZ() + dz));
|
||||
return pattern.apply(extent, set, mutable);
|
||||
// mutable.mutX((get.getX() + dx));
|
||||
// mutable.mutY((get.getY() + dy));
|
||||
// mutable.mutZ((get.getZ() + dz));
|
||||
// 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 {
|
||||
stream.defaultReadObject();
|
||||
mutable = new MutableBlockVector();
|
||||
// mutable = new MutableBlockVector();
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class RandomOffsetPattern extends AbstractPattern {
|
||||
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
||||
return pattern.apply(mutable);
|
||||
return pattern.apply(mutable.toBlockVector3());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,7 +46,7 @@ public class RandomOffsetPattern extends AbstractPattern {
|
||||
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
|
||||
return pattern.apply(extent, set, mutable);
|
||||
return pattern.apply(extent, set, mutable.toBlockVector3());
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
|
@ -30,7 +30,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
||||
mutable.mutX((pos.getX() - origin.getX()));
|
||||
mutable.mutY((pos.getY() - origin.getY()));
|
||||
mutable.mutZ((pos.getZ() - origin.getZ()));
|
||||
return pattern.apply(mutable);
|
||||
return pattern.apply(mutable.toBlockVector3());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,7 +41,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
||||
mutable.mutX((get.getX() - origin.getX()));
|
||||
mutable.mutY((get.getY() - origin.getY()));
|
||||
mutable.mutZ((get.getZ() - origin.getZ()));
|
||||
return pattern.apply(extent, set, mutable);
|
||||
return pattern.apply(extent, set, mutable.toBlockVector3());
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
|
@ -48,7 +48,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
||||
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
||||
BlockStateHolder block = pattern.apply(mutable);
|
||||
BlockStateHolder block = pattern.apply(mutable.toBlockVector3());
|
||||
if (solid[block.getInternalBlockTypeId()]) {
|
||||
return block;
|
||||
} else {
|
||||
@ -61,9 +61,9 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
||||
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
|
||||
BlockStateHolder block = pattern.apply(mutable);
|
||||
BlockStateHolder block = pattern.apply(mutable.toBlockVector3());
|
||||
if (solid[block.getInternalBlockTypeId()]) {
|
||||
return pattern.apply(extent, set, mutable);
|
||||
return pattern.apply(extent, set, mutable.toBlockVector3());
|
||||
} else {
|
||||
return pattern.apply(extent, set, get);
|
||||
}
|
||||
|
@ -50,22 +50,22 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
||||
next = buffer[i];
|
||||
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
|
||||
next.setComponents(cur.getBlockX() + dir.getBlockX(), cur.getBlockY() + dir.getBlockY(), cur.getBlockZ() + dir.getBlockZ());
|
||||
if (allowed(next)) {
|
||||
if (allowed(next.toBlockVector3())) {
|
||||
allowed[index++] = next;
|
||||
}
|
||||
}
|
||||
if (index == 0) {
|
||||
return cur;
|
||||
return cur.toBlockVector3();
|
||||
}
|
||||
next = allowed[PseudoRandom.random.nextInt(index)];
|
||||
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
|
||||
}
|
||||
return cur;
|
||||
return cur.toBlockVector3();
|
||||
}
|
||||
|
||||
private boolean allowed(BlockVector3 bv) {
|
||||
MutableBlockVector v = new MutableBlockVector(bv);
|
||||
BlockStateHolder block = pattern.apply(v);
|
||||
BlockStateHolder block = pattern.apply(bv);
|
||||
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
return false;
|
||||
}
|
||||
@ -73,34 +73,34 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
||||
int y = v.getBlockY();
|
||||
int z = v.getBlockZ();
|
||||
v.mutY(y + 1);
|
||||
if (canPassthrough(v)) {
|
||||
if (canPassthrough(v.toBlockVector3())) {
|
||||
v.mutY(y);
|
||||
return true;
|
||||
}
|
||||
v.mutY(y - 1);
|
||||
if (canPassthrough(v)) {
|
||||
if (canPassthrough(v.toBlockVector3())) {
|
||||
v.mutY(y);
|
||||
return true;
|
||||
}
|
||||
v.mutY(y);
|
||||
v.mutX(x + 1);
|
||||
if (canPassthrough(v)) {
|
||||
if (canPassthrough(v.toBlockVector3())) {
|
||||
v.mutX(x);
|
||||
return true;
|
||||
}
|
||||
v.mutX(x - 1);
|
||||
if (canPassthrough(v)) {
|
||||
if (canPassthrough(v.toBlockVector3())) {
|
||||
v.mutX(x);
|
||||
return true;
|
||||
}
|
||||
v.mutX(x);
|
||||
v.mutZ(z + 1);
|
||||
if (canPassthrough(v)) {
|
||||
if (canPassthrough(v.toBlockVector3())) {
|
||||
v.mutZ(z);
|
||||
return true;
|
||||
}
|
||||
v.mutZ(z - 1);
|
||||
if (canPassthrough(v)) {
|
||||
if (canPassthrough(v.toBlockVector3())) {
|
||||
v.mutZ(z);
|
||||
return true;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class FaweQueueDelegateExtent extends DelegateFaweQueue {
|
||||
private final FaweQueue parentQueue;
|
||||
private final Extent parentExtent;
|
||||
private final MutableBlockVector2D mutable2d = new MutableBlockVector2D();
|
||||
// private final MutableBlockVector2D mutable2d = new MutableBlockVector2D();
|
||||
|
||||
public FaweQueueDelegateExtent(FaweQueue parentQueue, Extent parentExtent) {
|
||||
super(parentQueue);
|
||||
@ -58,7 +58,7 @@ public class FaweQueueDelegateExtent extends DelegateFaweQueue {
|
||||
|
||||
@Override
|
||||
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
|
||||
|
@ -19,8 +19,10 @@
|
||||
|
||||
package com.boydti.fawe.object.regions;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.AbstractRegion;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.regions.polyhedron.Edge;
|
||||
@ -36,7 +38,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
/**
|
||||
* 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.
|
||||
@ -46,22 +48,22 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
private Vector minimumPoint;
|
||||
private BlockVector3 minimumPoint;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
@ -104,7 +106,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
|
||||
minimumPoint = null;
|
||||
maximumPoint = null;
|
||||
centerAccum = Vector.ZERO;
|
||||
centerAccum = BlockVector3.ZERO;
|
||||
lastTriangle = null;
|
||||
}
|
||||
|
||||
@ -115,7 +117,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
* @param vertex the vertex
|
||||
* @return true, if something changed.
|
||||
*/
|
||||
public boolean addVertex(Vector vertex) {
|
||||
public boolean addVertex(BlockVector3 vertex) {
|
||||
checkNotNull(vertex);
|
||||
|
||||
lastTriangle = null; // Probably not necessary
|
||||
@ -141,8 +143,10 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
if (minimumPoint == null) {
|
||||
minimumPoint = maximumPoint = vertex;
|
||||
} else {
|
||||
minimumPoint = new MutableBlockVector(Vector.getMinimum(minimumPoint, vertex));
|
||||
maximumPoint = new MutableBlockVector(Vector.getMaximum(maximumPoint, vertex));
|
||||
// minimumPoint = new MutableBlockVector(minimumPoint.getMinimum(vertex));
|
||||
// maximumPoint = new MutableBlockVector(maximumPoint.getMaximum(vertex));
|
||||
minimumPoint = minimumPoint.getMinimum(vertex);
|
||||
maximumPoint = maximumPoint.getMaximum(vertex);
|
||||
}
|
||||
|
||||
int size = vertices.size();
|
||||
@ -155,7 +159,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
|
||||
case 3:
|
||||
// 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 - 1], v[size - 2])));
|
||||
@ -186,8 +190,8 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
|
||||
// Add triangles between the remembered edges and the new vertex.
|
||||
for (Edge edge : borderEdges) {
|
||||
com.sk89q.worldedit.regions.polyhedron.Triangle triangle = edge.createTriangle(vertex);
|
||||
Triangle fTria = new Triangle(triangle.getVertex(0), triangle.getVertex(1), triangle.getVertex(2));
|
||||
com.sk89q.worldedit.regions.polyhedron.Triangle triangle = edge.createTriangle(vertex.toVector3());
|
||||
Triangle fTria = new Triangle(triangle.getVertex(0).toBlockPoint(), triangle.getVertex(1).toBlockPoint(), triangle.getVertex(2).toBlockPoint());
|
||||
triangles.add(fTria);
|
||||
}
|
||||
|
||||
@ -196,9 +200,9 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
vertices.remove(vertex);
|
||||
|
||||
// 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();
|
||||
for (Vector vertex2 : vertexBacklog2) {
|
||||
for (BlockVector3 vertex2 : vertexBacklog2) {
|
||||
addVertex(vertex2);
|
||||
}
|
||||
|
||||
@ -213,39 +217,39 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return minimumPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return maximumPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getCenter() {
|
||||
return centerAccum.divide(vertices.size());
|
||||
public Vector3 getCenter() {
|
||||
return centerAccum.divide(vertices.size()).toVector3();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(Vector... changes) throws RegionOperationException {
|
||||
public void expand(BlockVector3... changes) throws RegionOperationException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contract(Vector... changes) throws RegionOperationException {
|
||||
public void contract(BlockVector3... changes) throws RegionOperationException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shift(Vector change) throws RegionOperationException {
|
||||
public void shift(BlockVector3 change) throws RegionOperationException {
|
||||
shiftCollection(vertices, change);
|
||||
shiftCollection(vertexBacklog, change);
|
||||
|
||||
for (int i = 0; i < triangles.size(); ++i) {
|
||||
final Triangle triangle = triangles.get(i);
|
||||
|
||||
final Vector v0 = change.add(triangle.getVertex(0));
|
||||
final Vector v1 = change.add(triangle.getVertex(1));
|
||||
final Vector v2 = change.add(triangle.getVertex(2));
|
||||
final BlockVector3 v0 = change.add(triangle.getVertex(0).toBlockPoint());
|
||||
final BlockVector3 v1 = change.add(triangle.getVertex(1).toBlockPoint());
|
||||
final BlockVector3 v2 = change.add(triangle.getVertex(2).toBlockPoint());
|
||||
|
||||
triangles.set(i, new Triangle(v0, v1, v2));
|
||||
}
|
||||
@ -256,24 +260,24 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
lastTriangle = null;
|
||||
}
|
||||
|
||||
private static void shiftCollection(Collection<Vector> collection, Vector change) {
|
||||
final List<Vector> tmp = new ArrayList<Vector>(collection);
|
||||
private static void shiftCollection(Collection<BlockVector3> collection, BlockVector3 change) {
|
||||
final List<BlockVector3> tmp = new ArrayList<BlockVector3>(collection);
|
||||
collection.clear();
|
||||
for (Vector vertex : tmp) {
|
||||
for (BlockVector3 vertex : tmp) {
|
||||
collection.add(change.add(vertex));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Vector position) {
|
||||
public boolean contains(BlockVector3 position) {
|
||||
if (!isDefined()) {
|
||||
return false;
|
||||
}
|
||||
final int x = position.getBlockX();
|
||||
final int y = position.getBlockY();
|
||||
final int z = position.getBlockZ();
|
||||
final Vector min = getMinimumPoint();
|
||||
final Vector max = getMaximumPoint();
|
||||
final BlockVector3 min = getMinimumPoint();
|
||||
final BlockVector3 max = getMaximumPoint();
|
||||
if (x < min.getBlockX()) return false;
|
||||
if (x > max.getBlockX()) return false;
|
||||
if (z < min.getBlockZ()) return false;
|
||||
@ -283,7 +287,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
return containsRaw(position);
|
||||
}
|
||||
|
||||
private boolean containsRaw(Vector pt) {
|
||||
private boolean containsRaw(BlockVector3 pt) {
|
||||
if (lastTriangle != null && lastTriangle.contains(pt)) {
|
||||
return true;
|
||||
}
|
||||
@ -299,12 +303,12 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Collection<Vector> getVertices() {
|
||||
public Collection<BlockVector3> getVertices() {
|
||||
if (vertexBacklog.isEmpty()) {
|
||||
return vertices;
|
||||
}
|
||||
|
||||
final List<Vector> ret = new ArrayList<Vector>(vertices);
|
||||
final List<BlockVector3> ret = new ArrayList<BlockVector3>(vertices);
|
||||
ret.addAll(vertexBacklog);
|
||||
|
||||
return ret;
|
||||
|
@ -3,7 +3,8 @@ package com.boydti.fawe.object.regions;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
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;
|
||||
|
||||
public class Triangle {
|
||||
@ -23,10 +24,10 @@ public class Triangle {
|
||||
private final double[] vmin = new double[3];
|
||||
private final double[] vmax = new double[3];
|
||||
|
||||
private final Vector normalVec;
|
||||
private final BlockVector3 normalVec;
|
||||
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[1] = new double[]{pos2.getBlockX(), pos2.getBlockY(), pos2.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));
|
||||
}
|
||||
|
||||
public boolean above(Vector pt) {
|
||||
public boolean above(BlockVector3 pt) {
|
||||
Preconditions.checkNotNull(pt);
|
||||
return this.normalVec.dot(pt) > this.b;
|
||||
}
|
||||
|
||||
public Edge getEdge(int index) {
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
public Vector getVertex(int index) {
|
||||
return new Vector(verts[index]);
|
||||
public Vector3 getVertex(int 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[1] = pos.getBlockY() + RADIUS;
|
||||
center[2] = pos.getBlockZ() + RADIUS;
|
||||
|
@ -6,15 +6,14 @@ import com.boydti.fawe.object.regions.FuzzyRegion;
|
||||
import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.boydti.fawe.util.MaskTraverser;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
@ -27,7 +26,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
||||
|
||||
private final Player player;
|
||||
private FuzzyRegion region;
|
||||
private ArrayList<Vector> positions;
|
||||
private ArrayList<BlockVector3> positions;
|
||||
|
||||
public FuzzyRegionSelector(Player player, @Nullable World world, Mask mask) {
|
||||
super(new EditSessionBuilder(world)
|
||||
@ -43,7 +42,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Vector> getVerticies() {
|
||||
public List<BlockVector3> getVerticies() {
|
||||
return positions;
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectPrimary(Vector position, SelectorLimits limits) {
|
||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||
setWorld(getWorld());
|
||||
new MaskTraverser(getMask()).reset(getExtent());
|
||||
positions.clear();
|
||||
@ -83,7 +82,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectSecondary(Vector position, SelectorLimits limits) {
|
||||
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
|
||||
this.positions.add(position);
|
||||
new MaskTraverser(getMask()).reset(getExtent());
|
||||
this.region.select(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
@ -91,13 +90,13 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explainPrimarySelection(Actor actor, LocalSession session, Vector position) {
|
||||
public void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position) {
|
||||
int size = this.region.getArea();
|
||||
BBC.SELECTOR_FUZZY_POS1.send(player, position, "(" + region.getArea() + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explainSecondarySelection(Actor actor, LocalSession session, Vector position) {
|
||||
public void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position) {
|
||||
int size = this.region.getArea();
|
||||
BBC.SELECTOR_FUZZY_POS2.send(player, position, "(" + region.getArea() + ")");
|
||||
}
|
||||
@ -108,11 +107,11 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
|
||||
public BlockVector3 getPrimaryPosition() throws IncompleteRegionException {
|
||||
if (positions.isEmpty()) {
|
||||
throw new IncompleteRegionException();
|
||||
}
|
||||
return new BlockVector(positions.get(0));
|
||||
return positions.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,14 +21,13 @@ package com.boydti.fawe.object.regions.selector;
|
||||
|
||||
import com.boydti.fawe.object.regions.PolyhedralRegion;
|
||||
import com.boydti.fawe.object.regions.Triangle;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
||||
import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
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 {
|
||||
|
||||
private final transient PolyhedralRegion region;
|
||||
private transient BlockVector pos1;
|
||||
private transient BlockVector3 pos1;
|
||||
|
||||
/**
|
||||
* Create a new selector with a {@code null} world.
|
||||
@ -65,7 +64,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Vector> getVerticies() {
|
||||
public List<BlockVector3> getVerticies() {
|
||||
return new ArrayList<>(region.getVertices());
|
||||
}
|
||||
|
||||
@ -81,15 +80,15 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectPrimary(Vector position, SelectorLimits limits) {
|
||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||
checkNotNull(position);
|
||||
clear();
|
||||
pos1 = position.toBlockVector();
|
||||
pos1 = position;
|
||||
return region.addVertex(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectSecondary(Vector position, SelectorLimits limits) {
|
||||
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
|
||||
checkNotNull(position);
|
||||
|
||||
Optional<Integer> vertexLimit = limits.getPolyhedronVertexLimit();
|
||||
@ -102,7 +101,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
|
||||
public BlockVector3 getPrimaryPosition() throws IncompleteRegionException {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
@ -132,7 +131,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public void learnChanges() {
|
||||
pos1 = region.getVertices().iterator().next().toBlockVector();
|
||||
pos1 = region.getVertices().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -157,7 +156,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
|
||||
@Override
|
||||
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||
public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) {
|
||||
checkNotNull(player);
|
||||
checkNotNull(session);
|
||||
checkNotNull(pos);
|
||||
@ -168,7 +167,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||
public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) {
|
||||
checkNotNull(player);
|
||||
checkNotNull(session);
|
||||
checkNotNull(pos);
|
||||
@ -200,12 +199,12 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
checkNotNull(player);
|
||||
checkNotNull(session);
|
||||
|
||||
Collection<Vector> vertices = region.getVertices();
|
||||
Collection<BlockVector3> vertices = region.getVertices();
|
||||
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;
|
||||
for (Vector vertex : vertices) {
|
||||
for (BlockVector3 vertex : vertices) {
|
||||
vertexIds.put(vertex, ++lastVertexId);
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(lastVertexId, vertex, getArea()));
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ package com.boydti.fawe.object.schematic;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
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.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -68,12 +68,13 @@ public class PNGWriter implements ClipboardWriter {
|
||||
|
||||
boolean fill = length * 4 < imageSize && width * 4 < imageSize;
|
||||
|
||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
Vector mutableTop = new Vector(0, 0, 0);
|
||||
Vector mutableRight = new Vector(0, 0, 0);
|
||||
Vector mutableLeft = new Vector(0, 0, 0);
|
||||
MutableBlockVector mutable, mutableTop, mutableRight, mutableLeft;
|
||||
mutable = mutableTop = mutableRight = mutableLeft = new MutableBlockVector(0, 0, 0);
|
||||
// Vector mutableTop = 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 z0 = min.getBlockZ();
|
||||
int x0 = min.getBlockX();
|
||||
@ -95,16 +96,16 @@ public class PNGWriter implements ClipboardWriter {
|
||||
double cpy2 = cpy1 + dpyj[zz];
|
||||
for (int y = y0; y < y0 + height; y++) {
|
||||
mutable.mutY(y);
|
||||
BlockStateHolder block = clipboard.getBlock(mutable);
|
||||
BlockStateHolder block = clipboard.getBlock(mutable.toBlockVector3());
|
||||
if (block.getBlockType().getMaterial().isAir()) {
|
||||
continue;
|
||||
}
|
||||
mutableTop.mutY(y + 1);
|
||||
mutableRight.mutY(y);
|
||||
mutableLeft.mutY(y);
|
||||
if (!clipboard.getBlock(mutableTop).getBlockType().getMaterial().isAir() &&
|
||||
!clipboard.getBlock(mutableRight).getBlockType().getMaterial().isAir() &&
|
||||
!clipboard.getBlock(mutableLeft).getBlockType().getMaterial().isAir() ) {
|
||||
if (!clipboard.getBlock(mutableTop.toBlockVector3()).getBlockType().getMaterial().isAir() &&
|
||||
!clipboard.getBlock(mutableRight.toBlockVector3()).getBlockType().getMaterial().isAir() &&
|
||||
!clipboard.getBlock(mutableLeft.toBlockVector3()).getBlockType().getMaterial().isAir() ) {
|
||||
continue;
|
||||
}
|
||||
double cpy = cpy2 - dpxi[y - y0];
|
||||
|
@ -22,6 +22,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
@ -220,7 +221,7 @@ public class Schematic {
|
||||
int zz = z + relz;
|
||||
if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) {
|
||||
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()) {
|
||||
return;
|
||||
@ -245,7 +246,7 @@ public class Schematic {
|
||||
final int rely = to.getBlockY() - origin.getBlockY();
|
||||
final int relz = to.getBlockZ() - origin.getBlockZ();
|
||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D();
|
||||
// MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D();
|
||||
MutableBlockVector2D mpos2d = new MutableBlockVector2D();
|
||||
{
|
||||
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
@ -257,7 +258,8 @@ public class Schematic {
|
||||
int zz = mutable.getBlockZ() + relz;
|
||||
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
|
||||
mpos2d.setComponents(xx, zz);
|
||||
extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ())));
|
||||
// extent.setBiome(mpos2d, 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()) {
|
||||
return false;
|
||||
|
@ -13,8 +13,6 @@ import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.jnbt.NamedTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
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.world.block.BlockState;
|
||||
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.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
@ -77,8 +77,8 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
|
||||
int length = size.getInt(2);
|
||||
|
||||
// Init clipboard
|
||||
Vector origin = new Vector(0, 0, 0);
|
||||
CuboidRegion region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE));
|
||||
BlockVector3 origin = new BlockVector3(0, 0, 0);
|
||||
CuboidRegion region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, clipboardId);
|
||||
// Blocks
|
||||
ListTag blocks = (ListTag) tags.get("blocks");
|
||||
@ -175,7 +175,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
|
||||
// Palette
|
||||
{
|
||||
ArrayList<HashMap<String, Object>> palette = new ArrayList<>();
|
||||
for (Vector point : region) {
|
||||
for (BlockVector3 point : region) {
|
||||
BlockStateHolder block = clipboard.getBlock(point);
|
||||
int combined = block.getInternalId();
|
||||
BlockTypes type = block.getBlockType();
|
||||
@ -215,8 +215,8 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
|
||||
// Blocks
|
||||
{
|
||||
ArrayList<Map<String, Object>> blocks = new ArrayList<>();
|
||||
Vector min = region.getMinimumPoint();
|
||||
for (Vector point : region) {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
for (BlockVector3 point : region) {
|
||||
BlockStateHolder block = clipboard.getBlock(point);
|
||||
switch (block.getBlockType()) {
|
||||
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.add(new DoubleTag(vector.getX()));
|
||||
list.add(new DoubleTag(vector.getY()));
|
||||
|
@ -18,16 +18,20 @@ import com.google.common.io.Files;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.InputType;
|
||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
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.util.Location;
|
||||
import com.sk89q.worldedit.util.TargetBlock;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
@ -53,8 +57,8 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
private final MutableBlockVector2D lastPos = new MutableBlockVector2D();
|
||||
private final FawePlayer player;
|
||||
private final Location origin;
|
||||
private final BlockVector2D chunkOffset;
|
||||
private BlockVector2D lastPosition;
|
||||
private final BlockVector2 chunkOffset;
|
||||
private BlockVector2 lastPosition;
|
||||
|
||||
public static SchemVis create(FawePlayer player, Collection<File> files) throws IOException {
|
||||
checkNotNull(player);
|
||||
@ -76,12 +80,12 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
// Set the origin to somewhere around where the player currently is
|
||||
FaweLocation pos = player.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) {
|
||||
BlockVector2D pos1 = new BlockVector2D(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()));
|
||||
private Set<File> getFiles(BlockVector2 chunkPosA, BlockVector2 chunkPosB) {
|
||||
BlockVector2 pos1 = new BlockVector2(Math.min(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.min(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<>();
|
||||
for (Long2ObjectMap.Entry<Map.Entry<File, Long>> entry : files.long2ObjectEntrySet()) {
|
||||
long key = entry.getLongKey();
|
||||
@ -116,8 +120,8 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
LocalSession session = this.player.getSession();
|
||||
synchronized (this) {
|
||||
try {
|
||||
BlockVector2D tmpLastPosition = lastPosition;
|
||||
lastPosition = new BlockVector2D(chunkX, chunkZ);
|
||||
BlockVector2 tmpLastPosition = lastPosition;
|
||||
lastPosition = new BlockVector2(chunkX, chunkZ);
|
||||
|
||||
boolean sneaking = this.player.isSneaking();
|
||||
if (event.getInputType() == InputType.PRIMARY && !sneaking) {
|
||||
@ -251,8 +255,8 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
* @return offset vector
|
||||
*/
|
||||
@Override
|
||||
public Vector getOrigin() {
|
||||
return new BlockVector(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
|
||||
public Vector3 getOrigin() {
|
||||
return new Vector3(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -313,15 +317,15 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
* @param schemDimensions
|
||||
* @return
|
||||
*/
|
||||
private BlockVector2D registerAndGetChunkOffset(BlockVector2D schemDimensions, File file) {
|
||||
private BlockVector2 registerAndGetChunkOffset(BlockVector2 schemDimensions, File file) {
|
||||
int chunkX = schemDimensions.getBlockX() >> 4;
|
||||
int chunkZ = schemDimensions.getBlockZ() >> 4;
|
||||
MutableBlockVector2D pos2 = new MutableBlockVector2D();
|
||||
MutableBlockVector2D curPos = lastPos;
|
||||
// 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()))) {
|
||||
// curPos = new MutableBlockVector2D();
|
||||
// curPos = new MutableBlockVector2();
|
||||
// curPos.setComponents(lastPos.getBlockX(), lastPos.getBlockZ());
|
||||
// }
|
||||
curPos.nextPosition();
|
||||
@ -339,10 +343,10 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
}
|
||||
}
|
||||
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 z = chunkPos1.getBlockZ(); z <= chunkPos2.getBlockZ(); z++) {
|
||||
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) {
|
||||
int width = (char) MathMan.unpairX(dimensionPair);
|
||||
int length = (char) MathMan.unpairY(dimensionPair);
|
||||
BlockVector2D dimensions = new BlockVector2D(width, length);
|
||||
BlockVector2D offset = registerAndGetChunkOffset(dimensions, cached);
|
||||
BlockVector2 dimensions = new BlockVector2(width, length);
|
||||
BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
|
||||
return;
|
||||
}
|
||||
if (cached.exists() && file.lastModified() <= cached.lastModified()) {
|
||||
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()));
|
||||
BlockVector2D offset = registerAndGetChunkOffset(dimensions, cached);
|
||||
BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@ -389,9 +393,9 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
clipboard.setOrigin(clipboard.getMinimumPoint());
|
||||
try {
|
||||
MCAQueue queue = new MCAQueue(null, null, false);
|
||||
BlockVector2D dimensions = clipboard.getDimensions().toVector2D().toBlockVector2D();
|
||||
BlockVector2D offset = registerAndGetChunkOffset(dimensions, cached);
|
||||
new Schematic(clipboard).paste(queue, Vector.ZERO, true);
|
||||
BlockVector2 dimensions = clipboard.getDimensions().toBlockVector2();
|
||||
BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
|
||||
new Schematic(clipboard).paste(queue, BlockVector3.ZERO, true);
|
||||
try (FileOutputStream fos = new FileOutputStream(cached)) {
|
||||
IOUtil.writeVarInt(fos, dimensions.getBlockX());
|
||||
IOUtil.writeVarInt(fos, dimensions.getBlockZ());
|
||||
@ -468,7 +472,7 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
int OCZ = MathMan.unpairIntY(origin);
|
||||
try {
|
||||
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)) {
|
||||
NonCloseableInputStream nonCloseable = new NonCloseableInputStream(in);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.boydti.fawe.object.visitor;
|
||||
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@ -38,18 +39,18 @@ public class AboveVisitor extends RecursiveVisitor {
|
||||
|
||||
this.baseY = baseY;
|
||||
|
||||
Collection<Vector> directions = getDirections();
|
||||
Collection<BlockVector3> directions = getDirections();
|
||||
directions.clear();
|
||||
directions.add(new Vector(1, 0, 0));
|
||||
directions.add(new Vector(-1, 0, 0));
|
||||
directions.add(new Vector(0, 0, 1));
|
||||
directions.add(new Vector(0, 0, -1));
|
||||
directions.add(new Vector(0, 1, 0));
|
||||
directions.add(new Vector(0, -1, 0));
|
||||
directions.add(new BlockVector3(1, 0, 0));
|
||||
directions.add(new BlockVector3(-1, 0, 0));
|
||||
directions.add(new BlockVector3(0, 0, 1));
|
||||
directions.add(new BlockVector3(0, 0, -1));
|
||||
directions.add(new BlockVector3(0, 1, 0));
|
||||
directions.add(new BlockVector3(0, -1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisitable(Vector from, Vector to) {
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
return (from.getBlockY() >= baseY) && super.isVisitable(from, to);
|
||||
}
|
||||
}
|
@ -77,8 +77,8 @@ public abstract class DFSVisitor implements Operation {
|
||||
NodePair current;
|
||||
Node from;
|
||||
Node adjacent;
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
MutableBlockVector mutable2 = new MutableBlockVector();
|
||||
// MutableBlockVector mutable = new MutableBlockVector();
|
||||
// MutableBlockVector mutable2 = new MutableBlockVector();
|
||||
int countAdd, countAttempt;
|
||||
IntegerTrio[] dirs = getIntDirections();
|
||||
|
||||
@ -89,18 +89,20 @@ public abstract class DFSVisitor implements Operation {
|
||||
if (visited.containsKey(from)) {
|
||||
continue;
|
||||
}
|
||||
mutable.mutX(from.getX());
|
||||
mutable.mutY(from.getY());
|
||||
mutable.mutZ(from.getZ());
|
||||
function.apply(mutable);
|
||||
// mutable.mutX(from.getX());
|
||||
// mutable.mutY(from.getY());
|
||||
// mutable.mutZ(from.getZ());
|
||||
BlockVector3 bv = new BlockVector3(from.getX(), from.getY(), from.getZ());
|
||||
function.apply(bv);
|
||||
countAdd = 0;
|
||||
countAttempt = 0;
|
||||
for (IntegerTrio direction : dirs) {
|
||||
mutable2.mutX(from.getX() + direction.x);
|
||||
mutable2.mutY(from.getY() + direction.y);
|
||||
mutable2.mutZ(from.getZ() + direction.z);
|
||||
if (isVisitable(mutable, mutable2)) {
|
||||
adjacent = new Node(mutable2.getBlockX(), mutable2.getBlockY(), mutable2.getBlockZ());
|
||||
// mutable2.mutX(from.getX() + direction.x);
|
||||
// mutable2.mutY(from.getY() + direction.y);
|
||||
// mutable2.mutZ(from.getZ() + direction.z);
|
||||
BlockVector3 bv2 = new BlockVector3(from.getX() + direction.x, from.getY() + direction.y, from.getZ() + direction.z);
|
||||
if (isVisitable(bv, bv2)) {
|
||||
adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
|
||||
if ((current.from == null || !adjacent.equals(current.from))) {
|
||||
AtomicInteger adjacentCount = visited.get(adjacent);
|
||||
if (adjacentCount == null) {
|
||||
|
@ -6,46 +6,47 @@ import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.annotation.Nonnull;
|
||||
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;
|
||||
|
||||
public Fast2DIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable EditSession extent) {
|
||||
public Fast2DIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable EditSession 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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public Fast2DIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable FaweQueue faweQueue) {
|
||||
public Fast2DIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable FaweQueue faweQueue) {
|
||||
this.iterable = iter;
|
||||
this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null;
|
||||
}
|
||||
|
||||
public Iterable<? extends Vector2D> getIterable() {
|
||||
public Iterable<? extends BlockVector2> getIterable() {
|
||||
return iterable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Vector2D> iterator() {
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) {
|
||||
return (Iterator<Vector2D>) iterable.iterator();
|
||||
return (Iterator<BlockVector2>) iterable.iterator();
|
||||
}
|
||||
return new Iterator<Vector2D>() {
|
||||
Iterator<? extends Vector2D> trailIter = iterable.iterator();
|
||||
Iterator<? extends Vector2D> leadIter = iterable.iterator();
|
||||
return new Iterator<BlockVector2>() {
|
||||
Iterator<? extends BlockVector2> trailIter = iterable.iterator();
|
||||
Iterator<? extends BlockVector2> leadIter = iterable.iterator();
|
||||
int lastTrailChunkX = Integer.MIN_VALUE;
|
||||
int lastTrailChunkZ = Integer.MIN_VALUE;
|
||||
int lastLeadChunkX = Integer.MIN_VALUE;
|
||||
@ -64,8 +65,8 @@ public class Fast2DIterator implements Iterable<Vector2D> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2D next() {
|
||||
Vector2D pt = trailIter.next();
|
||||
public BlockVector2 next() {
|
||||
BlockVector2 pt = trailIter.next();
|
||||
if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) {
|
||||
if (leadIter.hasNext()) {
|
||||
try {
|
||||
@ -78,7 +79,7 @@ public class Fast2DIterator implements Iterable<Vector2D> {
|
||||
amount = 1;
|
||||
}
|
||||
for (int count = 0; count < amount; ) {
|
||||
Vector2D v = leadIter.next();
|
||||
BlockVector2 v = leadIter.next();
|
||||
int vcx = v.getBlockX() >> 4;
|
||||
int vcz = v.getBlockZ() >> 4;
|
||||
if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) {
|
||||
|
@ -6,54 +6,55 @@ import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.annotation.Nonnull;
|
||||
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;
|
||||
|
||||
public FastChunkIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable EditSession extent) {
|
||||
public FastChunkIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable EditSession 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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public FastChunkIterator(@Nonnull Iterable<? extends Vector2D> iter, @Nullable FaweQueue faweQueue) {
|
||||
public FastChunkIterator(@Nonnull Iterable<? extends BlockVector2> iter, @Nullable FaweQueue faweQueue) {
|
||||
this.iterable = iter;
|
||||
this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null;
|
||||
}
|
||||
|
||||
public Iterable<? extends Vector2D> getIterable() {
|
||||
public Iterable<? extends BlockVector2> getIterable() {
|
||||
return iterable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Vector2D> iterator() {
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
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 Vector2D> leadIter = iterable.iterator();
|
||||
final Iterator<? extends BlockVector2> trailIter = iterable.iterator();
|
||||
final Iterator<? extends BlockVector2> leadIter = iterable.iterator();
|
||||
int amount = Settings.IMP.QUEUE.PRELOAD_CHUNKS;
|
||||
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());
|
||||
}
|
||||
if (!leadIter.hasNext()) {
|
||||
return (Iterator<Vector2D>) trailIter;
|
||||
return (Iterator<BlockVector2>) trailIter;
|
||||
}
|
||||
return new Iterator<Vector2D>() {
|
||||
return new Iterator<BlockVector2>() {
|
||||
@Override
|
||||
public void remove() {
|
||||
trailIter.remove();
|
||||
@ -65,9 +66,9 @@ public class FastChunkIterator implements Iterable<Vector2D> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2D next() {
|
||||
public BlockVector2 next() {
|
||||
if (leadIter.hasNext()) {
|
||||
Vector2D toLoad = leadIter.next();
|
||||
BlockVector2 toLoad = leadIter.next();
|
||||
queue.queueChunkLoad(toLoad.getBlockX(), toLoad.getBlockZ());
|
||||
}
|
||||
return trailIter.next();
|
||||
|
@ -6,46 +6,47 @@ import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.annotation.Nonnull;
|
||||
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;
|
||||
|
||||
public FastIterator(@Nonnull Iterable<? extends Vector> iter, @Nullable EditSession extent) {
|
||||
public FastIterator(@Nonnull Iterable<? extends BlockVector3> iter, @Nullable EditSession 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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public FastIterator(@Nonnull Iterable<? extends Vector> iter, @Nullable FaweQueue faweQueue) {
|
||||
public FastIterator(@Nonnull Iterable<? extends BlockVector3> iter, @Nullable FaweQueue faweQueue) {
|
||||
this.iterable = iter;
|
||||
this.queue = faweQueue != null && faweQueue instanceof MappedFaweQueue ? (MappedFaweQueue) faweQueue : null;
|
||||
}
|
||||
|
||||
public Iterable<? extends Vector> getIterable() {
|
||||
public Iterable<? extends BlockVector3> getIterable() {
|
||||
return iterable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Vector> iterator() {
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) {
|
||||
return (Iterator<Vector>) iterable.iterator();
|
||||
return (Iterator<BlockVector3>) iterable.iterator();
|
||||
}
|
||||
return new Iterator<Vector>() {
|
||||
Iterator<? extends Vector> trailIter = iterable.iterator();
|
||||
Iterator<? extends Vector> leadIter = iterable.iterator();
|
||||
return new Iterator<BlockVector3>() {
|
||||
Iterator<? extends BlockVector3> trailIter = iterable.iterator();
|
||||
Iterator<? extends BlockVector3> leadIter = iterable.iterator();
|
||||
int lastTrailChunkX = Integer.MIN_VALUE;
|
||||
int lastTrailChunkZ = Integer.MIN_VALUE;
|
||||
int lastLeadChunkX = Integer.MIN_VALUE;
|
||||
@ -64,8 +65,8 @@ public class FastIterator implements Iterable<Vector> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector next() {
|
||||
Vector pt = trailIter.next();
|
||||
public BlockVector3 next() {
|
||||
BlockVector3 pt = trailIter.next();
|
||||
if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) {
|
||||
if (leadIter.hasNext()) {
|
||||
try {
|
||||
@ -78,7 +79,7 @@ public class FastIterator implements Iterable<Vector> {
|
||||
amount = 1;
|
||||
}
|
||||
for (int count = 0; count < amount; ) {
|
||||
Vector v = leadIter.next();
|
||||
BlockVector3 v = leadIter.next();
|
||||
int vcx = v.getBlockX() >> 4;
|
||||
int vcz = v.getBlockZ() >> 4;
|
||||
if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) {
|
||||
|
@ -1,42 +1,42 @@
|
||||
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.RegionOperationException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
public abstract class SimpleRegion extends AbstractRegion {
|
||||
private final Vector max;
|
||||
private final Vector min;
|
||||
private final BlockVector3 max;
|
||||
private final BlockVector3 min;
|
||||
|
||||
public SimpleRegion(World world, Vector min, Vector max) {
|
||||
public SimpleRegion(World world, BlockVector3 min, BlockVector3 max) {
|
||||
super(world);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return min;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(Vector... changes) throws RegionOperationException {
|
||||
public void expand(BlockVector3... changes) throws RegionOperationException {
|
||||
throw new UnsupportedOperationException("Region is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contract(Vector... changes) throws RegionOperationException {
|
||||
public void contract(BlockVector3... changes) throws RegionOperationException {
|
||||
throw new UnsupportedOperationException("Region is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Vector p) {
|
||||
public boolean contains(BlockVector3 p) {
|
||||
return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ());
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
@ -50,8 +50,8 @@ public class FaweChunkManager extends ChunkManager {
|
||||
synchronized (FaweChunkManager.class) {
|
||||
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();
|
||||
CuboidRegion regionA = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(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 regionA = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.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 copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
|
||||
try {
|
||||
@ -76,8 +76,8 @@ public class FaweChunkManager extends ChunkManager {
|
||||
synchronized (FaweChunkManager.class) {
|
||||
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();
|
||||
CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, new Vector(pos3.getX(), pos3.getY(), pos3.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 BlockVector3(pos3.getX(), pos3.getY(), pos3.getZ()));
|
||||
try {
|
||||
Operations.completeLegacy(copy);
|
||||
to.flushQueue();
|
||||
@ -99,7 +99,7 @@ public class FaweChunkManager extends ChunkManager {
|
||||
synchronized (FaweChunkManager.class) {
|
||||
EditSession editSession = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
||||
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);
|
||||
editSession.flushQueue();
|
||||
TaskManager.IMP.task(whenDone);
|
||||
|
@ -18,9 +18,9 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -53,7 +53,7 @@ public class FaweSchematicHandler extends SchematicHandler {
|
||||
Location[] corners = MainUtil.getCorners(world, regions);
|
||||
Location pos1 = corners[0];
|
||||
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 int mx = pos1.getX();
|
||||
|
@ -4,7 +4,8 @@ import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
@ -23,7 +24,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
||||
for (Plot plot : plots) {
|
||||
Location pos1 = plot.getBottom();
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.general.commands.Command;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
@ -84,7 +84,7 @@ public class PlotSetBiome extends Command {
|
||||
.build();
|
||||
long seed = PseudoRandom.random.nextLong();
|
||||
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.flushQueue();
|
||||
|
@ -23,7 +23,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
|
||||
import com.intellectualcrafters.plot.util.block.QueueProvider;
|
||||
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.Region;
|
||||
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));
|
||||
}
|
||||
final RegionWrapper region = regions.iterator().next();
|
||||
final BlockVector pos1 = new BlockVector(region.minX, min, region.minZ);
|
||||
final BlockVector pos2 = new BlockVector(region.maxX, max, region.maxZ);
|
||||
final BlockVector3 pos1 = new BlockVector3(region.minX, min, region.minZ);
|
||||
final BlockVector3 pos2 = new BlockVector3(region.maxX, max, region.maxZ);
|
||||
final Plot finalPlot = plot;
|
||||
if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(finalPlot) || regions.isEmpty()) {
|
||||
return null;
|
||||
|
@ -8,7 +8,6 @@ import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
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.function.mask.Mask;
|
||||
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.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -42,7 +42,7 @@ public class TextureUtil implements TextureHolder{
|
||||
|
||||
public static TextureUtil fromClipboard(Clipboard clipboard) throws FileNotFoundException {
|
||||
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;
|
||||
}
|
||||
HashSet<BlockType> blocks = new HashSet<>();
|
||||
@ -65,7 +65,7 @@ public class TextureUtil implements TextureHolder{
|
||||
for (int typeId : tu.getValidBlockIds()) {
|
||||
BlockType block = BlockTypes.get(typeId);
|
||||
pattern.setBlock(block.getDefaultState());
|
||||
if (mask.test(Vector.ZERO)) blocks.add(block);
|
||||
if (mask.test(BlockVector3.ZERO)) blocks.add(block);
|
||||
}
|
||||
return fromBlocks(blocks);
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.extent.NullExtent;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
@ -160,10 +160,10 @@ public class WEManager {
|
||||
|
||||
|
||||
public boolean intersects(final Region region1, final Region region2) {
|
||||
Vector rg1P1 = region1.getMinimumPoint();
|
||||
Vector rg1P2 = region1.getMaximumPoint();
|
||||
Vector rg2P1 = region2.getMinimumPoint();
|
||||
Vector rg2P2 = region2.getMaximumPoint();
|
||||
BlockVector3 rg1P1 = region1.getMinimumPoint();
|
||||
BlockVector3 rg1P2 = region1.getMaximumPoint();
|
||||
BlockVector3 rg2P1 = region2.getMinimumPoint();
|
||||
BlockVector3 rg2P2 = region2.getMaximumPoint();
|
||||
|
||||
return (rg1P1.getBlockX() <= rg2P2.getBlockX()) && (rg1P2.getBlockX() >= rg2P1.getBlockX()) && (rg1P1.getBlockZ() <= rg2P2.getBlockZ()) && (rg1P2.getBlockZ() >= rg2P1.getBlockZ());
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.object.FaweLocation;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
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.extent.Extent;
|
||||
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.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -166,11 +167,12 @@ public class FakePlayer extends AbstractPlayerActor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||
if (pos instanceof Location) {
|
||||
Extent extent = ((Location) pos).getExtent();
|
||||
if (extent instanceof World) this.world = (World) extent;
|
||||
}
|
||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||
//TODO: find replacement for following code
|
||||
// if (pos instanceof Location) {
|
||||
// Extent extent = ((Location) pos).getExtent();
|
||||
// if (extent instanceof World) this.world = (World) extent;
|
||||
// }
|
||||
this.pos = new Location(world, pos, yaw, pitch);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.boydti.fawe.wrappers;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
public class LocationMaskedPlayerWrapper extends PlayerWrapper {
|
||||
@ -32,7 +32,7 @@ public class LocationMaskedPlayerWrapper extends PlayerWrapper {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (allowTeleport) {
|
||||
super.setPosition(pos, pitch, yaw);
|
||||
|
@ -16,6 +16,8 @@ import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
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.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -90,7 +92,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||
parent.setPosition(pos, pitch, yaw);
|
||||
}
|
||||
|
||||
@ -233,13 +235,13 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
Extent world = getLocation().getExtent();
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
while (y <= world.getMaximumPoint().getY()) {
|
||||
// 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);
|
||||
floatAt(x, platformY + 1, z, alwaysGlass);
|
||||
return true;
|
||||
@ -267,7 +269,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
final Extent world = getLocation().getExtent();
|
||||
|
||||
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
|
||||
} else if (y > maxY + 1) {
|
||||
break;
|
||||
@ -287,7 +289,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
RuntimeException caught = null;
|
||||
try {
|
||||
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();
|
||||
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
|
||||
if (session != null) {
|
||||
@ -299,7 +301,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override
|
||||
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) {
|
||||
@ -359,7 +361,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
boolean inFree = false;
|
||||
|
||||
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) {
|
||||
firstBlock = false;
|
||||
|
@ -10,6 +10,9 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
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.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -59,12 +62,12 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -79,12 +82,12 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector pt, BaseItemStack item, int times) {
|
||||
public void dropItem(Vector3 pt, BaseItemStack item, int times) {
|
||||
parent.dropItem(pt, item, times);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulateBlockMine(final Vector pt) {
|
||||
public void simulateBlockMine(final BlockVector3 pt) {
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override
|
||||
public void run(Object value) {
|
||||
@ -94,7 +97,7 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@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>) () -> {
|
||||
try {
|
||||
return parent.generateTree(type, editSession, position);
|
||||
@ -105,27 +108,27 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkLoadedChunk(Vector pt) {
|
||||
public void checkLoadedChunk(BlockVector3 pt) {
|
||||
parent.checkLoadedChunk(pt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {
|
||||
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
|
||||
parent.fixAfterFastMode(chunks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixLighting(Iterable<BlockVector2D> chunks) {
|
||||
public void fixLighting(Iterable<BlockVector2> chunks) {
|
||||
parent.fixLighting(chunks);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -150,12 +153,12 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return parent.getMinimumPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return parent.getMaximumPoint();
|
||||
}
|
||||
|
||||
@ -171,17 +174,17 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightLevel(Vector position) {
|
||||
public int getBlockLightLevel(BlockVector3 position) {
|
||||
return parent.getBlockLightLevel(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearContainerBlockContents(Vector position) {
|
||||
public boolean clearContainerBlockContents(BlockVector3 position) {
|
||||
return parent.clearContainerBlockContents(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector position, BaseItemStack item) {
|
||||
public void dropItem(Vector3 position, BaseItemStack item) {
|
||||
parent.dropItem(position, item);
|
||||
}
|
||||
|
||||
@ -227,27 +230,27 @@ public class WorldWrapper extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return parent.getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return parent.getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return parent.getFullBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return parent.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return parent.setBiome(position, biome);
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -85,18 +86,18 @@ public class CuboidClipboard {
|
||||
|
||||
private BlockArrayClipboard clipboard;
|
||||
private AffineTransform transform;
|
||||
public Vector size;
|
||||
public BlockVector3 size;
|
||||
|
||||
/**
|
||||
* Constructs the clipboard.
|
||||
*
|
||||
* @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);
|
||||
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||
this.size = size;
|
||||
this.clipboard = this.init(Vector.ZERO, Vector.ZERO);
|
||||
this.clipboard = this.init(BlockVector3.ZERO, BlockVector3.ZERO);
|
||||
}
|
||||
|
||||
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
|
||||
* {@link CuboidRegion#getMinimumPoint()} relative to the copy
|
||||
*/
|
||||
public CuboidClipboard(Vector size, Vector origin) {
|
||||
public CuboidClipboard(BlockVector3 size, BlockVector3 origin) {
|
||||
checkNotNull(size);
|
||||
checkNotNull(origin);
|
||||
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||
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
|
||||
* @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(origin);
|
||||
checkNotNull(offset);
|
||||
@ -138,9 +139,9 @@ public class CuboidClipboard {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
private BlockArrayClipboard init(Vector offset, Vector min) {
|
||||
Vector origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(Vector.ONE));
|
||||
private BlockArrayClipboard init(BlockVector3 offset, BlockVector3 min) {
|
||||
BlockVector3 origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(BlockVector3.ONE));
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
||||
clipboard.setOrigin(origin);
|
||||
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());
|
||||
}
|
||||
|
||||
@ -162,11 +163,11 @@ public class CuboidClipboard {
|
||||
return adapt(clipboard.IMP.getBlock(x, y, z));
|
||||
}
|
||||
|
||||
public BaseBlock getLazyBlock(Vector position) {
|
||||
public BaseBlock getLazyBlock(BlockVector3 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);
|
||||
}
|
||||
|
||||
@ -235,7 +236,7 @@ public class CuboidClipboard {
|
||||
public void flip(FlipDirection dir, boolean aroundPlayer) {
|
||||
checkNotNull(dir);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -248,7 +249,7 @@ public class CuboidClipboard {
|
||||
for (int x = 0; x < size.getBlockX(); ++x) {
|
||||
for (int y = 0; y < size.getBlockY(); ++y) {
|
||||
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 y = 0; y < size.getBlockY(); ++y) {
|
||||
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)) {
|
||||
setBlock(x, y, z, editSession.getBlock(pt));
|
||||
} else {
|
||||
@ -288,7 +289,7 @@ public class CuboidClipboard {
|
||||
* @param noAir true to not copy air blocks in the source
|
||||
* @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);
|
||||
}
|
||||
|
||||
@ -306,7 +307,7 @@ public class CuboidClipboard {
|
||||
* @param entities true to copy entities
|
||||
* @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);
|
||||
editSession.flushQueue();
|
||||
}
|
||||
@ -324,7 +325,7 @@ public class CuboidClipboard {
|
||||
* @param noAir true to not copy air blocks in the source
|
||||
* @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);
|
||||
}
|
||||
|
||||
@ -339,7 +340,7 @@ public class CuboidClipboard {
|
||||
* @deprecated use {@link #getBlock(Vector)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public BaseBlock getPoint(Vector position) throws ArrayIndexOutOfBoundsException {
|
||||
public BaseBlock getPoint(BlockVector3 position) throws ArrayIndexOutOfBoundsException {
|
||||
final BaseBlock block = getBlock(position);
|
||||
if (block == null) {
|
||||
return new BaseBlock(BlockTypes.AIR);
|
||||
@ -355,7 +356,7 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @return the origin
|
||||
*/
|
||||
public Vector getOrigin() {
|
||||
public BlockVector3 getOrigin() {
|
||||
return clipboard.getMinimumPoint();
|
||||
}
|
||||
|
||||
@ -366,14 +367,14 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @param origin the origin to set
|
||||
*/
|
||||
public void setOrigin(Vector origin) {
|
||||
public void setOrigin(BlockVector3 origin) {
|
||||
checkNotNull(origin);
|
||||
setOriginAndOffset(getOffset(), origin);
|
||||
}
|
||||
|
||||
public void setOriginAndOffset(Vector offset, Vector min) {
|
||||
Vector origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(Vector.ONE));
|
||||
public void setOriginAndOffset(BlockVector3 offset, BlockVector3 min) {
|
||||
BlockVector3 origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(BlockVector3.ONE));
|
||||
clipboard.setRegion(region);
|
||||
clipboard.setOrigin(origin);
|
||||
}
|
||||
@ -386,10 +387,10 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @return the offset the offset
|
||||
*/
|
||||
public Vector getOffset() {
|
||||
Vector min = clipboard.getMinimumPoint();
|
||||
Vector origin = clipboard.getOrigin();
|
||||
Vector offset = min.subtract(origin);
|
||||
public BlockVector3 getOffset() {
|
||||
BlockVector3 min = clipboard.getMinimumPoint();
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
BlockVector3 offset = min.subtract(origin);
|
||||
return offset;
|
||||
}
|
||||
|
||||
@ -401,7 +402,7 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @param offset the new offset
|
||||
*/
|
||||
public void setOffset(Vector offset) {
|
||||
public void setOffset(BlockVector3 offset) {
|
||||
checkNotNull(offset);
|
||||
setOriginAndOffset(offset, getOrigin());
|
||||
}
|
||||
@ -411,7 +412,7 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @return the dimensions, where (1, 1, 1) is 1 wide, 1 across, 1 deep
|
||||
*/
|
||||
public Vector getSize() {
|
||||
public BlockVector3 getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -448,7 +449,7 @@ public class CuboidClipboard {
|
||||
@Deprecated
|
||||
public static CuboidClipboard loadSchematic(File path) throws DataException, IOException {
|
||||
checkNotNull(path);
|
||||
return new CuboidClipboard((Vector) ClipboardFormat.SCHEMATIC.load(path).getClipboard());
|
||||
return new CuboidClipboard((BlockVector3) ClipboardFormat.SCHEMATIC.load(path).getClipboard());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.function.block.Naturalizer;
|
||||
import com.sk89q.worldedit.function.generator.GardenPatchGenerator;
|
||||
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
|
||||
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.pattern.BlockPattern;
|
||||
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) {
|
||||
this.changes++;
|
||||
try {
|
||||
mutablebv.setComponents(x, y, z);
|
||||
return pattern.apply(extent, mutablebv, mutablebv);
|
||||
BlockVector3 bv = mutablebv.setComponents(x, y, z).toBlockVector3();
|
||||
return pattern.apply(extent, bv, bv);
|
||||
} catch (WorldEditException 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) {
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2259,10 +2260,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2336,21 +2337,21 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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
|
||||
public BlockStateHolder getMaterial(final int x, final int y, final int z, final BlockStateHolder defaultMaterial) {
|
||||
//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) {
|
||||
// final Vector3 current = new Vector3(x, y, z);
|
||||
final Vector3 current = new Vector3(x, y, z);
|
||||
environment.setCurrentBlock(current);
|
||||
final Vector3 scaled = current.subtract(zero).divide(unit);
|
||||
|
||||
@ -3472,14 +3473,17 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
boolean containsAny = false;
|
||||
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) {
|
||||
containsAny = true;
|
||||
BlockVector3 mbv = mutable.toBlockVector3();
|
||||
if (fcs != null) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
int xx = x + bx;
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int zz = z + bz;
|
||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState());
|
||||
// BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
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);
|
||||
for (int y = 0; y < getMaxY() + 1; 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) {
|
||||
containsAny = true;
|
||||
if (fcs != null) {
|
||||
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState());
|
||||
BlockStateHolder block = getFullBlock(mbv);
|
||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
} else {
|
||||
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
BlockStateHolder block = getFullBlock(mbv);
|
||||
try {
|
||||
setBlock(mutable, block);
|
||||
setBlock(mbv, block);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -3602,5 +3607,4 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ public abstract class LocalConfiguration {
|
||||
public int butcherDefaultRadius = -1;
|
||||
public int butcherMaxRadius = -1;
|
||||
public boolean allowSymlinks = false;
|
||||
public boolean serverSideCUI = true;
|
||||
|
||||
/**
|
||||
* Load the configuration.
|
||||
|
@ -40,6 +40,8 @@ import com.sk89q.jchronic.Chronic;
|
||||
import com.sk89q.jchronic.Options;
|
||||
import com.sk89q.jchronic.utils.Span;
|
||||
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.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
@ -140,6 +142,7 @@ public class LocalSession implements TextureHolder {
|
||||
// Saved properties
|
||||
private String lastScript;
|
||||
private RegionSelectorType defaultSelector;
|
||||
private boolean useServerCUI = false; // Save this to not annoy players.
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.blocks;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
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.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -208,4 +210,5 @@ public class BaseBlock extends BlockState {
|
||||
return getAsString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,12 +42,9 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -153,54 +150,32 @@ public class BiomeCommands extends MethodCommands {
|
||||
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());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at line of sight point";
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
} else if (args.hasFlag('p')) {
|
||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at your position";
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
} else {
|
||||
World world = player.getWorld();
|
||||
Region region = session.getSelection(world);
|
||||
|
||||
if (region instanceof FlatRegion) {
|
||||
<<<<<<< HEAD
|
||||
for (Vector2D pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
|
||||
for (BlockVector2 pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
|
||||
biomes[editSession.getBiome(pt).getId()]++;
|
||||
size++;
|
||||
}
|
||||
} else {
|
||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
biomes[editSession.getBiome(position.toVector2D()).getId()]++;
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
biomes[editSession.getBiome(position.toBlockVector2()).getId()]++;
|
||||
return true;
|
||||
}
|
||||
}, editSession);
|
||||
Operations.completeBlindly(visitor);
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,13 +24,9 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
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.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -79,17 +75,10 @@ public class ChunkCommands {
|
||||
String filename = "c." + Integer.toString(chunkX, 36)
|
||||
+ "." + Integer.toString(chunkZ, 36) + ".dat";
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
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)));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -100,19 +89,11 @@ public class ChunkCommands {
|
||||
max = 0
|
||||
)
|
||||
@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 {
|
||||
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
|
||||
for (BlockVector2 chunk : chunks) {
|
||||
player.print(LegacyChunkStore.getFilename(chunk));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
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.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
=======
|
||||
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.REGION;
|
||||
@ -53,7 +51,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.extent.PasteEvent;
|
||||
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,
|
||||
@Selection final Region region, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
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));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
session.setClipboard(null);
|
||||
final Vector origin = region.getMinimumPoint();
|
||||
final BlockVector3 origin = region.getMinimumPoint();
|
||||
final int mx = origin.getBlockX();
|
||||
final int my = origin.getBlockY();
|
||||
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,
|
||||
@Selection Region region, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
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));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
session.setClipboard(null);
|
||||
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,
|
||||
@Selection final Region region, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
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));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
@ -228,7 +225,7 @@ public class ClipboardCommands extends MethodCommands {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
}
|
||||
session.setClipboard(null);
|
||||
final Vector origin = region.getMinimumPoint();
|
||||
final BlockVector3 origin = region.getMinimumPoint();
|
||||
final int mx = origin.getBlockX();
|
||||
final int my = origin.getBlockY();
|
||||
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,
|
||||
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
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));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
@ -268,7 +265,7 @@ public class ClipboardCommands extends MethodCommands {
|
||||
if (volume >= limit.MAX_CHANGES) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
}
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
session.setClipboard(null);
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||
@ -481,14 +478,8 @@ public class ClipboardCommands extends MethodCommands {
|
||||
}
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
<<<<<<< HEAD
|
||||
Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
checkPaste(player, editSession, to, holder, clipboard);
|
||||
|
||||
=======
|
||||
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
Operation operation = holder
|
||||
.createPaste(editSession)
|
||||
.to(to)
|
||||
@ -499,27 +490,20 @@ public class ClipboardCommands extends MethodCommands {
|
||||
Operations.completeLegacy(operation);
|
||||
|
||||
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());
|
||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
session.setRegionSelector(player.getWorld(), selector);
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(player, session);
|
||||
}
|
||||
BBC.COMMAND_PASTE.send(player, to.toBlockVector());
|
||||
BBC.COMMAND_PASTE.send(player, to);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
|
||||
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;
|
||||
if (holder instanceof URIClipboardHolder) uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
||||
PasteEvent event = new PasteEvent(player, clipboard, uri, editSession, to);
|
||||
@ -550,8 +534,8 @@ public class ClipboardCommands extends MethodCommands {
|
||||
@Switch('s') boolean selectPasted) throws WorldEditException {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
final Clipboard clipboard = holder.getClipboard();
|
||||
final Vector origin = clipboard.getOrigin();
|
||||
final Vector to = atOrigin ? origin : session.getPlacementPosition(player);
|
||||
final BlockVector3 origin = clipboard.getOrigin();
|
||||
final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(player);
|
||||
checkPaste(player, editSession, to, holder, clipboard);
|
||||
|
||||
Schematic schem = new Schematic(clipboard);
|
||||
@ -559,9 +543,9 @@ public class ClipboardCommands extends MethodCommands {
|
||||
|
||||
Region region = clipboard.getRegion().clone();
|
||||
if (selectPasted) {
|
||||
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()))));
|
||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
|
||||
BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint());
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
|
||||
session.setRegionSelector(player.getWorld(), selector);
|
||||
selector.learnChanges();
|
||||
@ -605,24 +589,13 @@ public class ClipboardCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
@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,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
AffineTransform transform = new AffineTransform();
|
||||
<<<<<<< HEAD
|
||||
transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1));
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
holder.setTransform(transform.combine(holder.getTransform()));
|
||||
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
|
||||
|
@ -19,17 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.CombinedTransform;
|
||||
@ -82,19 +80,6 @@ public class FlattenedClipboardTransform {
|
||||
transform,
|
||||
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[] {
|
||||
minimum,
|
||||
maximum,
|
||||
@ -104,34 +89,27 @@ public class FlattenedClipboardTransform {
|
||||
maximum.withX(minimum.getX()),
|
||||
maximum.withY(minimum.getY()),
|
||||
maximum.withZ(minimum.getZ()) };
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
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];
|
||||
Vector3 newMaximum = corners[0];
|
||||
|
||||
MutableVector newMinimum = new MutableVector(corners[0]);
|
||||
MutableVector newMaximum = new MutableVector(corners[0]);
|
||||
// MutableVector cbv = new MutableVector();
|
||||
for (int i = 1; i < corners.length; i++) {
|
||||
newMinimum = newMinimum.getMinimum(corners[i]);
|
||||
newMaximum = newMaximum.getMaximum(corners[i]);
|
||||
MutableVector cbv = new MutableVector(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,
|
||||
// so we should expand the region for edge cases
|
||||
<<<<<<< HEAD
|
||||
newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX())));
|
||||
newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
|
||||
newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));
|
||||
|
||||
return new CuboidRegion(newMinimum, newMaximum);
|
||||
=======
|
||||
newMinimum = newMinimum.floor();
|
||||
newMaximum = newMaximum.ceil();
|
||||
|
||||
return new CuboidRegion(newMinimum.toBlockPoint(), newMaximum.toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return new CuboidRegion(new BlockVector3(newMinimum.getX(), newMinimum.getY(), newMinimum.getZ()), new BlockVector3(newMaximum.getX(), newMaximum.getY(), newMaximum.getZ()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,16 +31,13 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
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.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
@ -134,7 +130,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.image")
|
||||
@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);
|
||||
URL url = new URL(arg);
|
||||
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);
|
||||
}
|
||||
|
||||
MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector());
|
||||
MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
|
||||
// MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector().toBlockPoint());
|
||||
// MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
|
||||
BlockVector3 pos1 = player.getLocation().toVector().toBlockPoint();
|
||||
BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1);
|
||||
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
||||
int[] count = new int[1];
|
||||
final BufferedImage finalImage = image;
|
||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector pos) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 pos) throws WorldEditException {
|
||||
try {
|
||||
int x = pos.getBlockX() - pos1.getBlockX();
|
||||
int z = pos.getBlockZ() - pos1.getBlockZ();
|
||||
@ -203,17 +201,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.cylinder")
|
||||
@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());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeHollowCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), thickness - 1);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), (int) max, context);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Command(
|
||||
aliases = {"/cyl"},
|
||||
usage = "<pattern> <radius>[,<radius>] [height]",
|
||||
@ -229,19 +226,14 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.cylinder")
|
||||
@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());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, 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(
|
||||
@ -258,7 +250,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -277,50 +269,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
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 {
|
||||
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 {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
Vector finalPos = raised ? pos.add(0, radius.getY(), 0) : pos;
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
BlockVector3 finalPos = raised ? pos.add(0, radius.getY(), 0) : pos;
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeSphere(finalPos, pattern, radius.getX(), radius.getY(), radius.getZ(), !hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, 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(
|
||||
@ -376,20 +334,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.pyramid")
|
||||
@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(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException {
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
worldEdit.checkMaxRadius(size);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), size, context);
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
aliases = {"/generate", "/gen", "/g"},
|
||||
@ -419,17 +373,10 @@ public class GenerationCommands extends MethodCommands {
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
@Switch('o') boolean offset,
|
||||
<<<<<<< HEAD
|
||||
@Switch('c') boolean offsetCenter,
|
||||
CommandContext context) throws WorldEditException, ParameterException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
||||
@Switch('c') boolean offsetCenter, CommandContext context) throws WorldEditException {
|
||||
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector3.ZERO;
|
||||
@ -450,20 +397,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
zero = max.add(min).multiply(0.5);
|
||||
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.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
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();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
} catch (ExpressionException e) {
|
||||
@ -500,16 +443,9 @@ public class GenerationCommands extends MethodCommands {
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
@Switch('o') boolean offset,
|
||||
<<<<<<< HEAD
|
||||
@Switch('c') boolean offsetCenter,
|
||||
CommandContext context) throws WorldEditException, ParameterException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
||||
@Switch('c') boolean offsetCenter, CommandContext context) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector3.ZERO;
|
||||
@ -530,27 +466,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
zero = max.add(min).multiply(0.5);
|
||||
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.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
}
|
||||
|
||||
try {
|
||||
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
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
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();
|
||||
BBC.VISITOR_FLAT.send(fp, affected);
|
||||
} catch (ExpressionException e) {
|
||||
|
@ -39,6 +39,8 @@ import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.command.binding.Range;
|
||||
@ -112,7 +114,7 @@ public class HistoryCommands extends MethodCommands {
|
||||
RollbackOptimizedHistory rollback = new RollbackOptimizedHistory(world, uuid, Integer.parseInt(name.substring(0, name.length() - 3)));
|
||||
DiskStorageHistory.DiskStorageSummary summary = rollback.summarize(RegionWrapper.GLOBAL(), false);
|
||||
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());
|
||||
RollbackDatabase db = DBHandler.IMP.getDatabase(world);
|
||||
db.logEdit(rollback);
|
||||
@ -165,10 +167,12 @@ public class HistoryCommands extends MethodCommands {
|
||||
radius = Math.max(Math.min(500, radius), 0);
|
||||
final World world = player.getWorld();
|
||||
Location origin = player.getLocation();
|
||||
Vector bot = origin.toVector().subtract(radius, radius, radius);
|
||||
bot.mutY(Math.max(0, bot.getY()));
|
||||
Vector top = origin.toVector().add(radius, radius, radius);
|
||||
top.mutY(Math.min(255, top.getY()));
|
||||
BlockVector3 bot = origin.toVector().toBlockPoint().subtract(radius, radius, radius);
|
||||
bot = bot.withY(Math.max(0, bot.getY()));
|
||||
// bot.mutY(Math.max(0, bot.getY()));
|
||||
BlockVector3 top = origin.toVector().toBlockPoint().add(radius, radius, radius);
|
||||
bot = bot.withY(Math.min(255, top.getY()));
|
||||
// top.mutY(Math.min(255, top.getY()));
|
||||
RollbackDatabase database = DBHandler.IMP.getDatabase(world);
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
final FawePlayer fp = FawePlayer.wrap(player);
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.object.mask.*;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
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.internal.expression.Expression;
|
||||
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.session.request.RequestSelection;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
@ -129,7 +130,7 @@ public class MaskCommands extends MethodCommands {
|
||||
max = 4
|
||||
)
|
||||
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(
|
||||
@ -389,7 +390,7 @@ public class MaskCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
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));
|
||||
}
|
||||
|
||||
@ -401,7 +402,7 @@ public class MaskCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
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));
|
||||
}
|
||||
|
||||
@ -438,7 +439,7 @@ public class MaskCommands extends MethodCommands {
|
||||
)
|
||||
public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||
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);
|
||||
return new ExpressionMask(exp);
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class NavigationCommands {
|
||||
pos = player.getSolidBlockTrace(300);
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
BBC.NO_BLOCK.send(player);
|
||||
|
@ -22,6 +22,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
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 {
|
||||
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);
|
||||
return new ExpressionPattern(exp);
|
||||
}
|
||||
|
@ -34,16 +34,13 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
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.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||
@ -122,7 +120,7 @@ public class RegionCommands extends MethodCommands {
|
||||
if (selection == null) {
|
||||
final int cx = loc.x >> 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);
|
||||
BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count);
|
||||
@ -156,7 +154,7 @@ public class RegionCommands extends MethodCommands {
|
||||
if (selection == null) {
|
||||
final int cx = loc.x >> 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);
|
||||
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
|
||||
@ -173,7 +171,7 @@ public class RegionCommands extends MethodCommands {
|
||||
BBC.NO_BLOCK.send(player);
|
||||
return;
|
||||
}
|
||||
CompoundTag nbt = editSession.getBlock(pos.toVector()).getNbtData();
|
||||
CompoundTag nbt = editSession.getBlock(pos.toVector().toBlockPoint()).getNbtData();
|
||||
if (nbt != null) {
|
||||
player.print(nbt.getValue().toString());
|
||||
} else {
|
||||
@ -194,11 +192,11 @@ public class RegionCommands extends MethodCommands {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
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);
|
||||
}
|
||||
int count = 0;
|
||||
for (Vector2D chunk : region.getChunks()) {
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
|
||||
count++;
|
||||
}
|
||||
@ -218,11 +216,11 @@ public class RegionCommands extends MethodCommands {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
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);
|
||||
}
|
||||
int count = 0;
|
||||
for (Vector2D chunk : region.getChunks()) {
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
|
||||
count++;
|
||||
}
|
||||
@ -290,14 +288,9 @@ public class RegionCommands extends MethodCommands {
|
||||
}
|
||||
worldEdit.checkMaxRadius(thickness);
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.checkConfirmationRegion(() -> {
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
List<Vector> vectors = new ArrayList<Vector>(cpregion.getVertices());
|
||||
=======
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
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);
|
||||
|
||||
@ -378,20 +371,19 @@ public class RegionCommands extends MethodCommands {
|
||||
@Logging(REGION)
|
||||
public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, CommandContext context) throws WorldEditException {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
int maxY = max.getBlockY();
|
||||
int width = region.getWidth();
|
||||
int height = region.getLength();
|
||||
int bx = min.getBlockX();
|
||||
int bz = min.getBlockZ();
|
||||
Iterable<Vector2D> flat = Regions.asFlatRegion(region).asFlatRegion();
|
||||
Iterator<Vector2D> iter = new Fast2DIterator(flat, editSession).iterator();
|
||||
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
|
||||
Iterator<BlockVector2> iter = new Fast2DIterator(flat, editSession).iterator();
|
||||
int y = 0;
|
||||
int affected = 0;
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
while (iter.hasNext()) {
|
||||
Vector2D pos = iter.next();
|
||||
BlockVector2 pos = iter.next();
|
||||
int x = pos.getBlockX();
|
||||
int z = pos.getBlockZ();
|
||||
y = editSession.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY);
|
||||
@ -479,8 +471,8 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.region.smoothsnow")
|
||||
@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 {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
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));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
@ -551,8 +543,7 @@ public class RegionCommands extends MethodCommands {
|
||||
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
<<<<<<< HEAD
|
||||
@Optional(Direction.AIM) @Direction Vector direction,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Optional("air") Pattern replace,
|
||||
@Switch('b') boolean copyBiomes,
|
||||
@Switch('e') boolean skipEntities,
|
||||
@ -571,22 +562,6 @@ public class RegionCommands extends MethodCommands {
|
||||
} catch (RegionOperationException e) {
|
||||
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);
|
||||
@ -637,7 +612,6 @@ public class RegionCommands extends MethodCommands {
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Switch('s') boolean moveSelection,
|
||||
<<<<<<< HEAD
|
||||
@Switch('b') boolean copyBiomes,
|
||||
@Switch('e') boolean skipEntities,
|
||||
@Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException {
|
||||
@ -649,8 +623,8 @@ public class RegionCommands extends MethodCommands {
|
||||
|
||||
if (moveSelection) {
|
||||
try {
|
||||
final Vector 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);
|
||||
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 shiftVector = new BlockVector3(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
|
||||
region.shift(shiftVector);
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
@ -658,22 +632,6 @@ public class RegionCommands extends MethodCommands {
|
||||
} catch (RegionOperationException e) {
|
||||
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);
|
||||
@ -699,17 +657,10 @@ public class RegionCommands extends MethodCommands {
|
||||
@Selection Region region,
|
||||
@Text String expression,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
<<<<<<< HEAD
|
||||
@Switch('o') boolean offset,
|
||||
CommandContext context) throws WorldEditException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('o') boolean offset) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector3.ZERO;
|
||||
unit = Vector3.ONE;
|
||||
@ -723,19 +674,15 @@ public class RegionCommands extends MethodCommands {
|
||||
zero = max.add(min).divide(2);
|
||||
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.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
final int affected = editSession.deformRegion(region, zero, unit, expression);
|
||||
final int affected = editSession.deformRegion(region, zero, unit1, expression);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
} catch (ExpressionException e) {
|
||||
|
@ -43,12 +43,10 @@ import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
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.RegionOperationException;
|
||||
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.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
<<<<<<< HEAD
|
||||
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.storage.ChunkStore;
|
||||
import java.io.File;
|
||||
@ -109,21 +104,20 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@CommandPermissions("worldedit.selection.pos")
|
||||
public void pos1(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos;
|
||||
public void pos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos;
|
||||
|
||||
if (args.argsLength() == 1) {
|
||||
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
|
||||
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 {
|
||||
BBC.SELECTOR_INVALID_COORDINATES.send(player, args.getString(0));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
pos = player.getBlockIn().toVector();
|
||||
pos = player.getBlockIn().toVector().toBlockPoint();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
@ -131,16 +125,6 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
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(
|
||||
@ -152,12 +136,12 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@CommandPermissions("worldedit.selection.pos")
|
||||
public void pos2(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos;
|
||||
public void pos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos;
|
||||
if (args.argsLength() == 1) {
|
||||
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
|
||||
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[2]));
|
||||
} else {
|
||||
@ -165,26 +149,16 @@ public class SelectionCommands {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
pos = player.getBlockIn().toVector();
|
||||
pos = player.getBlockIn().toVector().toBlockPoint();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(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;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
=======
|
||||
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -195,26 +169,17 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.hpos")
|
||||
public void hpos1(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos = player.getBlockTrace(300).toVector();
|
||||
public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
|
||||
|
||||
if (pos != null) {
|
||||
<<<<<<< HEAD
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(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;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainPrimarySelection(player, session, pos);
|
||||
=======
|
||||
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
player.printError("No block in sight!");
|
||||
}
|
||||
@ -228,26 +193,17 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.hpos")
|
||||
public void hpos2(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos = player.getBlockTrace(300).toVector();
|
||||
public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
|
||||
|
||||
if (pos != null) {
|
||||
<<<<<<< HEAD
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(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;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
=======
|
||||
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
player.printError("No block in sight!");
|
||||
}
|
||||
@ -271,15 +227,9 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@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 {
|
||||
final BlockVector3 min;
|
||||
final BlockVector3 max;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
final World world = player.getWorld();
|
||||
if (args.hasFlag('s')) {
|
||||
Region region = session.getSelection(world);
|
||||
@ -336,7 +286,7 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@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));
|
||||
BBC.SELECTION_WAND.send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
|
||||
@ -370,7 +320,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@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
|
||||
// sky and bedrock.
|
||||
if (args.getString(0).equalsIgnoreCase("vert") || args.getString(0).equalsIgnoreCase("vertical")) {
|
||||
@ -390,12 +340,7 @@ public class SelectionCommands {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
int reverseChange = 0;
|
||||
|
||||
@ -465,14 +410,9 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@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 {
|
||||
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
int reverseChange = 0;
|
||||
|
||||
@ -544,14 +484,9 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@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 {
|
||||
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
if (args.argsLength() == 2) {
|
||||
if (args.getString(1).contains(",")) {
|
||||
@ -596,7 +531,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@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.expand(getChangesForEachDir(args));
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
@ -619,7 +554,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@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.contract(getChangesForEachDir(args));
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
@ -627,13 +562,8 @@ public class SelectionCommands {
|
||||
BBC.SELECTION_INSET.send(player);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private Vector[] getChangesForEachDir(CommandContext args) {
|
||||
List<Vector> changes = new ArrayList<Vector>(6);
|
||||
=======
|
||||
private BlockVector3[] getChangesForEachDir(CommandContext args) {
|
||||
List<BlockVector3> changes = new ArrayList<>(6);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
|
||||
if (!args.hasFlag('h')) {
|
||||
@ -660,8 +590,7 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.size")
|
||||
<<<<<<< HEAD
|
||||
public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
if (args.hasFlag('c')) {
|
||||
ClipboardHolder root = session.getClipboard();
|
||||
// Clipboard clipboard = holder.getClipboard();
|
||||
@ -681,8 +610,8 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
Region region = clipboard.getRegion();
|
||||
Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(Vector.ONE);
|
||||
Vector origin = clipboard.getOrigin();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(BlockVector3.ONE);
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
|
||||
String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.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() + "Cuboid distance: " + size.distance(Vector.ONE));
|
||||
// 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 {
|
||||
if (args.hasFlag('c')) {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
|
||||
player.print("Cuboid dimensions (max - min): " + size);
|
||||
player.print("Offset: " + origin);
|
||||
player.print("Cuboid distance: " + size.distance(BlockVector3.ONE));
|
||||
player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
// if (args.hasFlag('c')) {
|
||||
// ClipboardHolder holder = session.getClipboard();
|
||||
// Clipboard clipboard = holder.getClipboard();
|
||||
// Region region = clipboard.getRegion();
|
||||
// BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
// BlockVector3 origin = clipboard.getOrigin();
|
||||
//
|
||||
// player.print("Cuboid dimensions (max - min): " + size);
|
||||
// player.print("Offset: " + origin);
|
||||
// player.print("Cuboid distance: " + size.distance(BlockVector3.ONE));
|
||||
// player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -723,11 +651,7 @@ public class SelectionCommands {
|
||||
.subtract(region.getMinimumPoint())
|
||||
.add(1, 1, 1);
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld())
|
||||
=======
|
||||
player.print("Type: " + session.getRegionSelector(player.getWorld())
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
.getTypeName());
|
||||
|
||||
for (String line : session.getRegionSelector(player.getWorld())
|
||||
@ -735,15 +659,9 @@ public class SelectionCommands {
|
||||
player.print(BBC.getPrefix() + line);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Size: " + size);
|
||||
player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
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.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
@ -57,7 +54,6 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
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.EntityRemover;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -260,7 +256,6 @@ public class UtilityCommands extends MethodCommands {
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Command(
|
||||
aliases = {"/fill"},
|
||||
usage = "<pattern> <radius> [depth] [direction]",
|
||||
@ -270,17 +265,12 @@ public class UtilityCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.fill")
|
||||
@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);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected;
|
||||
affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction);
|
||||
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(
|
||||
@ -292,35 +282,34 @@ public class UtilityCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.fill.recursive")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException {
|
||||
worldEdit.checkMaxRadius(radius);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
if (depth == -1) depth = Integer.MAX_VALUE;
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true);
|
||||
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
|
||||
=======
|
||||
public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
ParserContext context = new ParserContext();
|
||||
context.setActor(player);
|
||||
context.setWorld(player.getWorld());
|
||||
context.setSession(session);
|
||||
Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
|
||||
|
||||
double radius = Math.max(1, args.getDouble(1));
|
||||
we.checkMaxRadius(radius);
|
||||
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE;
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = 0;
|
||||
if (pattern instanceof BlockPattern) {
|
||||
affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true);
|
||||
} else {
|
||||
affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
}
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
//
|
||||
// ParserContext context = new ParserContext();
|
||||
// context.setActor(player);
|
||||
// context.setWorld(player.getWorld());
|
||||
// context.setSession(session);
|
||||
// Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
|
||||
//
|
||||
// double radius = Math.max(1, args.getDouble(1));
|
||||
// we.checkMaxRadius(radius);
|
||||
// int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE;
|
||||
//
|
||||
// BlockVector3 pos = session.getPlacementPosition(player);
|
||||
// int affected = 0;
|
||||
// if (pattern instanceof BlockPattern) {
|
||||
// affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true);
|
||||
// } else {
|
||||
// affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
// }
|
||||
// player.print(affected + " block(s) have been created.");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -430,16 +419,10 @@ public class UtilityCommands extends MethodCommands {
|
||||
if (from == null) {
|
||||
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 min = base.subtract(size, size, size);
|
||||
BlockVector3 max = base.add(size, size, size);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
BlockVector3 min = base.subtract((int)size, (int)size, (int)size);
|
||||
BlockVector3 max = base.add((int)size, (int)size, (int)size);
|
||||
Region region = new CuboidRegion(player.getWorld(), min, max);
|
||||
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
@ -574,13 +557,8 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
<<<<<<< HEAD
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
Vector center = session.getPlacementPosition(player);
|
||||
=======
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
@ -639,13 +617,8 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
<<<<<<< HEAD
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
Vector center = session.getPlacementPosition(player);
|
||||
=======
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
|
@ -3,18 +3,12 @@ package com.sk89q.worldedit.command.tool;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
=======
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -49,7 +43,6 @@ public class AreaPickaxe implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
@ -58,24 +51,22 @@ public class AreaPickaxe implements BlockTool {
|
||||
for (int y = oy + range; y >= oy - range; --y) {
|
||||
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
||||
continue;
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
try {
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int y = oy - range; y <= oy + range; ++y) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
||||
|
||||
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// try (EditSession editSession = session.createEditSession(player)) {
|
||||
// editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
//
|
||||
// try {
|
||||
// for (int x = ox - range; x <= ox + range; ++x) {
|
||||
// for (int y = oy - range; y <= oy + range; ++y) {
|
||||
// for (int z = oz - range; z <= oz + range; ++z) {
|
||||
// BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
// if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
||||
//
|
||||
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
// }
|
||||
}
|
||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
|
@ -19,6 +19,12 @@
|
||||
|
||||
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.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -26,13 +32,11 @@ 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;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
/**
|
||||
@ -44,18 +48,17 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
public boolean canUse(Actor player) {
|
||||
return player.hasPermission("worldedit.tool.data-cycler");
|
||||
}
|
||||
|
||||
private Map<UUID, Property<?>> selectedProperties = new HashMap<>();
|
||||
|
||||
private boolean handleCycle(Platform server, LocalConfiguration config,
|
||||
Player player, LocalSession session, Location clicked, boolean forward) {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockStateHolder block = world.getBlock(clicked.toVector());
|
||||
=======
|
||||
// BlockStateHolder block = world.getBlock(clicked.toVector());
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
BlockState block = world.getBlock(blockPoint);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
@ -64,61 +67,45 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block.getBlockType().getProperties().isEmpty()) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
if (block.getStates().keySet().isEmpty()) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
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)) {
|
||||
currentProperty = block.getStates().keySet().stream().findFirst().get();
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
}
|
||||
|
||||
if (forward) {
|
||||
block.getState(currentProperty);
|
||||
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
|
||||
index = (index + 1) % currentProperty.getValues().size();
|
||||
BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index));
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.disableBuffering();
|
||||
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
|
||||
int index = properties.indexOf(currentProperty);
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
|
||||
|
||||
if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
|
||||
currentProperty = block.getStates().keySet().stream().findFirst().get();
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
}
|
||||
|
||||
if (forward) {
|
||||
block.getState(currentProperty);
|
||||
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
|
||||
index = (index + 1) % currentProperty.getValues().size();
|
||||
@SuppressWarnings("unchecked")
|
||||
Property<Object> objProp = (Property<Object>) currentProperty;
|
||||
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));
|
||||
|
||||
try {
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}catch (Exception e) {}
|
||||
} else {
|
||||
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
|
||||
int index = properties.indexOf(currentProperty);
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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) {
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), 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
|
||||
editSession.setBlock(clicked.toVector().toBlockPoint(), pattern);
|
||||
} finally {
|
||||
if (bag != null) {
|
||||
bag.flushChanges();
|
||||
@ -87,13 +75,9 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector());
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector().toBlockPoint());
|
||||
BlockType type = targetBlock.getBlockType();
|
||||
=======
|
||||
BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (type != null) {
|
||||
this.pattern = targetBlock;
|
||||
|
@ -24,6 +24,8 @@ import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
@ -379,19 +381,19 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public Vector getPosition(EditSession editSession, Player player) {
|
||||
public BlockVector3 getPosition(EditSession editSession, Player player) {
|
||||
Location loc = player.getLocation();
|
||||
switch (targetMode) {
|
||||
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: {
|
||||
int d = 0;
|
||||
float pitch = loc.getPitch();
|
||||
pitch = 23 - (pitch / 4);
|
||||
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
|
||||
final Vector vector = loc.getDirection().setY(0).normalize().multiply(d);
|
||||
vector.add(loc.getX(), loc.getY(), loc.getZ()).toBlockVector();
|
||||
return offset(new MutableBlockVector(vector), loc.toVector());
|
||||
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
|
||||
// vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
|
||||
return offset(vector, loc.toVector()).toBlockPoint();
|
||||
}
|
||||
case TARGET_POINT_HEIGHT: {
|
||||
final int height = loc.getBlockY();
|
||||
@ -405,34 +407,33 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
}
|
||||
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:
|
||||
return offset(new MutableBlockVector(trace(editSession, player, getRange(), true)), loc.toVector());
|
||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Vector offset(Vector target, Vector playerPos) {
|
||||
private Vector3 offset(Vector3 target, Vector3 playerPos) {
|
||||
if (targetOffset == 0) return target;
|
||||
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;
|
||||
new MaskTraverser(mask).reset(editSession);
|
||||
MaskedTargetBlock tb = new MaskedTargetBlock(mask, player, range, 0.2);
|
||||
return TaskManager.IMP.sync(new RunnableVal<Vector>() {
|
||||
return TaskManager.IMP.sync(new RunnableVal<Vector3>() {
|
||||
@Override
|
||||
public void run(Vector value) {
|
||||
public void run(Vector3 value) {
|
||||
Location result = tb.getMaskedTargetBlock(useLastBlock);
|
||||
this.value = result.toVector();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public boolean act(BrushAction action, Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
switch (action) {
|
||||
case PRIMARY:
|
||||
@ -454,7 +455,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector target = getPosition(editSession, player);
|
||||
BlockVector3 target = getPosition(editSession, player);
|
||||
|
||||
if (target == null) {
|
||||
editSession.cancel();
|
||||
@ -475,14 +476,14 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
MaskIntersection newMask = new MaskIntersection(existingMask);
|
||||
newMask.add(mask);
|
||||
editSession.setMask(newMask);
|
||||
=======
|
||||
try {
|
||||
brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// try {
|
||||
// brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
||||
// } catch (MaxChangedBlocksException e) {
|
||||
// player.printError("Max blocks change limit reached.");
|
||||
// } finally {
|
||||
// session.remember(editSession);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
Mask sourceMask = current.getSourceMask();
|
||||
@ -622,7 +623,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
.combineStages(false)
|
||||
.build();
|
||||
VisualExtent newVisualExtent = new VisualExtent(editSession.getExtent(), editSession.getQueue());
|
||||
Vector position = getPosition(editSession, player);
|
||||
BlockVector3 position = getPosition(editSession, player);
|
||||
if (position != null) {
|
||||
editSession.setExtent(newVisualExtent);
|
||||
switch (mode) {
|
||||
|
@ -75,24 +75,8 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
player.printError("That's not a tree.");
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
final 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 {
|
||||
try /*(EditSession editSession = session.createEditSession(player))*/ {
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
||||
if (blockSet == null) {
|
||||
player.printError("That's not a floating tree.");
|
||||
@ -104,9 +88,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
if (isTreeBlock(otherState.getBlockType())) {
|
||||
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -19,14 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
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) {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockType initialType = world.getBlockType(clicked.toVector());
|
||||
=======
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (initialType.getMaterial().isAir()) {
|
||||
return true;
|
||||
@ -77,38 +70,22 @@ public class FloodFillTool implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
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);
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
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,
|
||||
Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (origin.distance(pos) > size || visited.contains(pos)) {
|
||||
return;
|
||||
|
@ -56,11 +56,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
<<<<<<< HEAD
|
||||
EditSession eS = session.createEditSession(player);
|
||||
=======
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
try {
|
||||
// eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = secondary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
@ -73,31 +71,16 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
// one block? eat it
|
||||
}
|
||||
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
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
<<<<<<< HEAD
|
||||
EditSession eS = session.createEditSession(player);
|
||||
BlockStateHolder applied = primary.apply(pos.toVector());
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(pos.toVector(), primary);
|
||||
} else {
|
||||
eS.setBlock(pos.add(pos.getDirection()), primary);
|
||||
=======
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
|
||||
try {
|
||||
// eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = primary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
@ -108,7 +91,6 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
// one block? eat it
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.util.Set;
|
||||
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
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.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
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.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
/**
|
||||
@ -46,14 +45,11 @@ public class RecursivePickaxe implements BlockTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
final Vector pos = clicked.toVector();
|
||||
final BlockVector3 pos = clicked.toVector().toBlockPoint();
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
=======
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
BlockStateHolder block = editSession.getBlock(pos);
|
||||
if (block.getBlockType().getMaterial().isAir()) {
|
||||
@ -66,7 +62,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
final int radius = (int) range;
|
||||
final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock));
|
||||
editSession.setMask((Mask) null);
|
||||
@ -76,54 +72,51 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
=======
|
||||
try {
|
||||
recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
||||
clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// try {
|
||||
// recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
||||
// clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
||||
// } catch (MaxChangedBlocksException e) {
|
||||
// player.printError("Max blocks change limit reached.");
|
||||
// } finally {
|
||||
// session.remember(editSession);
|
||||
// }
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
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 {
|
||||
|
||||
final double distanceSq = origin.distanceSq(pos);
|
||||
if (distanceSq > size*size || visited.contains(pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
visited.add(pos);
|
||||
|
||||
if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
return;
|
||||
}
|
||||
|
||||
world.queueBlockBreakEffect(server, pos, initialType, distanceSq);
|
||||
|
||||
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),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 0, 1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 0, -1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 1, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, -1, 0),
|
||||
origin, size, initialType, visited);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// 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)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// visited.add(pos);
|
||||
//
|
||||
// if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// world.queueBlockBreakEffect(server, pos, initialType, distanceSq);
|
||||
//
|
||||
// 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),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, 0, 1),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, 0, -1),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, 1, 0),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, -1, 0),
|
||||
// origin, size, initialType, visited);
|
||||
// }
|
||||
|
||||
}
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.tool;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
@ -42,30 +43,20 @@ public class SinglePickaxe implements BlockTool {
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
<<<<<<< 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);
|
||||
=======
|
||||
World world = (World) clicked.getExtent();
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
|
||||
if (blockType == BlockTypes.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
final EditSession editSession = session.createEditSession(player);
|
||||
try {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
|
||||
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
try {
|
||||
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
|
||||
|
@ -50,23 +50,14 @@ public class TreePlanter implements BlockTool {
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
<<<<<<< HEAD
|
||||
try {
|
||||
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++) {
|
||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
if (!successful) {
|
||||
player.printError("A tree can't go there.");
|
||||
|
@ -20,13 +20,9 @@
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
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
|
||||
* before the change has reached the history, reordering, and actual change
|
||||
* 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
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
* custom {@link Extent} because that method bypasses history (and reorder).
|
||||
* It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE}
|
||||
* and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and
|
||||
|
@ -19,12 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
||||
@ -35,11 +36,11 @@ public class PasteEvent extends Event implements Cancellable {
|
||||
private final Player player;
|
||||
private final Clipboard clipboard;
|
||||
private final URI uri;
|
||||
private final Vector to;
|
||||
private final BlockVector3 to;
|
||||
private final Extent extent;
|
||||
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.clipboard = clipboard;
|
||||
this.uri = uri;
|
||||
@ -59,7 +60,7 @@ public class PasteEvent extends Event implements Cancellable {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public Vector getPosition() {
|
||||
public BlockVector3 getPosition() {
|
||||
return to;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.jnbt.JSON2NBT;
|
||||
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.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
=======
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
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.SignBlock;
|
||||
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.SlottableBlockBag;
|
||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
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]+", ""));
|
||||
// Get the block type from the "primary position"
|
||||
final World world = context.requireWorld();
|
||||
<<<<<<< HEAD
|
||||
final Vector primaryPosition;
|
||||
=======
|
||||
final BlockVector3 primaryPosition;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
try {
|
||||
primaryPosition = context.requireSession().getRegionSelector(world).getVerticies().get(index - 1);
|
||||
} catch (IncompleteRegionException e) {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.command.FaweParser;
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
=======
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.MaskCommands;
|
||||
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.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
import com.sk89q.worldedit.internal.command.ActorAuthorizer;
|
||||
import com.sk89q.worldedit.internal.command.WorldEditBinding;
|
||||
=======
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.NoiseFilter;
|
||||
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.noise.RandomNoise;
|
||||
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.util.command.Dispatcher;
|
||||
import com.sk89q.worldedit.util.command.SimpleDispatcher;
|
||||
@ -169,10 +163,10 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
List<String> args = entry.getValue();
|
||||
String cmdArgs = ((args.isEmpty()) ? "" : " " + StringMan.join(args, " "));
|
||||
try {
|
||||
//<<<<<<< HEAD
|
||||
List<String> args = entry.getValue();
|
||||
String cmdArgs = ((args.isEmpty()) ? "" : " " + StringMan.join(args, " "));
|
||||
try {
|
||||
mask = (Mask) dispatcher.call(command + cmdArgs, locals, new String[0]);
|
||||
} catch (SuggestInputParseException rethrow) {
|
||||
throw rethrow;
|
||||
@ -198,55 +192,55 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
||||
throw new InputParseException(e2.getMessage());
|
||||
}
|
||||
});
|
||||
=======
|
||||
throw new NoMatchException("Unrecognized mask '" + component + '\'');
|
||||
}
|
||||
|
||||
case '>':
|
||||
case '<':
|
||||
Mask submask;
|
||||
if (component.length() > 1) {
|
||||
submask = getBlockMaskComponent(masks, component.substring(1), context);
|
||||
} else {
|
||||
submask = new ExistingBlockMask(extent);
|
||||
}
|
||||
OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(submask));
|
||||
|
||||
case '$':
|
||||
Set<BaseBiome> biomes = new HashSet<>();
|
||||
String[] biomesList = component.substring(1).split(",");
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
|
||||
for (String biomeName : biomesList) {
|
||||
BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
|
||||
if (biome == null) {
|
||||
throw new InputParseException("Unknown biome '" + biomeName + '\'');
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// throw new NoMatchException("Unrecognized mask '" + component + '\'');
|
||||
// }
|
||||
//
|
||||
// case '>':
|
||||
// case '<':
|
||||
// Mask submask;
|
||||
// if (component.length() > 1) {
|
||||
// submask = getBlockMaskComponent(masks, component.substring(1), context);
|
||||
// } else {
|
||||
// submask = new ExistingBlockMask(extent);
|
||||
// }
|
||||
// OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0));
|
||||
// return new MaskIntersection(offsetMask, Masks.negate(submask));
|
||||
//
|
||||
// case '$':
|
||||
// Set<BaseBiome> biomes = new HashSet<>();
|
||||
// String[] biomesList = component.substring(1).split(",");
|
||||
// BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
// .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
// List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
|
||||
// for (String biomeName : biomesList) {
|
||||
// BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
|
||||
// if (biome == null) {
|
||||
// throw new InputParseException("Unknown biome '" + biomeName + '\'');
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
if (pe.and) {
|
||||
masks.add(new ArrayList<>());
|
||||
=======
|
||||
|
||||
return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
|
||||
|
||||
case '%':
|
||||
int i = Integer.parseInt(component.substring(1));
|
||||
return new NoiseFilter(new RandomNoise(), ((double) i) / 100);
|
||||
|
||||
case '=':
|
||||
try {
|
||||
Expression exp = Expression.compile(component.substring(1), "x", "y", "z");
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
|
||||
Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
return new ExpressionMask(exp);
|
||||
} catch (ExpressionException e) {
|
||||
throw new InputParseException("Invalid expression: " + e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
//
|
||||
// return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
|
||||
//
|
||||
// case '%':
|
||||
// int i = Integer.parseInt(component.substring(1));
|
||||
// return new NoiseFilter(new RandomNoise(), ((double) i) / 100);
|
||||
//
|
||||
// case '=':
|
||||
// try {
|
||||
// Expression exp = Expression.compile(component.substring(1), "x", "y", "z");
|
||||
// WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
|
||||
// Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO);
|
||||
// exp.setEnvironment(env);
|
||||
// return new ExpressionMask(exp);
|
||||
// } catch (ExpressionException e) {
|
||||
// throw new InputParseException("Invalid expression: " + e.getMessage());
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
masks.get(masks.size() - 1).add(mask);
|
||||
}
|
||||
|
@ -22,10 +22,8 @@ package com.sk89q.worldedit.extension.platform;
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.PlayerDirection;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
=======
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
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.TargetBlock;
|
||||
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.blocks.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -127,13 +123,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
if (free == 2) {
|
||||
if (y - 1 != origY) {
|
||||
<<<<<<< HEAD
|
||||
final Vector pos = new Vector(x, y - 2, z);
|
||||
final BlockVector3 pos = new BlockVector3(x, y - 2, z);
|
||||
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 + 1, z + 0.5));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
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));
|
||||
}
|
||||
|
||||
return;
|
||||
@ -151,17 +144,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
int z = searchPos.getBlockZ();
|
||||
|
||||
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 BlockState id = world.getBlock(pos);
|
||||
if (id.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
setPosition(new Vector3(x + 0.5, y + 1, z + 0.5));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
setPosition(new Vector3(x + 0.5, y + + BlockType.centralTopLimit(id), z + 0.5));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -185,8 +171,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
int maxY = world.getMaxY();
|
||||
if (y >= maxY) return false;
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockMaterial initialMaterial = world.getBlockType(new Vector(x, y, z)).getMaterial();
|
||||
BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
|
||||
|
||||
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++) {
|
||||
BlockState state;
|
||||
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();
|
||||
BlockMaterial material = type.getMaterial();
|
||||
|
||||
@ -204,29 +189,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
if (!lastState) {
|
||||
lastState = BlockType.centralBottomLimit(state) != 1;
|
||||
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) {
|
||||
freeStart = level + BlockType.centralTopLimit(state);
|
||||
@ -234,7 +196,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
double bottomLimit = BlockType.centralBottomLimit(state);
|
||||
double space = level + bottomLimit - freeStart;
|
||||
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;
|
||||
}
|
||||
// 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 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();
|
||||
|
||||
double height = 1.85;
|
||||
@ -272,7 +233,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
for (int level = y + 1; level > 0; level--) {
|
||||
BlockState state;
|
||||
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();
|
||||
BlockMaterial material = type.getMaterial();
|
||||
|
||||
@ -288,29 +249,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
double freeStart = level + topLimit;
|
||||
double space = freeEnd - freeStart;
|
||||
if (space >= height) {
|
||||
setPosition(new Vector(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
|
||||
setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
|
||||
return true;
|
||||
}
|
||||
// Not enough room, reset the free position
|
||||
@ -392,41 +331,25 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
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 {
|
||||
BlockVector3 spot = new BlockVector3(x, y - 1, z);
|
||||
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
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));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockIn() {
|
||||
<<<<<<< HEAD
|
||||
Location loc = getLocation();
|
||||
return new Location(loc.getExtent(), loc.toBlockVector(), loc.getDirection());
|
||||
=======
|
||||
return getLocation().setPosition(getLocation().toVector().floor());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockOn() {
|
||||
<<<<<<< HEAD
|
||||
return getLocation().setY(getLocation().getY() - 1);
|
||||
=======
|
||||
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -607,12 +530,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
return false;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
@Override
|
||||
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
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren