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);
}
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);
}
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);
}
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;
}
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);
}
Aggregations