Examples of BlockVector


Examples of com.sk89q.worldedit.BlockVector

    @Override
    public BlockVector next() {
        if (!hasNext()) throw new java.util.NoSuchElementException();

        BlockVector answer = new BlockVector(nextX, nextY, nextZ);

        forwardOne();
        forward();

        return answer;
View Full Code Here

Examples of com.sk89q.worldedit.BlockVector

    public BlockVector next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }

        BlockVector current = new BlockVector(next2D.getBlockX(), nextY, next2D.getBlockZ());
        if (nextY < maxY) {
            nextY++;
        } else if (flatIterator.hasNext()) {
            next2D = flatIterator.next();
            nextY = minY;
View Full Code Here

Examples of com.sk89q.worldedit.BlockVector

  /* (non-Javadoc)
   * @see de.beimax.simplespleef.util.Cuboid#setSerializedBlocks(de.beimax.simplespleef.util.SerializableBlockData[][][])
   */
  @Override
  public void setSerializedBlocks(SerializableBlockData[][][] blockData) {
    BlockVector max = region.getMaximumPoint();
    BlockVector min = region.getMinimumPoint();

    LinkedList<Chunk> chunksChanged = new LinkedList<Chunk>();

    final int[] coords = {(min.getBlockX()<max.getBlockX()?min.getBlockX():max.getBlockX()),
        (min.getBlockY()<max.getBlockY()?min.getBlockY():max.getBlockY()),
        (min.getBlockZ()<max.getBlockZ()?min.getBlockZ():max.getBlockZ())};

    for (int x = 0; x < blockData.length; x++)
      for (int y = 0; y < blockData[0].length; y++)
        for (int z = 0; z < blockData[0][0].length; z++) {
          if (this.region.contains(coords[0] + x, coords[1] + y, coords[2] + z)) { // only restore, if within the region
View Full Code Here

Examples of com.sk89q.worldedit.BlockVector

    return new Location(this.world, coords[3], coords[4], coords[5]);
  }

  @Override
  public final int[] getMinMaxCoords() {
    BlockVector max = region.getMaximumPoint();
    BlockVector min = region.getMinimumPoint();
   
    final int[] coords = {(min.getBlockX()<max.getBlockX()?min.getBlockX():max.getBlockX()),
        (min.getBlockY()<max.getBlockY()?min.getBlockY():max.getBlockY()),
        (min.getBlockZ()<max.getBlockZ()?min.getBlockZ():max.getBlockZ()),
        (min.getBlockX()>max.getBlockX()?min.getBlockX():max.getBlockX()),
        (min.getBlockY()>max.getBlockY()?min.getBlockY():max.getBlockY()),
        (min.getBlockZ()>max.getBlockZ()?min.getBlockZ():max.getBlockZ())};
    return coords;
  }
View Full Code Here

Examples of com.sk89q.worldedit.BlockVector

      return r;
    }
   
    @Override
    public Iterator<Block> getBlocks() {
      final BlockVector min = region.getMinimumPoint(), max = region.getMaximumPoint();
      return new AABB(world, new Vector(min.getBlockX(), min.getBlockY(), min.getBlockZ()), new Vector(max.getBlockX() + 1, max.getBlockY() + 1, max.getBlockZ() + 1)).iterator();
//      final Iterator<BlockVector2D> iter = region.getPoints().iterator();
//      if (!iter.hasNext())
//        return EmptyIterator.get();
//      return new Iterator<Block>() {
//        @SuppressWarnings("null")
View Full Code Here

Examples of org.bukkit.util.BlockVector

            return;
        }

        ArrayList<Block> lakeBlocks = new ArrayList<>();
        for (int i = -1; i < 4; i++) {
            Vector center = new BlockVector(rx, ry - i, rz);
            for (int x = -radius; x <= radius; x++) {
                for (int z = -radius; z <= radius; z++) {
                    Vector position = center.clone().add(new Vector(x, 0, z));
                    if (center.distance(position) <= radius + 0.5 - i) {
                        lakeBlocks.add(world.getBlockAt(position.toLocation(world)));
                    }
                }
            }
        }
View Full Code Here

Examples of org.bukkit.util.BlockVector

        long val = buf.readLong();
        long x = (val >> 38); // signed
        long y = (val >> 26) & 0xfff; // unsigned
        // this shifting madness is used to preserve sign
        long z = (val << 38) >> 38; // signed
        return new BlockVector((double) x, y, z);
    }
View Full Code Here

Examples of org.bukkit.util.BlockVector

public final class SpawnPaintingCodec implements Codec<SpawnPaintingMessage> {
    @Override
    public SpawnPaintingMessage decode(ByteBuf buf) throws IOException {
        int id = ByteBufUtils.readVarInt(buf);
        String title = ByteBufUtils.readUTF8(buf);
        BlockVector vector = GlowBufUtils.readBlockPosition(buf);
        int facing = buf.readByte();
        return new SpawnPaintingMessage(id, title, vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), facing);
    }
View Full Code Here

Examples of org.bukkit.util.BlockVector

import java.io.IOException;

public final class BlockActionCodec implements Codec<BlockActionMessage> {
    @Override
    public BlockActionMessage decode(ByteBuf buf) throws IOException {
        BlockVector vector = GlowBufUtils.readBlockPosition(buf);
        int data1 = buf.readByte();
        int data2 = buf.readByte();
        int blockType = ByteBufUtils.readVarInt(buf);
        return new BlockActionMessage(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), data1, data2, blockType);
    }
View Full Code Here

Examples of org.bukkit.util.BlockVector

import java.io.IOException;

public final class SpawnPositionCodec implements Codec<SpawnPositionMessage> {
    @Override
    public SpawnPositionMessage decode(ByteBuf buffer) throws IOException {
        BlockVector pos = GlowBufUtils.readBlockPosition(buffer);
        return new SpawnPositionMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.