use of com.fastasyncworldedit.core.math.MutableBlockVector3 in project FastAsyncWorldEdit by IntellectualSites.
the class AngleMask method test.
@Override
public boolean test(BlockVector3 vector) {
if (!mask.test(vector)) {
return false;
}
int y = vector.getBlockY();
if (overlay) {
MutableBlockVector3 mutable = new MutableBlockVector3(vector);
if (y < maxY && !adjacentAir(null, mutable)) {
return false;
}
}
int x = vector.getBlockX();
int z = vector.getBlockZ();
return testSlope(getExtent(), x, y, z);
}
use of com.fastasyncworldedit.core.math.MutableBlockVector3 in project FastAsyncWorldEdit by IntellectualSites.
the class AngleMask method test.
@Override
public boolean test(final Extent extent, final BlockVector3 vector) {
int x = vector.getBlockX();
int y = vector.getBlockY();
int z = vector.getBlockZ();
if ((lastX == (lastX = x) & lastZ == (lastZ = z))) {
int height = getHeight(extent, x, y, z);
if (y <= height) {
return overlay ? (lastValue && y == height) : lastValue;
}
}
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
if (!mask.test(extent, mutable)) {
return false;
}
if (overlay) {
if (y < maxY && !adjacentAir(extent, mutable)) {
return lastValue = false;
}
}
return testSlope(extent, x, y, z);
}
use of com.fastasyncworldedit.core.math.MutableBlockVector3 in project FastAsyncWorldEdit by IntellectualSites.
the class SurfaceRandomOffsetPattern method travel.
private BlockVector3 travel(BlockVector3 pos) {
cur.setComponents(pos);
MutableBlockVector3 next;
for (int move = 0; move < moves; move++) {
int index = 0;
for (int i = 0; i < allowed.length; i++) {
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)) {
allowed[index++] = next;
}
}
if (index == 0) {
return cur;
}
next = allowed[ThreadLocalRandom.current().nextInt(index)];
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
}
return cur;
}
use of com.fastasyncworldedit.core.math.MutableBlockVector3 in project FastAsyncWorldEdit by IntellectualSites.
the class ScaleTransform method setBlock.
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(int x1, int y1, int z1, B block) throws WorldEditException {
boolean result = false;
MutableVector3 vector3 = getPos(x1, y1, z1);
MutableBlockVector3 pos = new MutableBlockVector3();
double sx = vector3.getX();
double sy = vector3.getY();
double sz = vector3.getZ();
double ex = vector3.getX() + dx;
double ey = Math.min(maxy, sy + dy);
double ez = vector3.getZ() + dz;
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)) {
if (!getExtent().contains(pos)) {
continue;
}
result |= super.setBlock(pos, block);
}
}
}
return result;
}
use of com.fastasyncworldedit.core.math.MutableBlockVector3 in project FastAsyncWorldEdit by IntellectualSites.
the class ScaleTransform method setBlock.
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
boolean result = false;
MutableVector3 vector3 = getPos(location);
MutableBlockVector3 pos = new MutableBlockVector3();
double sx = vector3.getX();
double sy = vector3.getY();
double sz = vector3.getZ();
double ex = sx + dx;
double ey = Math.max(minY, Math.min(maxy, sy + dy));
double ez = sz + dz;
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)) {
if (!getExtent().contains(pos)) {
continue;
}
result |= super.setBlock(pos, block);
}
}
}
return result;
}
Aggregations