Java Code Examples for com.sk89q.worldedit.Vector#toBlockVector()

The following examples show how to use com.sk89q.worldedit.Vector#toBlockVector() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolyhedralRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean selectPrimary(Vector position, SelectorLimits limits) {
    checkNotNull(position);
    clear();
    pos1 = position.toBlockVector();
    return region.addVertex(position);
}
 
Example 2
Source File: Polygonal2DRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean selectPrimary(Vector position, SelectorLimits limits) {
    if (position.equals(pos1)) {
        return false;
    }

    pos1 = position.toBlockVector();
    region = new Polygonal2DRegion(region.getWorld());
    region.addPoint(position);
    region.expandY(position.getBlockY());

    return true;
}
 
Example 3
Source File: ExtendingCuboidRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean selectPrimary(Vector position, SelectorLimits limits) {
    if (position1 != null && position2 != null && position.compareTo(position1) == 0 && position.compareTo(position2) == 0) {
        return false;
    }

    position1 = position2 = position.toBlockVector();
    region.setPos1(position1);
    region.setPos2(position2);
    return true;
}
 
Example 4
Source File: ConvexPolyhedralRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean selectPrimary(Vector position, SelectorLimits limits) {
    checkNotNull(position);
    clear();
    pos1 = position.toBlockVector();
    return region.addVertex(position);
}
 
Example 5
Source File: CuboidRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create a new region selector with the given two positions.
 *
 * @param world     the world
 * @param position1 position 1
 * @param position2 position 2
 */
public CuboidRegionSelector(@Nullable World world, Vector position1, Vector position2) {
    this(world);
    checkNotNull(position1);
    checkNotNull(position2);
    this.position1 = position1.toBlockVector();
    this.position2 = position2.toBlockVector();
    region.setPos1(position1);
    region.setPos2(position2);
}
 
Example 6
Source File: CuboidRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean selectPrimary(Vector position, SelectorLimits limits) {
    checkNotNull(position);

    if (position1 != null && (position.compareTo(position1) == 0)) {
        return false;
    }

    position1 = position.toBlockVector();
    region.setPos1(position1);
    return true;
}
 
Example 7
Source File: CuboidRegionSelector.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean selectSecondary(Vector position, SelectorLimits limits) {
    checkNotNull(position);

    if (position2 != null && (position.compareTo(position2)) == 0) {
        return false;
    }

    position2 = position.toBlockVector();
    region.setPos2(position2);
    return true;
}