Package io.netty.buffer

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


  public ByteBuf encode(ChunkDataMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer();

    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);
View Full Code Here


  }

  @Override
  public ByteBuf encode(WindowEnchantItemMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(2);
    buffer.writeByte(message.getTransaction());
    buffer.writeByte(message.getEnchantment());
    return buffer;
  }
}
View Full Code Here

  @Override
  public ByteBuf encode(WindowEnchantItemMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(2);
    buffer.writeByte(message.getTransaction());
    buffer.writeByte(message.getEnchantment());
    return buffer;
  }
}
View Full Code Here

    buffer.writeDouble(message.getY());
    buffer.writeDouble(message.getStance());
    buffer.writeDouble(message.getZ());
    buffer.writeFloat(-message.getYaw());
    buffer.writeFloat(message.getPitch());
    buffer.writeByte(message.isOnGround() ? 1 : 0);
    return buffer;
  }
}
View Full Code Here

  }

  @Override
  public ByteBuf encode(WindowOpenMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeByte(message.getWindowInstanceId());
    buffer.writeByte(message.getType().getId());
    VanillaByteBufUtils.writeString(buffer, message.getTitle());
    buffer.writeByte(message.getSlots());
    buffer.writeByte(message.isUsingTitle() ? 1 : 0);
    return buffer;
View Full Code Here

  @Override
  public ByteBuf encode(WindowOpenMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeByte(message.getWindowInstanceId());
    buffer.writeByte(message.getType().getId());
    VanillaByteBufUtils.writeString(buffer, message.getTitle());
    buffer.writeByte(message.getSlots());
    buffer.writeByte(message.isUsingTitle() ? 1 : 0);
    return buffer;
  }
View Full Code Here

  public ByteBuf encode(WindowOpenMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeByte(message.getWindowInstanceId());
    buffer.writeByte(message.getType().getId());
    VanillaByteBufUtils.writeString(buffer, message.getTitle());
    buffer.writeByte(message.getSlots());
    buffer.writeByte(message.isUsingTitle() ? 1 : 0);
    return buffer;
  }
}
View Full Code Here

  @Override
  public ByteBuf encode(PlayerListMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer();
    VanillaByteBufUtils.writeString(buffer, message.getPlayerName());
    buffer.writeByte(message.playerIsOnline() ? 1 : 0);
    buffer.writeShort(message.getPing());
    return buffer;
  }
}
View Full Code Here

  public ByteBuf encode(BlockActionMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(14);
    buffer.writeInt(message.getX());
    buffer.writeShort(message.getY());
    buffer.writeInt(message.getZ());
    buffer.writeByte(message.getFirstByte());
    buffer.writeByte(message.getSecondByte());
    buffer.writeShort(message.getBlockId());
    return buffer;
  }
}
View Full Code Here

  @Override
  public ByteBuf encode(EntityObjectMessage message) throws IOException {
    ByteBuf buffer = Unpooled.buffer(message.getThrowerId() > 0 ? 29 : 23);
    buffer.writeInt(message.getEntityId());
    buffer.writeByte(message.getType());
    buffer.writeInt(message.getX());
    buffer.writeInt(message.getY());
    buffer.writeInt(message.getZ());
    buffer.writeByte(message.getYaw());
    buffer.writeByte(message.getPitch());
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.