Ejemplo n.º 1
0
  @Override
  public void decodeInto(ChannelHandlerContext context, ByteBuf buffer) {
    this.type = EnumSimplePacket.values()[buffer.readInt()];

    try {
      if (this.type.getDecodeClasses().length > 0) {
        this.data = NetworkUtil.decodeData(this.type.getDecodeClasses(), buffer);
      }
    } catch (Exception e) {
      System.err.println(
          "[Galacticraft] Error handling simple packet type: "
              + this.type.toString()
              + " "
              + buffer.toString());
      e.printStackTrace();
    }
  }