Package com.sk89q.worldedit

Examples of com.sk89q.worldedit.BlockVector2D


            if (x == null || z == null) {
                continue;
            }

            list.add(new BlockVector2D(x, z));
        }

        return list;
    }
View Full Code Here


    }

    @Override
    public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
        if (enabled) {
            dirtyChunks.add(new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4));
            return world.setBlock(location, block, false);
        } else {
            return world.setBlock(location, block, true);
        }
    }
View Full Code Here

     * Add a point to the list.
     *
     * @param position the position
     */
    public void addPoint(Vector position) {
        points.add(new BlockVector2D(position.getBlockX(), position.getBlockZ()));
        recalculate();
    }
View Full Code Here

        final double changeX = change.getX();
        final double changeY = change.getY();
        final double changeZ = change.getZ();

        for (int i = 0; i < points.size(); ++i) {
            BlockVector2D point = points.get(i);
            points.set(i, new BlockVector2D(point.getX() + changeX, point.getZ() + changeZ));
        }

        minY += changeY;
        maxY += changeY;
View Full Code Here

    public String toString() {
        StringBuilder sb = new StringBuilder();
        List<BlockVector2D> pts = getPoints();
        Iterator<BlockVector2D> it = pts.iterator();
        while (it.hasNext()) {
            BlockVector2D current = it.next();
            sb.append("(").append(current.getBlockX()).append(", ").append(current.getBlockZ()).append(")");
            if (it.hasNext()) sb.append(" - ");
        }
        sb.append(" * (").append(minY).append(" - ").append(maxY).append(")");
        return sb.toString();
    }
View Full Code Here

    private void checkAndAddBlock(Vector pos) {
        if (editSession.getMask() != null && !editSession.getMask().test(pos))
            return;

        BlockVector2D chunkPos = ChunkStore.toChunk(pos);

        // Unidentified chunk
        if (!neededChunks.containsKey(chunkPos)) {
            neededChunks.put(chunkPos, new ArrayList<Vector>());
        }
View Full Code Here

        missingChunks = new ArrayList<Vector2D>();
        errorChunks = new ArrayList<Vector2D>();

        // Now let's start restoring!
        for (Map.Entry<BlockVector2D, ArrayList<Vector>> entry : neededChunks.entrySet()) {
            BlockVector2D chunkPos = entry.getKey();
            Chunk chunk;

            try {
                chunk = chunkStore.getChunk(chunkPos, editSession.getWorld());
                // Good, the chunk could be at least loaded
View Full Code Here

            for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
                if (!contains(new BlockVector(x, centerY, z))) {
                    continue;
                }

                chunks.add(new BlockVector2D(
                    x >> ChunkStore.CHUNK_SHIFTS,
                    z >> ChunkStore.CHUNK_SHIFTS
                ));
            }
        }
View Full Code Here

     */
    public static BlockVector2D toChunk(Vector position) {
        int chunkX = (int) Math.floor(position.getBlockX() / 16.0);
        int chunkZ = (int) Math.floor(position.getBlockZ() / 16.0);

        return new BlockVector2D(chunkX, chunkZ);
    }
View Full Code Here

        final List<BlockVector2D> points = new ArrayList<BlockVector2D>(nPoints);
        for (int i = 0; i < nPoints; ++i) {
            double angle = i * (2.0 * Math.PI) / nPoints;
            final Vector2D pos = new Vector2D(Math.cos(angle), Math.sin(angle));
            final BlockVector2D blockVector2D = pos.multiply(radius).add(center).toBlockVector2D();
            points.add(blockVector2D);
        }

        return points;
    }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.BlockVector2D

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.