Package com.sk89q.worldedit.blocks

Examples of com.sk89q.worldedit.blocks.BaseBlock


    @Deprecated
    public void addAll(Set<Integer> ids) {
        if (mask instanceof BlockMask) {
            final BlockMask blockTypeMask = (BlockMask) mask;
            for (Integer id : ids) {
                blockTypeMask.add(new BaseBlock(id));
            }
        } else if (mask instanceof ExistingBlockMask) {
            final BlockMask blockMask = new BlockMask();
            for (int type : ids) {
                blockMask.add(new BaseBlock(type));
            }
            mask = blockMask;
        }
    }
View Full Code Here


        testFlip(4, 5, CuboidClipboard.FlipDirection.WEST_EAST);
    }

    private void testFlip(int data, int expectedDataAfterFlip, CuboidClipboard.FlipDirection flipDirection) {
        final CuboidClipboard clipboard = new CuboidClipboard(new Vector(1, 1, 1));
        clipboard.setBlock(Vector.ZERO, new BaseBlock(BlockID.PISTON_BASE, data));
        clipboard.flip(flipDirection);
        assertEquals(expectedDataAfterFlip, clipboard.getBlock(Vector.ZERO).getData());
    }
View Full Code Here

        for (BlockType type : BlockType.values()) {
            if (ignored.contains(type)) {
                continue;
            }

            BaseBlock orig = new BaseBlock(type.getID());
            for (int i = 1; i < 4; i++) {
                BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_90, blockRegistry);
                BaseBlock reference = new BaseBlock(orig.getType(), BlockData.rotate90(orig.getType(), orig.getData()));
                assertThat(type + "#" + type.getID() + " rotated " + (90 * i) + " degrees did not match BlockData.rotate90()'s expected result", rotated, equalTo(reference));
                orig = rotated;
            }

            orig = new BaseBlock(type.getID());
            for (int i = 0; i < 4; i++) {
                BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_NEG_90, blockRegistry);
                BaseBlock reference = new BaseBlock(orig.getType(), BlockData.rotate90Reverse(orig.getType(), orig.getData()));
                assertThat(type + "#" + type.getID() + " rotated " + (-90 * i) + " degrees did not match BlockData.rotate90Reverse()'s expected result", rotated, equalTo(reference));
                orig = rotated;
            }
        }
    }
View Full Code Here

        EditSession editSession = session.createEditSession(player);
        editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);

        try {
            editSession.setBlock(clicked.toVector(), new BaseBlock(BlockID.AIR));
        } catch (MaxChangedBlocksException e) {
            player.printError("Max blocks change limit reached.");
        } finally {
            editSession.flushQueue();
        }
View Full Code Here

            player.printError("You are not permitted to cycle the data value of that block.");
            return true;
        }

        int increment = forward ? 1 : -1;
        data = (new BaseBlock(type, data)).cycleData(increment);

        if (data < 0) {
            player.printError("That block's data cannot be cycled!");
        } else {
            world.setBlockData(clicked.toVector(), data);
View Full Code Here

    @CommandPermissions("worldedit.brush.ex")
    public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius) throws WorldEditException {
        worldEdit.checkMaxBrushRadius(radius);

        BrushTool tool = session.getBrushTool(player.getItemInHand());
        Pattern fill = new BlockPattern(new BaseBlock(0));
        tool.setFill(fill);
        tool.setSize(radius);
        tool.setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE)));
        tool.setBrush(new SphereBrush(), "worldedit.brush.ex");

        player.print(String.format("Extinguisher equipped (%.0f).", radius));
    }
View Full Code Here

        max = 1
    )
    @CommandPermissions("worldedit.tool.replacer")
    public void repl(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {

        BaseBlock targetBlock = we.getBlock(player, args.getString(0));
        session.setTool(player.getItemInHand(), new BlockReplacer(targetBlock));
        player.print("Block replacer tool bound to "
                + ItemType.toHeldName(player.getItemInHand()) + ".");
    }
View Full Code Here

            max = 2
    )
    @CommandPermissions("worldedit.tool.lrbuild")
    public void longrangebuildtool(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {

        BaseBlock secondary = we.getBlock(player, args.getString(0));
        BaseBlock primary = we.getBlock(player, args.getString(1));
        session.setTool(player.getItemInHand(), new LongRangeBuildTool(primary, secondary));
        player.print("Long-range building tool bound to " + ItemType.toHeldName(player.getItemInHand()) + ".");
        player.print("Left-click set to " + ItemType.toName(secondary.getType()) + "; right-click set to "
                + ItemType.toName(primary.getType()) + ".");
    }
View Full Code Here

        return blocks;
    }

    @Override
    public boolean test(Vector vector) {
        BaseBlock block = getExtent().getBlock(vector);
        return blocks.contains(block) || blocks.contains(new BaseBlock(block.getType(), -1));
    }
View Full Code Here

    public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
        BlockFactory blockRegistry = worldEdit.getBlockFactory();
        RandomPattern randomPattern = new RandomPattern();

        for (String token : input.split(",")) {
            BaseBlock block;

            double chance;

            // Parse special percentage syntax
            if (token.matches("[0-9]+(\\.[0-9]*)?%.*")) {
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.blocks.BaseBlock

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.