Package com.sk89q.worldedit

Examples of com.sk89q.worldedit.Vector


    }

    @Test
    public void testSetY() throws Exception {
        World world = mock(World.class);
        Location location1 = new Location(world, new Vector());
        Location location2 = location1.setY(TEST_VALUE);
        assertEquals(0, location1.getY(), EPSILON);
        assertEquals(0, location2.getX(), EPSILON);
        assertEquals(TEST_VALUE, location2.getY(), EPSILON);
        assertEquals(0, location2.getZ(), EPSILON);
View Full Code Here


    }

    @Test
    public void testGetZ() throws Exception {
        World world = mock(World.class);
        Location location = new Location(world, new Vector(0, 0, TEST_VALUE));
        assertEquals(TEST_VALUE, location.getZ(), EPSILON);
    }
View Full Code Here

    }

    @Test
    public void testGetBlockZ() throws Exception {
        World world = mock(World.class);
        Location location = new Location(world, new Vector(0, 0, TEST_VALUE));
        assertEquals(TEST_VALUE, location.getBlockZ());
    }
View Full Code Here

    }

    @Test
    public void testSetZ() throws Exception {
        World world = mock(World.class);
        Location location1 = new Location(world, new Vector());
        Location location2 = location1.setZ(TEST_VALUE);
        assertEquals(0, location1.getZ(), EPSILON);
        assertEquals(0, location2.getX(), EPSILON);
        assertEquals(0, location2.getY(), EPSILON);
        assertEquals(TEST_VALUE, location2.getZ(), EPSILON);
View Full Code Here

     * @param listTag the list tag
     * @return a vector
     */
    public static Vector toVector(ListTag listTag) {
        checkNotNull(listTag);
        return new Vector(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2));
    }
View Full Code Here

                              @Text String expression,
                              @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

    @CommandPermissions("worldedit.brush.clipboard")
    public void clipboardBrush(Player player, LocalSession session, EditSession editSession, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin) throws WorldEditException {
        ClipboardHolder holder = session.getClipboard();
        Clipboard clipboard = holder.getClipboard();

        Vector size = clipboard.getDimensions();

        worldEdit.checkMaxBrushRadius(size.getBlockX());
        worldEdit.checkMaxBrushRadius(size.getBlockY());
        worldEdit.checkMaxBrushRadius(size.getBlockZ());

        BrushTool tool = session.getBrushTool(player.getItemInHand());
        tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard");

        player.print("Clipboard brush shape equipped.");
View Full Code Here

        ClipboardHolder holder = session.getClipboard();
        Clipboard clipboard = holder.getClipboard();
        Region region = clipboard.getRegion();

        Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
        Operation operation = holder
                .createPaste(editSession, editSession.getWorld().getWorldData())
                .to(to)
                .ignoreAirBlocks(ignoreAirBlocks)
                .build();
        Operations.completeLegacy(operation);

        if (selectPasted) {
            Vector max = to.add(region.getMaximumPoint().subtract(region.getMinimumPoint()));
            RegionSelector selector = new CuboidRegionSelector(player.getWorld(), to, max);
            session.setRegionSelector(player.getWorld(), selector);
            selector.learnChanges();
            selector.explainRegionAdjust(player, session);
        }
View Full Code Here

     *
     * @param oldSelector the old selector
     */
    public SphereRegionSelector(RegionSelector oldSelector) {
        super(oldSelector);
        final Vector radius = region.getRadius();
        final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
        region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar));
    }
View Full Code Here

     * @param world the world
     * @param center the center position
     * @param radius the radius
     */
    public SphereRegionSelector(@Nullable World world, Vector center, int radius) {
        super(world, center, new Vector(radius, radius, radius));
    }
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.