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


Java Vector.mutZ方法代码示例

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


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

示例1: setBlock

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
    boolean result = false;
    Vector pos = getPos(location);
    double sx = pos.getX();
    double sy = pos.getY();
    double sz = pos.getZ();
    double ex = sx + dx;
    double ey = Math.min(maxy, sy + dy);
    double ez = sz + dz;
    for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
        for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
            for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
                result |= super.setBlock(pos, block);
            }
        }
    }
    return result;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:ScaleTransform.java

示例2: retainAll

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean retainAll(Collection<?> c) {
    boolean result = false;
    int size = size();
    int index = -1;
    Vector mVec = MutableBlockVector.get(0, 0, 0);
    for (int i = 0; i < size; i++) {
        index = set.nextSetBit(index + 1);
        int b1 = (index & 0xFF);
        int b2 = ((byte) (index >> 8)) & 0x7F;
        int b3 = ((byte) (index >> 15)) & 0xFF;
        int b4 = ((byte) (index >> 23)) & 0xFF;
        mVec.mutX(offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21));
        mVec.mutY(b1);
        mVec.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21));
        if (!c.contains(mVec)) {
            result = true;
            set.clear(index);
        }
    }
    return result;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:LocalBlockVectorSet.java

示例3: get

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
public Vector get(int index) {
    int count = 0;
    ObjectIterator<Int2ObjectMap.Entry<LocalBlockVectorSet>> iter = localSets.int2ObjectEntrySet().iterator();
    while (iter.hasNext()) {
        Int2ObjectMap.Entry<LocalBlockVectorSet> entry = iter.next();
        LocalBlockVectorSet set = entry.getValue();
        int size = set.size();
        int newSize = count + size;
        if (newSize > index) {
            int localIndex = index - count;
            Vector pos = set.getIndex(localIndex);
            if (pos != null) {
                int pair = entry.getIntKey();
                int cx = MathMan.unpairX(pair);
                int cz = MathMan.unpairY(pair);
                pos.mutX((cx << 11) + pos.getBlockX());
                pos.mutZ((cz << 11) + pos.getBlockZ());
                return pos;
            }
        }
        count += newSize;
    }
    return null;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:BlockVectorSet.java

示例4: setBiome

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
    boolean result = false;
    Vector pos = getPos(position.getBlockX(), 0, position.getBlockZ());
    double sx = pos.getX();
    double sz = pos.getZ();
    double ex = pos.getX() + dx;
    double ez = pos.getZ() + dz;
    for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
        for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
            result |= super.setBiome(pos.toVector2D(), biome);
        }
    }
    return result;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:16,代码来源:ScaleTransform.java

