本文整理汇总了Java中com.sk89q.worldedit.regions.RegionSelector.getRegion方法的典型用法代码示例。如果您正苦于以下问题:Java RegionSelector.getRegion方法的具体用法?Java RegionSelector.getRegion怎么用?Java RegionSelector.getRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.regions.RegionSelector
的用法示例。
在下文中一共展示了RegionSelector.getRegion方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CuboidRegionSelector
import com.sk89q.worldedit.regions.RegionSelector; //导入方法依赖的package包/类
/**
* Create a copy of another selector.
*
* @param oldSelector another selector
*/
public CuboidRegionSelector(RegionSelector oldSelector) {
this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());
if (oldSelector instanceof CuboidRegionSelector) {
final CuboidRegionSelector cuboidRegionSelector = (CuboidRegionSelector) oldSelector;
position1 = cuboidRegionSelector.position1;
position2 = cuboidRegionSelector.position2;
} else {
final Region oldRegion;
try {
oldRegion = oldSelector.getRegion();
} catch (IncompleteRegionException e) {
return;
}
position1 = oldRegion.getMinimumPoint().toBlockVector();
position2 = oldRegion.getMaximumPoint().toBlockVector();
}
region.setPos1(position1);
region.setPos2(position2);
}
示例2: EllipsoidRegionSelector
import com.sk89q.worldedit.regions.RegionSelector; //导入方法依赖的package包/类
/**
* Create a new selector from the given selector.
*
* @param oldSelector the old selector
*/
public EllipsoidRegionSelector(RegionSelector oldSelector) {
this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());
if (oldSelector instanceof EllipsoidRegionSelector) {
final EllipsoidRegionSelector ellipsoidRegionSelector = (EllipsoidRegionSelector) oldSelector;
region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion());
} else {
Region oldRegion;
try {
oldRegion = oldSelector.getRegion();
} catch (IncompleteRegionException e) {
return;
}
BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector();
BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector();
Vector center = pos1.add(pos2).divide(2).floor();
region.setCenter(center);
region.setRadius(pos2.subtract(center));
}
}
示例3: CylinderRegionSelector
import com.sk89q.worldedit.regions.RegionSelector; //导入方法依赖的package包/类
/**
* Create a new selector from the given one.
*
* @param oldSelector the old selector
*/
public CylinderRegionSelector(RegionSelector oldSelector) {
this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());
if (oldSelector instanceof CylinderRegionSelector) {
final CylinderRegionSelector cylSelector = (CylinderRegionSelector) oldSelector;
region = new CylinderRegion(cylSelector.region);
} else {
final Region oldRegion;
try {
oldRegion = oldSelector.getRegion();
} catch (IncompleteRegionException e) {
return;
}
Vector pos1 = oldRegion.getMinimumPoint();
Vector pos2 = oldRegion.getMaximumPoint();
Vector center = pos1.add(pos2).divide(2).floor();
region.setCenter(center.toVector2D());
region.setRadius(pos2.toVector2D().subtract(center.toVector2D()));
region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY()));
region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY()));
}
}
示例4: ConvexPolyhedralRegionSelector
import com.sk89q.worldedit.regions.RegionSelector; //导入方法依赖的package包/类
/**
* Create a new selector.
*
* @param oldSelector the old selector
*/
public ConvexPolyhedralRegionSelector(RegionSelector oldSelector) {
checkNotNull(oldSelector);
if (oldSelector instanceof ConvexPolyhedralRegionSelector) {
final ConvexPolyhedralRegionSelector convexPolyhedralRegionSelector = (ConvexPolyhedralRegionSelector) oldSelector;
pos1 = convexPolyhedralRegionSelector.pos1;
region = new ConvexPolyhedralRegion(convexPolyhedralRegionSelector.region);
} else {
final Region oldRegion;
try {
oldRegion = oldSelector.getRegion();
} catch (IncompleteRegionException e) {
region = new ConvexPolyhedralRegion(oldSelector.getIncompleteRegion().getWorld());
return;
}
final int minY = oldRegion.getMinimumPoint().getBlockY();
final int maxY = oldRegion.getMaximumPoint().getBlockY();
region = new ConvexPolyhedralRegion(oldRegion.getWorld());
for (final BlockVector2D pt : new ArrayList<BlockVector2D>(oldRegion.polygonize(Integer.MAX_VALUE))) {
region.addVertex(pt.toVector(minY));
region.addVertex(pt.toVector(maxY));
}
learnChanges();
}
}
示例5: getRegion
import com.sk89q.worldedit.regions.RegionSelector; //导入方法依赖的package包/类
private Region getRegion(Player player) {
WorldEditPlugin worldEdit = getWorldEdit();
LocalWorld world = BukkitUtil.getLocalWorld(player.getWorld());
RegionSelector selector = worldEdit.getSession(player)
.getRegionSelector(world);
try {
return selector.getRegion();
} catch (IncompleteRegionException exc) {
throw new WERegionIncomplete(dac);
}
}
示例6: getSelectionAsRegion
import com.sk89q.worldedit.regions.RegionSelector; //导入方法依赖的package包/类
/**
* Get the current Selection as region
*
* @param pl Player
* @return IRegion
*/
public Region getSelectionAsRegion(Player pl) {
String pworld = pl.getWorld().getName();
Selection sel = WEP.getSelection(pl);
RegionSelector rs = sel.getRegionSelector();
try {
r = rs.getRegion();
} catch (IncompleteRegionException e) {
e.printStackTrace();
}
return r;
}