public void write(ByteBuf buf) {
      buf.writeLong(this.id.getMostSignificantBits());
      buf.writeLong(this.id.getLeastSignificantBits());

      // rip in organize
      for (Object o : this.values) {
        switch (o.getClass().getSimpleName()) {
          case "String":
            Codec.writeString(buf, (String) o);
            break;

          case "Integer":
            Codec.writeVarInt32(buf, (Integer) o);
            break;

          case "Boolean":
            buf.writeBoolean((Boolean) o);
            break;

          default:
            // ignore bad developers
            break;
        }
      }
    }
  @Override
  public void encode(ByteBuf buf) {
    Codec.writeVarInt32(buf, this.action);
    Codec.writeVarInt32(buf, this.playerListData.length);

    for (PlayerListDataBuilder data : this.playerListData) {
      data.write(buf);
    }
  }
  @Override
  public void encode(ByteBuf buf) {
    Codec.writeVarInt32(buf, this.entityId);

    buf.writeInt((int) this.location.getX() * 32);
    buf.writeInt((int) this.location.getY() * 32);
    buf.writeInt((int) this.location.getZ() * 32);

    buf.writeShort((int) this.count);
  }
Ejemplo n.º 4
0
  @Override
  public void encode(ByteBuf buf) {
    buf.writeInt(this.particleId);
    buf.writeBoolean(this.distance);

    buf.writeFloat((float) this.loc.getX());
    buf.writeFloat((float) this.loc.getY());
    buf.writeFloat((float) this.loc.getZ());

    buf.writeFloat((float) this.offset.getX());
    buf.writeFloat((float) this.offset.getY());
    buf.writeFloat((float) this.offset.getZ());

    buf.writeFloat(this.particleData);
    buf.writeInt(this.data.length);

    for (int i : this.data) {
      Codec.writeVarInt32(buf, i);
    }
  }
 @Override
 public void encode(ByteBuf buf) {
   Codec.writeVarInt32(buf, TridentServer.instance().compressionThreshold());
 }
 @Override
 public void encode(ByteBuf buf) {
   Codec.writeString(buf, this.jsonMessage);
 }
 @Override
 public void encode(ByteBuf buf) {
   buf.writeFloat(this.health);
   Codec.writeVarInt32(buf, this.food);
   buf.writeFloat(this.foodSaturation);
 }
 @Override
 public void encode(ByteBuf buf) {
   Codec.writeString(buf, this.reason);
 }