本文整理匯總了Java中com.sk89q.worldedit.Vector.toBlockVector方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector.toBlockVector方法的具體用法?Java Vector.toBlockVector怎麽用?Java Vector.toBlockVector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sk89q.worldedit.Vector
的用法示例。
在下文中一共展示了Vector.toBlockVector方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
protected void execute(Event event) {
String name = (String) this.name.getSingle(event);
Location loc1 = (Location) this.loc1.getSingle(event);
Location loc2 = (Location) this.loc2.getSingle(event);
World world = (World) this.world.getSingle(event);
int x1 = loc1.getBlockX();
int y1 = loc1.getBlockY();
int z1 = loc1.getBlockZ();
int x2 = loc2.getBlockX();
int y2 = loc2.getBlockY();
int z2 = loc2.getBlockZ();
Vector p1 = new Vector(x1, y1, z1);
Vector p2 = new Vector(x2, y2, z2);
RegionManager regionManager = WGBukkit.getRegionManager(world);
ProtectedCuboidRegion region = new ProtectedCuboidRegion(name, p1.toBlockVector(), p2.toBlockVector());
regionManager.addRegion(region);
try {
regionManager.save();
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: selectPrimary
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public boolean selectPrimary(Vector position, SelectorLimits limits) {
checkNotNull(position);
clear();
pos1 = position.toBlockVector();
return region.addVertex(position);
}
示例3: selectPrimary
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@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;
}
示例4: selectPrimary
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@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;
}
示例5: CuboidRegionSelector
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
/**
* 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);
}
示例6: selectPrimary
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@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;
}
示例7: selectSecondary
import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@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;
}