Package com.sk89q.craftbook.util

Examples of com.sk89q.craftbook.util.Vector


            } catch (IOException e) {
            }
        }

        CuboidCopy copy = new CuboidCopy();
        copy.origin = new Vector(x, y, z);
        copy.width = width;
        copy.height = height;
        copy.length = length;
        copy.blocks = blocks;
        copy.data = data;
View Full Code Here


        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                for (int z = 0; z < length; z++) {
                    int index = y * width * length + z * width + x;
                    Vector pt = origin.add(x, y, z);

                    if (BlockType.shouldPlaceLast(w.getId(pt))) {
                        w.setId(pt, 0);
                    }

View Full Code Here

        List<Vector> queued = new ArrayList<Vector>();

        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                for (int z = 0; z < length; z++) {
                    Vector pt = origin.add(x, y, z);
                    if (BlockType.shouldPlaceLast(w.getId(pt))) {
                        bag.setBlockID(w, pt, 0);
                    } else {
                        // Can't destroy these blocks yet
                        queued.add(pt);
View Full Code Here

     *
     * @return
     */
    public boolean shouldClear(WorldInterface w) {

        Vector v = origin.add(testOffset);
        return w.getId(v) != 0;
    }
View Full Code Here

        for (int y = height - 1; y >= 0; y--) {
            for (int x = 0; x < width; x++) {
                for (int z = 0; z < length; z++) {
                    int index = y * width * length + z * width + x;
                    if (blocks[index] != 0) {
                        testOffset = new Vector(x, y, z);
                    }
                }
            }
        }
    }
View Full Code Here

     *
     * @return
     */
    public double distance(Vector pos) {

        Vector max = origin.add(new Vector(width, height, length));
        int closestX = Math.max(origin.getBlockX(),
                Math.min(max.getBlockX(), pos.getBlockX()));
        int closestY = Math.max(origin.getBlockY(),
                Math.min(max.getBlockY(), pos.getBlockY()));
        int closestZ = Math.max(origin.getBlockZ(),
                Math.min(max.getBlockZ(), pos.getBlockZ()));
        return pos.distance(new Vector(closestX, closestY, closestZ));
    }
View Full Code Here

        if (triggerOnRising && !chip.getIn(1).is()) {
            return;
        }

        Vector blockPos = chip.getBlockPosition();

        int x = blockPos.getBlockX();
        int y = blockPos.getBlockY();
        int z = blockPos.getBlockZ();
        int minLight;

        try {
            String minLightLine = chip.getText().getLine3();
            minLight = Integer.parseInt(minLightLine);
View Full Code Here

        }

        int item = CraftBookUtil.getItem(chip.getServer().getConfiguration(), id);

        if (item > 0 && !(item >= 21 && item <= 34) && item != 36) {
            Vector pos = chip.getBlockPosition();
            int maxY = Math.min(128, pos.getBlockY() + 10);
            int x = pos.getBlockX();
            int z = pos.getBlockZ();

            for (int y = pos.getBlockY() + 1; y <= maxY; y++) {
                if (BlockType.canPassThrough(chip.getWorld().getId(x, y, z))) {
                    chip.getWorld().dropItem(x, y, z, item, quantity);
                    return;
                }
            }
View Full Code Here

    public void think(ChipState chip) {

        if (chip.getIn(1).is()) { //Only on the rising edge
            String distance = chip.getText().getLine4();
            String theMessage = chip.getText().getLine3();
            Vector pos = chip.getBlockPosition();
            for (PlayerInterface p : chip.getWorld().getPlayerList()) {
                if (p.getPosition().distance(pos) <= (double) Float.parseFloat(distance))
                    p.sendMessage(theMessage);
            }
        }
View Full Code Here

        int item = CraftBookUtil.getItem(chip.getServer().getConfiguration(), id);

        if ((item > 0 || isForced) && !(item >= 21 && item <= 34)
                && item != 36) {
            Vector pos = chip.getBlockPosition();
            int y = pos.getBlockY() + 2;
            int x = pos.getBlockX();
            int z = pos.getBlockZ();

            if (y <= 127 && (isForced || chip.getWorld().getId(x, y, z) == 0)) {
                chip.getWorld().setId(x, y, z, item);
                chip.getOut(1).set(true);
            } else {
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.util.Vector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.