示例5: test

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean test(Vector v) {
    int count = 0;
    double x = v.getX();
    double y = v.getY();
    double z = v.getZ();
    v.mutX(x + 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutX(x);
        return true;
    }
    v.mutX(x - 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutX(x);
        return true;
    }
    v.mutX(x);
    v.mutZ(z + 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutZ(z);
        return true;
    }
    v.mutZ(z - 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutZ(z);
        return true;
    }
    v.mutZ(z);
    return count >= min && count <= max;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:31,代码来源:WallMask.java

示例6: getCentroid

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
private Vector getCentroid(Collection<Vector> points) {
    Vector sum = new Vector();
    for (Vector p : points) {
        sum.mutX(sum.getX() + p.getX());
        sum.mutY(sum.getY() + p.getY());
        sum.mutZ(sum.getZ() + p.getZ());
    }
    return sum.multiply(1.0 / points.size());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:SplineBrush.java

示例7: transformNbtData

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
/**
 * Transform NBT data in the given block state and return a new instance
 * if the NBT data needs to be transformed.
 *
 * @param state the existing state
 * @return a new state or the existing one
 */
private BaseBlock transformNbtData(BaseBlock state) {
    CompoundTag tag = state.getNbtData();
    if (tag != null) {
        // Handle blocks which store their rotation in NBT
        if (tag.containsKey("Rot")) {
            int rot = tag.asInt("Rot");

            Direction direction = MCDirections.fromRotation(rot);

            if (direction != null) {
                Vector applyAbsolute = transform.apply(direction.toVector());
                Vector applyOrigin = transform.apply(Vector.ZERO);
                applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
                applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
                applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());

                Direction newDirection = Direction.findClosest(applyAbsolute, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);

                if (newDirection != null) {
                    Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
                    values.put("Rot", new ByteTag((byte) MCDirections.toRotation(newDirection)));
                }
            }
        }
    }
    return state;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:35,代码来源:ExtentBlockCopy.java

示例8: allowed

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
private boolean allowed(Vector v) {
    BaseBlock block = pattern.apply(v);
    if (FaweCache.canPassThrough(block.getId(), block.getData())) {
        return false;
    }
    int x = v.getBlockX();
    int y = v.getBlockY();
    int z = v.getBlockZ();
    v.mutY(y + 1);
    if (canPassthrough(v)) {
        v.mutY(y);
        return true;
    }
    v.mutY(y - 1);
    if (canPassthrough(v)) {
        v.mutY(y);
        return true;
    }
    v.mutY(y);
    v.mutX(x + 1);
    if (canPassthrough(v)) {
        v.mutX(x);
        return true;
    }
    v.mutX(x - 1);
    if (canPassthrough(v)) {
        v.mutX(x);
        return true;
    }
    v.mutX(x);
    v.mutZ(z + 1);
    if (canPassthrough(v)) {
        v.mutZ(z);
        return true;
    }
    v.mutZ(z - 1);
    if (canPassthrough(v)) {
        v.mutZ(z);
        return true;
    }
    v.mutZ(z);
    return false;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:44,代码来源:SurfaceRandomOffsetPattern.java

示例9: test

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean test(Vector v) {
    int count = 0;
    double x = v.getX();
    double y = v.getY();
    double z = v.getZ();
    v.mutX(x + 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutX(x);
        return true;
    }
    v.mutX(x - 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutX(x);
        return true;
    }
    v.mutX(x);
    v.mutY(y + 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutY(y);
        return true;
    }
    v.mutY(y - 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutY(y);
        return true;
    }
    v.mutY(y);
    v.mutZ(z + 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutZ(z);
        return true;
    }
    v.mutZ(z - 1);
    if (mask.test(v) && ++count == min && max >= 8) {
        v.mutZ(z);
        return true;
    }
    v.mutZ(z);
    return count >= min && count <= max;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:42,代码来源:AdjacentMask.java

示例10: resume

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public Operation resume(RunContext run) throws WorldEditException {
    NodePair current;
    Node from;
    Node adjacent;
    MutableBlockVector mutable = new MutableBlockVector();
    Vector mutable2 = new Vector();
    int countAdd, countAttempt;
    IntegerTrio[] dirs = getIntDirections();

    for (int layer = 0; !queue.isEmpty(); layer++) {
        current = queue.poll();
        from = current.to;
        hashQueue.remove(from);
        if (visited.containsKey(from)) {
            continue;
        }
        mutable.mutX(from.getX());
        mutable.mutY(from.getY());
        mutable.mutZ(from.getZ());
        function.apply(mutable);
        countAdd = 0;
        countAttempt = 0;
        for (IntegerTrio direction : dirs) {
            mutable2.mutX(from.getX() + direction.x);
            mutable2.mutY(from.getY() + direction.y);
            mutable2.mutZ(from.getZ() + direction.z);
            if (isVisitable(mutable, mutable2)) {
                adjacent = new Node(mutable2.getBlockX(), mutable2.getBlockY(), mutable2.getBlockZ());
                if ((current.from == null || !adjacent.equals(current.from))) {
                    AtomicInteger adjacentCount = visited.get(adjacent);
                    if (adjacentCount == null) {
                        if (countAdd++ < maxBranch) {
                            if (!hashQueue.contains(adjacent)) {
                                if (current.depth == maxDepth) {
                                    countAttempt++;
                                } else {
                                    hashQueue.add(adjacent);
                                    queue.addFirst(new NodePair(from, adjacent, current.depth + 1));
                                }
                            } else {
                                countAttempt++;
                            }
                        } else {
                            countAttempt++;
                        }
                    } else if (adjacentCount.decrementAndGet() == 0) {
                        visited.remove(adjacent);
                    } else if (hashQueue.contains(adjacent)) {
                        countAttempt++;
                    }
                }
            }
        }
        if (countAttempt > 0) {
            visited.put(from, new AtomicInteger(countAttempt));
        }
        affected++;
    }
    return null;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:62,代码来源:DFSVisitor.java

示例11: getTransformedRegion

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
/**
 * Get the transformed region.
 *
 * @return the transformed region
 */
public Region getTransformedRegion() {
    Region region = original.getRegion();
    Vector minimum = region.getMinimumPoint();
    Vector maximum = region.getMaximumPoint();

    Transform transformAround =
            new CombinedTransform(
                    new AffineTransform().translate(original.getOrigin().multiply(-1)),
                    transform,
                    new AffineTransform().translate(original.getOrigin()));

    // new Vector(minimum.getX(), minimum.getY(), minimum.getZ())
    // new Vector(maximum.getX(), maximum.getY(), maximum.getZ())
    Vector[] corners = new Vector[]{
            minimum,
            maximum,
            new Vector(maximum.getX(), minimum.getY(), minimum.getZ()),
            new Vector(minimum.getX(), maximum.getY(), minimum.getZ()),
            new Vector(minimum.getX(), minimum.getY(), maximum.getZ()),
            new Vector(minimum.getX(), maximum.getY(), maximum.getZ()),
            new Vector(maximum.getX(), minimum.getY(), maximum.getZ()),
            new Vector(maximum.getX(), maximum.getY(), minimum.getZ())};

    for (int i = 0; i < corners.length; i++) {
        corners[i] = transformAround.apply(new Vector(corners[i]));
    }

    Vector newMinimum = corners[0];
    Vector newMaximum = corners[0];

    for (int i = 1; i < corners.length; i++) {
        newMinimum = Vector.getMinimum(newMinimum, corners[i]);
        newMaximum = Vector.getMaximum(newMaximum, corners[i]);
    }

    // After transformation, the points may not really sit on a block,
    // so we should expand the region for edge cases
    newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX())));
    newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
    newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));

    return new CuboidRegion(newMinimum, newMaximum);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:49,代码来源:FlattenedClipboardTransform.java


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