Package com.sk89q.worldedit.blocks

Examples of com.sk89q.worldedit.blocks.BaseBlock


    }

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


     */
    public void place(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException {
        for (int x = 0; x < size.getBlockX(); ++x) {
            for (int y = 0; y < size.getBlockY(); ++y) {
                for (int z = 0; z < size.getBlockZ(); ++z) {
                    final BaseBlock block = data[x][y][z];
                    if (block == null) {
                        continue;
                    }

                    if (noAir && block.isAir()) {
                        continue;
                    }

                    editSession.setBlock(new Vector(x, y, z).add(newOrigin), block);
                }
View Full Code Here

     * @throws ArrayIndexOutOfBoundsException if the position is outside the bounds of the CuboidClipboard
     * @deprecated use {@link #getBlock(Vector)} instead
     */
    @Deprecated
    public BaseBlock getPoint(Vector position) throws ArrayIndexOutOfBoundsException {
        final BaseBlock block = getBlock(position);
        if (block == null) {
            return new BaseBlock(BlockID.AIR);
        }

        return block;
    }
View Full Code Here

        int maxZ = getLength();

        for (int x = 0; x < maxX; ++x) {
            for (int y = 0; y < maxY; ++y) {
                for (int z = 0; z < maxZ; ++z) {
                    final BaseBlock block = data[x][y][z];
                    if (block == null) {
                        continue;
                    }

                    int id = block.getId();

                    if (map.containsKey(id)) {
                        map.get(id).increment();
                    } else {
                        Countable<Integer> c = new Countable<Integer>(id, 1);
View Full Code Here

        int maxZ = getLength();

        for (int x = 0; x < maxX; ++x) {
            for (int y = 0; y < maxY; ++y) {
                for (int z = 0; z < maxZ; ++z) {
                    final BaseBlock block = data[x][y][z];
                    if (block == null) {
                        continue;
                    }

                    // Strip the block from metadata that is not part of our key
                    final BaseBlock bareBlock = new BaseBlock(block.getId(), block.getData());

                    if (map.containsKey(bareBlock)) {
                        map.get(bareBlock).increment();
                    } else {
                        Countable<BaseBlock> c = new Countable<BaseBlock>(bareBlock, 1);
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;
                    BlockVector pt = new BlockVector(x, y, z);
                    BaseBlock block = new BaseBlock(blocks[index], blockData[index]);

                    if (tileEntitiesMap.containsKey(pt)) {
                        block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt)));
                    }

                    try {
                        clipboard.setBlock(region.getMinimumPoint().add(pt), block);
                    } catch (WorldEditException e) {
View Full Code Here

        BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
        if (adapter != null) {
            return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position));
        } else {
            Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
            return new BaseBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
        }
    }
View Full Code Here

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

            int index = y * width * length + z * width + x;
            BaseBlock block = clipboard.getBlock(point);

            // Save 4096 IDs in an AddBlocks section
            if (block.getType() > 255) {
                if (addBlocks == null) { // Lazily create section
                    addBlocks = new byte[(blocks.length >> 1) + 1];
                }

                addBlocks[index >> 1] = (byte) (((index & 1) == 0) ?
                        addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF
                        : addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4);
            }

            blocks[index] = (byte) block.getType();
            blockData[index] = (byte) block.getData();

            // Store TileEntity data
            CompoundTag rawTag = block.getNbtData();
            if (rawTag != null) {
                Map<String, Tag> values = new HashMap<String, Tag>();
                for (Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
                    values.put(entry.getKey(), entry.getValue());
                }

                values.put("id", new StringTag(block.getNbtId()));
                values.put("x", new IntTag(x));
                values.put("y", new IntTag(y));
                values.put("z", new IntTag(z));

                CompoundTag tileEntityTag = new CompoundTag(values);
View Full Code Here

    private int taskId = -1;

    @Override
    public final boolean setBlockType(Vector position, int type) {
        try {
            return setBlock(position, new BaseBlock(type));
        } catch (WorldEditException ignored) {
            return false;
        }
    }
View Full Code Here

    }

    @Override
    public final void setBlockData(Vector position, int data) {
        try {
            setBlock(position, new BaseBlock(getLazyBlock(position).getType(), data));
        } catch (WorldEditException ignored) {
        }
    }
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.