@Override
 public ByteBuf encode(ByteBuf buf, UpdateSignMessage message) throws IOException {
   GlowBufUtils.writeBlockPosition(buf, message.getX(), message.getY(), message.getZ());
   for (TextMessage line : message.getMessage()) {
     GlowBufUtils.writeChat(buf, line);
   }
   return buf;
 }
 @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);
 }
예제 #3
0
 public ByteBuf encode(ByteBuf buf, UpdateSignMessage message) throws IOException {
   GlowBufUtils.writeBlockPosition(buf, message.getX(), message.getY(), message.getZ());
   for (String line : message.getMessage()) {
     ByteBufUtils.writeUTF8(buf, line);
   }
   return buf;
 }
예제 #4
0
 public UpdateSignMessage decode(ByteBuf buf) throws IOException {
   BlockVector pos = GlowBufUtils.readBlockPosition(buf);
   String[] message = new String[4];
   for (int i = 0; i < message.length; ++i) {
     message[i] = ByteBufUtils.readUTF8(buf);
   }
   return new UpdateSignMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), message);
 }
예제 #5
0
 public ByteBuf encode(ByteBuf buf, SetWindowSlotMessage message) throws IOException {
   buf.writeByte(message.getId());
   buf.writeShort(message.getSlot());
   GlowBufUtils.writeSlot(buf, message.getItem());
   return buf;
 }
 @Override
 public ByteBuf encode(ByteBuf buf, UseBedMessage message) throws IOException {
   ByteBufUtils.writeVarInt(buf, message.getId());
   GlowBufUtils.writeBlockPosition(buf, message.getX(), message.getY(), message.getZ());
   return buf;
 }
 @Override
 public UseBedMessage decode(ByteBuf buf) throws IOException {
   int id = ByteBufUtils.readVarInt(buf);
   BlockVector pos = GlowBufUtils.readBlockPosition(buf);
   return new UseBedMessage(id, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
 }