当前位置: 首页>>代码示例>>Java>>正文


Java RegionSelector.getRegion方法代码示例

本文整理汇总了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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:28,代码来源:CuboidRegionSelector.java

示例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));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:28,代码来源:EllipsoidRegionSelector.java

示例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()));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:CylinderRegionSelector.java

示例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();
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:36,代码来源:ConvexPolyhedralRegionSelector.java

示例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);
    }
}
 
开发者ID:Loscillo,项目名称:DACv2-temp,代码行数:12,代码来源:SetWECommands.java

示例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;
}
 
开发者ID:Relicum,项目名称:SuperSkyBros,代码行数:24,代码来源:WorldEditManager.java


注:本文中的com.sk89q.worldedit.regions.RegionSelector.getRegion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。