Search in sources :

Example 11 with BlockVector

use of org.bukkit.util.BlockVector in project Glowstone by GlowstoneMC.

the class UpdateBlockEntityCodec method decode.

@Override
public UpdateBlockEntityMessage decode(ByteBuf buffer) throws IOException {
    BlockVector pos = GlowBufUtils.readBlockPosition(buffer);
    int action = buffer.readByte();
    CompoundTag nbt = GlowBufUtils.readCompound(buffer);
    return new UpdateBlockEntityMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), action, nbt);
}
Also used : UpdateBlockEntityMessage(net.glowstone.net.message.play.game.UpdateBlockEntityMessage) BlockVector(org.bukkit.util.BlockVector) CompoundTag(net.glowstone.util.nbt.CompoundTag)

Example 12 with BlockVector

use of org.bukkit.util.BlockVector in project Glowstone by GlowstoneMC.

the class UpdateSignCodec method decode.

@Override
public UpdateSignMessage decode(ByteBuf buf) throws IOException {
    BlockVector pos = GlowBufUtils.readBlockPosition(buf);
    TextMessage[] message = new TextMessage[4];
    for (int i = 0; i < message.length; ++i) {
        message[i] = GlowBufUtils.readChat(buf);
    }
    return new UpdateSignMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), message);
}
Also used : BlockVector(org.bukkit.util.BlockVector) TextMessage(net.glowstone.util.TextMessage) UpdateSignMessage(net.glowstone.net.message.play.game.UpdateSignMessage)

Example 13 with BlockVector

use of org.bukkit.util.BlockVector in project Glowstone by GlowstoneMC.

the class DiggingCodec method decode.

@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);
}
Also used : DiggingMessage(net.glowstone.net.message.play.player.DiggingMessage) BlockVector(org.bukkit.util.BlockVector)

Example 14 with BlockVector

use of org.bukkit.util.BlockVector in project Glowstone by GlowstoneMC.

the class TabCompleteCodec method encode.

@Override
public ByteBuf encode(ByteBuf buf, TabCompleteMessage message) throws IOException {
    ByteBufUtils.writeUTF8(buf, message.getText());
    buf.writeBoolean(message.isAssumeCommand());
    BlockVector location = message.getLocation();
    if (location != null) {
        buf.writeBoolean(true);
        GlowBufUtils.writeBlockPosition(buf, location);
    } else {
        buf.writeBoolean(false);
    }
    return buf;
}
Also used : BlockVector(org.bukkit.util.BlockVector)

Example 15 with BlockVector

use of org.bukkit.util.BlockVector in project Glowstone by GlowstoneMC.

the class BlockBreakAnimationCodec method decode.

@Override
public BlockBreakAnimationMessage decode(ByteBuf buf) throws IOException {
    int entityId = ByteBufUtils.readVarInt(buf);
    BlockVector vector = GlowBufUtils.readBlockPosition(buf);
    int destroyStage = buf.readByte();
    return new BlockBreakAnimationMessage(entityId, vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), destroyStage);
}
Also used : BlockVector(org.bukkit.util.BlockVector) BlockBreakAnimationMessage(net.glowstone.net.message.play.game.BlockBreakAnimationMessage)

Aggregations

BlockVector (org.bukkit.util.BlockVector)19 Vector (org.bukkit.util.Vector)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 GlowBlock (net.glowstone.block.GlowBlock)2 UseBedMessage (net.glowstone.net.message.play.player.UseBedMessage)2 TextMessage (net.glowstone.util.TextMessage)2 Location (org.bukkit.Location)2 Block (org.bukkit.block.Block)2 Message (com.flowpowered.network.Message)1 ASkyBlock (com.wasteofplastic.acidisland.ASkyBlock)1 GameType (com.wasteofplastic.acidisland.Settings.GameType)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 BlockData (net.aufdemrand.denizen.nms.interfaces.BlockData)1 Key (net.glowstone.chunk.GlowChunk.Key)1 GlowPlayer (net.glowstone.entity.GlowPlayer)1 MetadataIndex (net.glowstone.entity.meta.MetadataIndex)1 MetadataMap (net.glowstone.entity.meta.MetadataMap)1 Entry (net.glowstone.entity.meta.MetadataMap.Entry)1 SpawnPaintingMessage (net.glowstone.net.message.play.entity.SpawnPaintingMessage)1