Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.writeShort()


  @Override
  public ByteBuf encode(WindowTransactionMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(4);
    buffer.writeByte(message.getWindowInstanceId());
    buffer.writeShort(message.getTransaction());
    buffer.writeByte(message.isAccepted() ? 1 : 0);
    return buffer;
  }
}
View Full Code Here


  @Override
  public ByteBuf encode(PlayerHealthMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(11);
    buffer.writeFloat(message.getHealth());
    buffer.writeShort(message.getFood());
    buffer.writeFloat(message.getFoodSaturation());
    return buffer;
  }
}
View Full Code Here

  }

  @Override
  public ByteBuf encode(WindowCreativeActionMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeShort(message.getSlot());
    VanillaByteBufUtils.writeItemStack(buffer, message.get());
    return buffer;
  }
}
View Full Code Here

    buffer.writeInt(message.getX());
    buffer.writeInt(message.getY());
    buffer.writeInt(message.getZ());
    buffer.writeByte(message.getYaw());
    buffer.writeByte(message.getPitch());
    buffer.writeShort(message.getId());
    VanillaByteBufUtils.writeParameters(buffer, message.getParameters());
    return buffer;
  }
}
View Full Code Here

  @Override
  public ByteBuf encode(WindowItemsMessage message) throws IOException {
    ItemStack[] items = message.getItems();
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeByte(message.getWindowInstanceId());
    buffer.writeShort(items.length);
    for (ItemStack item : items) {
      VanillaByteBufUtils.writeItemStack(buffer, item);
    }
    return buffer;
  }
View Full Code Here

  @Override
  public ByteBuf encode(PlayerExperienceMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(8);
    buffer.writeFloat(message.getBarValue());
    buffer.writeShort(message.getLevel());
    buffer.writeShort(message.getTotalExp());
    return buffer;
  }
}
View Full Code Here

    buffer.writeInt(message.getX());
    buffer.writeInt(message.getZ());
    buffer.writeByte(message.isContiguous() ? 1 : 0);
    if (message.shouldUnload()) {
      buffer.writeShort(0);
      buffer.writeShort(0);
      buffer.writeInt(UNLOAD_COMPRESSED.length);
      buffer.writeBytes(UNLOAD_COMPRESSED);
      return buffer;
    }
View Full Code Here

  @Override
  public ByteBuf encode(PlayerExperienceMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(8);
    buffer.writeFloat(message.getBarValue());
    buffer.writeShort(message.getLevel());
    buffer.writeShort(message.getTotalExp());
    return buffer;
  }
}
View Full Code Here

    buffer.writeInt(message.getX());
    buffer.writeInt(message.getZ());
    buffer.writeByte(message.isContiguous() ? 1 : 0);
    if (message.shouldUnload()) {
      buffer.writeShort(0);
      buffer.writeShort(0);
      buffer.writeInt(UNLOAD_COMPRESSED.length);
      buffer.writeBytes(UNLOAD_COMPRESSED);
      return buffer;
    }
    short sectionsSentBitmap = 0;
View Full Code Here

  @Override
  public ByteBuf encode(EncryptionKeyRequestMessage message) {
    ByteBuf buffer = Unpooled.buffer();
    VanillaByteBufUtils.writeString(buffer, message.getSessionId());
    byte[] publicKey = message.getSecretArray();
    buffer.writeShort((short) publicKey.length);
    buffer.writeBytes(publicKey);
    buffer.writeShort((short) message.getVerifyTokenArray().length);
    buffer.writeBytes(message.getVerifyTokenArray());
    return buffer;
  }
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.