Search in sources :

Example 1 with MutableVector3

use of com.fastasyncworldedit.core.math.MutableVector3 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;
}
Also used : MutableVector3(com.fastasyncworldedit.core.math.MutableVector3) MutableBlockVector3(com.fastasyncworldedit.core.math.MutableBlockVector3)

Example 2 with MutableVector3

use of com.fastasyncworldedit.core.math.MutableVector3 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;
}
Also used : MutableVector3(com.fastasyncworldedit.core.math.MutableVector3) MutableBlockVector3(com.fastasyncworldedit.core.math.MutableBlockVector3)

Example 3 with MutableVector3

use of com.fastasyncworldedit.core.math.MutableVector3 in project FastAsyncWorldEdit by IntellectualSites.

the class ScaleTransform method setBiome.

@Override
public boolean setBiome(BlockVector3 position, BiomeType biome) {
    boolean result = false;
    MutableVector3 vector3 = getPos(position);
    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.setBiome(pos, biome);
            }
        }
    }
    return result;
}
Also used : MutableVector3(com.fastasyncworldedit.core.math.MutableVector3) MutableBlockVector3(com.fastasyncworldedit.core.math.MutableBlockVector3)

Example 4 with MutableVector3

use of com.fastasyncworldedit.core.math.MutableVector3 in project FastAsyncWorldEdit by IntellectualSites.

the class PositionTransformExtent method getPos.

private BlockVector3 getPos(BlockVector3 pos) {
    if (min == null) {
        min = pos;
    }
    mutable.mutX(pos.getX() - min.getX());
    mutable.mutY(pos.getY() - min.getY());
    mutable.mutZ(pos.getZ() - min.getZ());
    MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
    return min.add(tmp.roundHalfUp().toBlockPoint());
}
Also used : MutableVector3(com.fastasyncworldedit.core.math.MutableVector3)

Example 5 with MutableVector3

use of com.fastasyncworldedit.core.math.MutableVector3 in project FastAsyncWorldEdit by IntellectualSites.

the class PositionTransformExtent method getPos.

private BlockVector3 getPos(int x, int y, int z) {
    if (min == null) {
        min = BlockVector3.at(x, y, z);
    }
    mutable.mutX(x - min.getX());
    mutable.mutY(y - min.getY());
    mutable.mutZ(z - min.getZ());
    MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
    return min.add(tmp.roundHalfUp().toBlockPoint());
}
Also used : MutableVector3(com.fastasyncworldedit.core.math.MutableVector3)

Aggregations

MutableVector3 (com.fastasyncworldedit.core.math.MutableVector3)11 MutableBlockVector3 (com.fastasyncworldedit.core.math.MutableBlockVector3)5 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)2 Vector3 (com.sk89q.worldedit.math.Vector3)1 AffineTransform (com.sk89q.worldedit.math.transform.AffineTransform)1