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


Java Region.contains方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.regions.Region.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Region.contains方法的具体用法?Java Region.contains怎么用?Java Region.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.regions.Region的用法示例。


在下文中一共展示了Region.contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recurseHollow

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public void recurseHollow(final Region region, final BlockVector origin, final Set<BlockVector> outside) {
    //TODO Optimize - avoid vector creation
    final ArrayDeque<BlockVector> queue = new ArrayDeque<BlockVector>();
    queue.addLast(origin);

    while (!queue.isEmpty()) {
        final BlockVector current = queue.removeFirst();
        if (!BlockType.canPassThrough(this.getBlockType(current), this.getBlockData(current))) {
            continue;
        }

        if (!outside.add(current)) {
            continue;
        }

        if (!region.contains(current)) {
            continue;
        }

        for (final Vector recurseDirection : this.recurseDirections) {
            queue.addLast(current.add(recurseDirection).toBlockVector());
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:EditSession.java

示例2: getEntities

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
@Override
public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) {
    World world = getWorld();

    List<Entity> ents = world.getEntities();
    List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<com.sk89q.worldedit.entity.Entity>();
    for (Entity ent : ents) {
        if (region.contains(BukkitUtil.toVector(ent.getLocation()))) {
            addEntities(ent, entities);
        }
    }
    return entities;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:14,代码来源:BukkitWorld.java

示例3: getEntities

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
@Override
public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) {
    Level world = getLevel();
    cn.nukkit.entity.Entity[] ents = world.getEntities();
    List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<com.sk89q.worldedit.entity.Entity>();
    for (cn.nukkit.entity.Entity ent : ents) {
        if (region.contains(NukkitUtil.toVector(ent.getLocation()))) {
            entities.add(new NukkitEntity(ent));
        }
    }
    return entities;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:NukkitWorld.java

示例4: getEntities

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
@Override
public List<? extends Entity> getEntities(Region region) {
    List<Entity> filtered = new ArrayList<Entity>();
    for (Entity entity : getEntities()) {
        if (region.contains(entity.getLocation().toVector())) {
            filtered.add(entity);
        }
    }
    return Collections.unmodifiableList(filtered);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:BlockArrayClipboard.java

示例5: copy

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
/**
 * Copies blocks to the clipboard.
 *
 * @param editSession The EditSession from which to take the blocks
 * @param region      A region that further constrains which blocks to take.
 */
public void copy(EditSession editSession, Region region) {
    for (int x = 0; x < size.getBlockX(); ++x) {
        for (int y = 0; y < size.getBlockY(); ++y) {
            for (int z = 0; z < size.getBlockZ(); ++z) {
                final Vector pt = new Vector(x, y, z).add(getOrigin());
                if (region.contains(pt)) {
                    setBlock(x, y, z, editSession.getBlock(pt));
                } else {
                    setBlock(x, y, z, null);
                }
            }
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:21,代码来源:CuboidClipboard.java

示例6: moveRegion

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public int moveRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final boolean copyEntities, final boolean copyBiomes, Pattern replacement) {
    checkNotNull(region);
    checkNotNull(dir);
    checkArgument(distance >= 1, "distance >= 1 required");
    final Vector displace = dir.multiply(distance);

    final Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
    final Vector to = region.getMinimumPoint();

    Vector disAbs = displace.positive();

    if (disAbs.getBlockX() < size.getBlockX() && disAbs.getBlockY() < size.getBlockY() && disAbs.getBlockZ() < size.getBlockZ()) {
        // Buffer if overlapping
        queue.dequeue();
    }


    final ForwardExtentCopy copy = new ForwardExtentCopy(EditSession.this, region, EditSession.this, to);

    if (replacement == null) replacement = nullBlock;
    final BlockReplace remove = replacement instanceof ExistingPattern ? null : new BlockReplace(EditSession.this, replacement) {
        private MutableBlockVector mutable = new MutableBlockVector();

        @Override
        // Only copy what's necessary
        public boolean apply(Vector position) throws WorldEditException {
            mutable.mutX((position.getX() - displace.getX()));
            mutable.mutY((position.getY() - displace.getY()));
            mutable.mutZ((position.getZ() - displace.getZ()));
            if (region.contains(mutable)) {
                return false;
            }
            return super.apply(position);
        }
    };

    copy.setCopyBiomes(copyBiomes);
    copy.setCopyEntities(copyEntities);
    copy.setSourceFunction(remove);
    copy.setRepetitions(1);
    copy.setTransform(new AffineTransform().translate(dir.multiply(distance)));
    Mask sourceMask = getSourceMask();
    if (sourceMask != null) {
        new MaskTraverser(sourceMask).reset(EditSession.this);
        copy.setSourceMask(sourceMask);
        setSourceMask(null);
    }
    if (!copyAir) {
        copy.setSourceMask(new ExistingBlockMask(EditSession.this));
    }
    Operations.completeBlindly(copy);
    return this.changes = copy.getAffected();
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:54,代码来源:EditSession.java


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