public static Packet readPacket(DataInputStream var0, boolean var1) throws IOException {
      Packet var3 = null;

      int var6;
      try {
         var6 = var0.read();
         if(var6 == -1) {
            return null;
         }

         if(var1 && !serverPacketIdList.contains(var6) || !var1 && !clientPacketIdList.contains(var6)) {
            throw new IOException("Bad packet id " + var6);
         }

         var3 = getNewPacket(var6);
         if(var3 == null) {
            throw new IOException("Bad packet id " + var6);
         }

         var3.readPacketData(var0);
      } catch (EOFException var5) {
         System.out.println("Reached end of stream");
         return null;
      }

      return var3;
   }