public static Packet createRPCPacket(NetworkManager m, RPC rpc) throws IOException {
   if (!rpc.isInitialized()) {
     if (T.t) {
       T.error("RPC not initialized!");
     }
   }
   Packet p = m.createPacketForSend();
   p.writeByte(RPCFactory.getPacketIdFor(rpc));
   p = rpc.serializeTo(p);
   return p;
 }
 public void send(int dstGuid, RPC rpc) throws IOException {
   if (dstGuid != getRemoteUserGUID()) {
     if (T.t) {
       T.debug("Rerouting package " + rpc + " to " + dstGuid);
     }
     route(dstGuid, rpc);
   } else {
     if (!rpc.isInitialized()) {
       rpc.init(
           this); // under certain conditions a rpc can be reused and sent a second time - then
       // it's the first init call that counts. Don't make it twice.
     }
     Packet p = createRPCPacket(rpc);
     if (T.t) {
       T.debug("--> Sending " + rpc + " (" + p.getPos() + " bytes) to " + getRemoteFriend());
     }
     send(p);
   }
 }