本文整理汇总了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());
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
}
示例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();
}