本文整理汇总了Java中com.sk89q.worldedit.IncompleteRegionException类的典型用法代码示例。如果您正苦于以下问题:Java IncompleteRegionException类的具体用法?Java IncompleteRegionException怎么用?Java IncompleteRegionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IncompleteRegionException类属于com.sk89q.worldedit包,在下文中一共展示了IncompleteRegionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CuboidRegionSelector
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的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.IncompleteRegionException; //导入依赖的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: pasteWithWE
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
public static void pasteWithWE(Player p, File f) throws DataException {
SpongePlayer sp = SpongeWorldEdit.inst().wrapPlayer(p);
SpongeWorld ws = SpongeWorldEdit.inst().getWorld(p.getWorld());
LocalSession session = SpongeWorldEdit.inst().getSession(p);
Closer closer = Closer.create();
try {
ClipboardFormat format = ClipboardFormat.findByAlias("schematic");
FileInputStream fis = closer.register(new FileInputStream(f));
BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
ClipboardReader reader = format.getReader(bis);
WorldData worldData = ws.getWorldData();
Clipboard clipboard = reader.read(ws.getWorldData());
session.setClipboard(new ClipboardHolder(clipboard, worldData));
ClipboardHolder holder = session.getClipboard();
Operation op = holder.createPaste(session.createEditSession(sp), ws.getWorldData()).to(session.getPlacementPosition(sp)).build();
Operations.completeLegacy(op);
} catch (IOException | MaxChangedBlocksException | EmptyClipboardException | IncompleteRegionException e) {
e.printStackTrace();
}
}
示例4: getCurrentSelection
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
public Cuboid getCurrentSelection(Player player) throws InvocationException {
LocalSession session = api.getSession(player);
LocalWorld world = session.getSelectionWorld();
try {
Region selection = session.getSelection(world);
if (selection instanceof CuboidRegion) {
CuboidRegion cubeSelection = (CuboidRegion) selection;
Vector pos1 = cubeSelection.getPos1();
Vector pos2 = cubeSelection.getPos2();
return new Cuboid(world.getName(), pos1.getBlockX(), pos2.getBlockX(), pos1.getBlockY(), pos2.getBlockY(), pos1.getBlockZ(), pos2.getBlockZ());
} else {
throw new InvocationException("You can only create portals for cuboid regions.");
}
} catch (IncompleteRegionException ex) {
if (ex.getLocalizedMessage() != null)
throw new InvocationException(ex.getLocalizedMessage());
if (ex.getMessage() != null)
throw new InvocationException(ex.getMessage());
throw new InvocationException("Incomplete region");
}
}
示例5: getRegion
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<SelectionRegion> getRegion() {
try {
return Optional.of(new EWExtendSelectionRegion(this.worldedit, this.player, this.session, this.selector, (CuboidRegion) this.selector.getRegion()));
} catch (IncompleteRegionException e) {}
return Optional.empty();
}
示例6: getSecondaryPosition
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<Vector3i> getSecondaryPosition() {
try {
return Optional.of((new EWExtendSelectionRegion(this.worldedit, this.player, this.session, this.selector, (CuboidRegion) this.selector.getRegion())).getSecondaryPosition());
} catch (IncompleteRegionException e) {
return Optional.empty();
}
}
示例7: expand
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public boolean expand(Vector3i... changes) throws RegionOperationException, NoSelectedRegionException {
try {
return (new EWSelectionRegion(this.worldedit, this.player, this.session, this.selector, this.selector.getRegion())).expand(changes);
} catch (IncompleteRegionException e) {
throw new NoSelectedRegionException(e.getMessage());
}
}
示例8: contract
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public boolean contract(Vector3i... changes) throws RegionOperationException, NoSelectedRegionException {
try {
return (new EWSelectionRegion(this.worldedit, this.player, this.session, this.selector, this.selector.getRegion())).contract(changes);
} catch (IncompleteRegionException e) {
throw new NoSelectedRegionException(e.getMessage());
}
}
示例9: shift
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public boolean shift(Vector3i change) throws NoSelectedRegionException {
try {
return (new EWSelectionRegion(this.worldedit, this.player, this.session, this.selector, this.selector.getRegion())).shift(change);
} catch (IncompleteRegionException e) {
throw new NoSelectedRegionException(e.getMessage());
}
}
示例10: getPrimaryPosition
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<Vector3i> getPrimaryPosition() {
try {
BlockVector vector = this.selector.getPrimaryPosition();
return Optional.of(Vector3i.from(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()));
} catch (IncompleteRegionException e) {
return Optional.empty();
}
}
示例11: getPositions
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public List<Vector3i> getPositions() {
try {
return (new EWSelectionRegion(this.worldedit, this.player, this.session, this.selector, this.selector.getRegion())).getPositions();
} catch (IncompleteRegionException e) {
Optional<Vector3i> vector = getPrimaryPosition();
if (vector.isPresent()) {
return Arrays.asList(vector.get());
}
return Arrays.asList();
}
}
示例12: getRegion
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<SelectionRegion> getRegion() {
try {
return Optional.of(new EWEllipsoidSelectionRegion(this.worldedit, this.player, this.session, this.selector, (EllipsoidRegion) this.selector.getRegion()));
} catch (IncompleteRegionException e) {}
return Optional.empty();
}
示例13: getRegion
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<SelectionRegion> getRegion() {
try {
if (this.selector instanceof ExtendingCuboidRegionSelector) {
return Optional.of(new EWExtendSelectionRegion(this.worldedit, this.player, this.session, this.selector, (CuboidRegion) this.selector.getRegion()));
} else if (this.selector instanceof CuboidRegionSelector) {
return Optional.of(new EWCuboidSelectionRegion(this.worldedit, this.player, this.session, this.selector, (CuboidRegion) this.selector.getRegion()));
}
} catch (IncompleteRegionException e) {}
return Optional.empty();
}
示例14: getSecondaryPosition
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<Vector3i> getSecondaryPosition() {
try {
return Optional.of((new EWCuboidSelectionRegion(this.worldedit, this.player, this.session, this.selector, (CuboidRegion) this.selector.getRegion())).getSecondaryPosition());
} catch (IncompleteRegionException e) {
return Optional.empty();
}
}
示例15: getRegion
import com.sk89q.worldedit.IncompleteRegionException; //导入依赖的package包/类
@Override
public Optional<SelectionRegion> getRegion() {
try {
return Optional.of(new EWPolygonalSelectionRegion(this.worldedit, this.player, this.session, this.selector, (Polygonal2DRegion) this.selector.getRegion()));
} catch (IncompleteRegionException e) {}
return Optional.empty();
}