Package org.bukkit.util

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


        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

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

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

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

import java.io.IOException;

public final class BlockChangeCodec implements Codec<BlockChangeMessage> {
    @Override
    public BlockChangeMessage decode(ByteBuf buffer) throws IOException {
        BlockVector pos = GlowBufUtils.readBlockPosition(buffer);
        int type = ByteBufUtils.readVarInt(buffer);
        return new BlockChangeMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), type);
    }
View Full Code Here

    @Override
    public TabCompleteMessage decode(ByteBuf buf) throws IOException {
        String text = ByteBufUtils.readUTF8(buf);

        boolean hasLocation = buf.readBoolean();
        BlockVector location = null;
        if (hasLocation) {
            location = GlowBufUtils.readBlockPosition(buf);
        }
        return new TabCompleteMessage(text, location);
    }
View Full Code Here

    }

    @Override
    public ByteBuf encode(ByteBuf buf, TabCompleteMessage message) throws IOException {
        ByteBufUtils.writeUTF8(buf, message.getText());
        final BlockVector location = message.getLocation();
        if (location != null) {
            buf.writeBoolean(true);
            GlowBufUtils.writeBlockPosition(buf, location);
        } else {
            buf.writeBoolean(false);
View Full Code Here

public final class DiggingCodec implements Codec<DiggingMessage> {
    @Override
    public DiggingMessage decode(ByteBuf buf) throws IOException {
        int state = buf.readByte();
        BlockVector pos = GlowBufUtils.readBlockPosition(buf);
        int face = buf.readByte();
        return new DiggingMessage(state, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), face);
    }
View Full Code Here

            Map<BlockVector, BlockChangeMessage> map = chunks.get(key);
            if (map == null) {
                map = new HashMap<>();
                chunks.put(key, map);
            }
            map.put(new BlockVector(message.getX(), message.getY(), message.getZ()), message);
        }

        // send away
        for (Map.Entry<GlowChunk.Key, Map<BlockVector, BlockChangeMessage>> entry : chunks.entrySet()) {
            GlowChunk.Key key = entry.getKey();
View Full Code Here

TOP

Related Classes of org.bukkit.util.BlockVector

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.