Package com.sk89q.worldedit

Examples of com.sk89q.worldedit.Vector


        BiomeRegistry biomeRegistry = player.getWorld().getWorldData().getBiomeRegistry();
        Set<BaseBiome> biomes = new HashSet<BaseBiome>();
        String qualifier;

        if (args.hasFlag('t')) {
            Vector blockPosition = player.getBlockTrace(300);
            if (blockPosition == null) {
                player.printError("No block in sight!");
                return;
            }

            BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector2D());
            biomes.add(biome);

            qualifier = "at line of sight point";
        } else if (args.hasFlag('p')) {
            BaseBiome biome = player.getWorld().getBiome(player.getPosition().toVector2D());
View Full Code Here


        worldEdit.checkMaxRadius(radiusX);
        worldEdit.checkMaxRadius(radiusZ);
        worldEdit.checkMaxRadius(height);

        Vector pos = session.getPlacementPosition(player);
        int affected = editSession.makeCylinder(pos, Patterns.wrap(pattern), radiusX, radiusZ, height, !hollow);
        player.print(affected + " block(s) have been created.");
    }
View Full Code Here

        worldEdit.checkMaxRadius(radiusX);
        worldEdit.checkMaxRadius(radiusY);
        worldEdit.checkMaxRadius(radiusZ);

        Vector pos = session.getPlacementPosition(player);
        if (raised) {
            pos = pos.add(0, radiusY, 0);
        }

        int affected = editSession.makeSphere(pos, Patterns.wrap(pattern), radiusX, radiusY, radiusZ, !hollow);
        player.findFreePosition();
        player.print(affected + " block(s) have been created.");
View Full Code Here

        max = 2
    )
    @CommandPermissions("worldedit.generation.pyramid")
    @Logging(PLACEMENT)
    public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException {
        Vector pos = session.getPlacementPosition(player);
        worldEdit.checkMaxRadius(size);
        int affected = editSession.makePyramid(pos, Patterns.wrap(pattern), size, !hollow);
        player.findFreePosition();
        player.print(affected + " block(s) have been created.");
    }
View Full Code Here

                         @Switch('h') boolean hollow,
                         @Switch('r') boolean useRawCoords,
                         @Switch('o') boolean offset,
                         @Switch('c') boolean offsetCenter) throws WorldEditException {

        final Vector zero;
        Vector unit;

        if (useRawCoords) {
            zero = Vector.ZERO;
            unit = Vector.ONE;
        } else if (offset) {
            zero = session.getPlacementPosition(player);
            unit = Vector.ONE;
        } else if (offsetCenter) {
            final Vector min = region.getMinimumPoint();
            final Vector max = region.getMaximumPoint();

            zero = max.add(min).multiply(0.5);
            unit = Vector.ONE;
        } else {
            final Vector min = region.getMinimumPoint();
            final Vector max = region.getMaximumPoint();

            zero = max.add(min).multiply(0.5);
            unit = max.subtract(zero);

            if (unit.getX() == 0) unit = unit.setX(1.0);
            if (unit.getY() == 0) unit = unit.setY(1.0);
            if (unit.getZ() == 0) unit = unit.setZ(1.0);
        }
View Full Code Here

    private void placeVine(Vector basePos, Vector pos) throws MaxChangedBlocksException {
        if (pos.distance(basePos) > 4) return;
        if (editSession.getBlockType(pos) != 0) return;

        for (int i = -1; i > -3; --i) {
            Vector testPos = pos.add(0, i, 0);
            if (editSession.getBlockType(testPos) == BlockID.AIR) {
                pos = testPos;
            } else {
                break;
            }
        }

        editSession.setBlockIfAir(pos, new BaseBlock(BlockID.LEAVES));
        affected++;

        int t = random.nextInt(4);
        int h = random.nextInt(3) - 1;
        Vector p;

        BaseBlock log = new BaseBlock(BlockID.LOG);

        switch (t) {
            case 0:
View Full Code Here

        position *= scaling;

        final int index = (int) Math.floor(position);
        final double remainder = position - index;

        final Vector a = coeffA[index];
        final Vector b = coeffB[index];
        final Vector c = coeffC[index];
        final Vector d = coeffD[index];

        return a.multiply(remainder).add(b).multiply(remainder).add(c).multiply(remainder).add(d);
    }
View Full Code Here

        position *= scaling;

        final int index = (int) Math.floor(position);
        //final double remainder = position - index;

        final Vector a = coeffA[index];
        final Vector b = coeffB[index];
        final Vector c = coeffC[index];

        return a.multiply(1.5*position - 3.0*index).add(b).multiply(2.0*position).add(a.multiply(1.5*index).subtract(b).multiply(2.0*index)).add(c).multiply(scaling);
    }
View Full Code Here

                    arcLengthRecursive(indexRight, 0.0, remainderRight);
        }
    }

    private double arcLengthRecursive(int index, double remainderLeft, double remainderRight) {
        final Vector a = coeffA[index].multiply(3.0);
        final Vector b = coeffB[index].multiply(2.0);
        final Vector c = coeffC[index];

        final int nPoints = 8;

        double accum = a.multiply(remainderLeft).add(b).multiply(remainderLeft).add(c).length() / 2.0;
        for (int i = 1; i < nPoints-1; ++i) {
View Full Code Here

    }

    @Override
    public boolean setRawTypeId(int x, int y, int z, int typeId) {
        try {
            return editSession.setBlock(new Vector(x, y, z), new BaseBlock(typeId));
        } catch (MaxChangedBlocksException ex) {
            return false;
        }
    }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.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.