Package io.netty.buffer

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


  @Override
  public ByteBuf encode(BlockBreakAnimationMessage msg) throws IOException {
    ByteBuf buffer = Unpooled.buffer(17);
    buffer.writeInt(msg.getEntityId());
    buffer.writeInt(msg.getX());
    buffer.writeInt(msg.getY());
    buffer.writeInt(msg.getZ());
    buffer.writeByte(msg.getStage());
    return buffer;
  }
}
View Full Code Here


  public ByteBuf encode(BlockBreakAnimationMessage msg) throws IOException {
    ByteBuf buffer = Unpooled.buffer(17);
    buffer.writeInt(msg.getEntityId());
    buffer.writeInt(msg.getX());
    buffer.writeInt(msg.getY());
    buffer.writeInt(msg.getZ());
    buffer.writeByte(msg.getStage());
    return buffer;
  }
}
View Full Code Here

  @Override
  public ByteBuf encodeToClient(PlayerLoginRequestMessage message) {
    PlayerLoginRequestMessage server = message;
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeInt(server.getId());
    VanillaByteBufUtils.writeString(buffer, server.getWorldType());
    buffer.writeByte(server.getGameMode());
    buffer.writeByte(server.getDimension());
    buffer.writeByte(server.getDifficulty());
    buffer.writeByte(0);
View Full Code Here

  @Override
  public ByteBuf encodeToServer(PlayerLoginRequestMessage message) {
    PlayerLoginRequestMessage server = message;
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeInt(server.getId());
    VanillaByteBufUtils.writeString(buffer, server.getWorldType());
    buffer.writeByte(server.getGameMode());
    buffer.writeByte(server.getDimension());
    buffer.writeByte(server.getDifficulty());
    buffer.writeByte(0);
View Full Code Here

  @Override
  public ByteBuf encode(SignMessage message) throws IOException {
    String[] lines = message.getMessage();

    ByteBuf buffer = Unpooled.buffer();
    buffer.writeInt(message.getX());
    buffer.writeShort(message.getY());
    buffer.writeInt(message.getZ());
    for (String line : lines) {
      if (line == null) {
        line = "";
View Full Code Here

    String[] lines = message.getMessage();

    ByteBuf buffer = Unpooled.buffer();
    buffer.writeInt(message.getX());
    buffer.writeShort(message.getY());
    buffer.writeInt(message.getZ());
    for (String line : lines) {
      if (line == null) {
        line = "";
      }
      VanillaByteBufUtils.writeString(buffer, line);
View Full Code Here

    ByteBuf buffer = Unpooled.buffer();
    VanillaByteBufUtils.writeString(buffer, message.getItem());
    buffer.writeByte(message.isRemove() ? 1 : 0);
    if (!message.isRemove()) {
      VanillaByteBufUtils.writeString(buffer, message.getScoreboard());
      buffer.writeInt(message.getValue());
    }
    return buffer;
  }
}
View Full Code Here

  @Override
  public ByteBuf encode(PlayerUseEntityMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(9);
    buffer.writeInt(message.getEntityId());
    buffer.writeInt(message.getTarget());
    buffer.writeByte(message.isPunching() ? 1 : 0);
    return buffer;
  }
}
View Full Code Here

      }
    } finally {
      deflater.end();
    }

    buffer.writeInt(compressed);
    buffer.writeBytes(compressedDataFlat, 0, compressed);

    for (int i = 0; i < length; i++) {
      buffer.writeInt(message.getX()[i]);
      buffer.writeInt(message.getZ()[i]);
View Full Code Here

    buffer.writeInt(compressed);
    buffer.writeBytes(compressedDataFlat, 0, compressed);

    for (int i = 0; i < length; i++) {
      buffer.writeInt(message.getX()[i]);
      buffer.writeInt(message.getZ()[i]);
      buffer.writeShort(byteByteArrayToShort(message.getData()[i]));
      buffer.writeShort(booleanArrayToShort(message.hasAdditionalData()[i]));
    }
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.