import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

public class Class576 {

   public List aList7607 = new LinkedList();
   boolean aBool7608 = false;
   int anInt7609 = 0;
   int anInt7610 = 0;


   void method12215(Class579 var1) {
      Class515_Sub1 var2 = var1.aClass515_Sub1_7618;
      boolean var3 = true;
      Class89[] var4 = var1.aClass515_Sub1_7618.aClass89Array8446;

      for(int var5 = 0; var5 < var4.length; ++var5) {
         if(var4[var5].aBool886) {
            var3 = false;
            break;
         }
      }

      if(!var3) {
         var1.aClass576_7617 = this;
         Class579 var6;
         if(this.aBool7608) {
            Iterator var8 = this.aList7607.iterator();

            while(var8.hasNext()) {
               var6 = (Class579)var8.next();
               if(var2 == var6.aClass515_Sub1_7618) {
                  var8.remove();
                  Class332.method6153(var6, -2036513170);
               }
            }
         }

         ListIterator var7 = this.aList7607.listIterator();

         do {
            if(!var7.hasNext()) {
               this.aList7607.add(var1);
               return;
            }

            var6 = (Class579)var7.next();
         } while(var2.anInt8445 * -56073021 < var6.aClass515_Sub1_7618.anInt8445 * -56073021);

         var7.previous();
         var7.add(var1);
      }
   }

   public void method12216(int var1) {
      Iterator var2 = this.aList7607.iterator();

      while(var2.hasNext()) {
         Class579 var3 = (Class579)var2.next();
         var2.remove();
         Class332.method6153(var3, -2045553651);
      }

   }

   void method12217(Class579 var1, int var2) {
      Class515_Sub1 var3 = var1.aClass515_Sub1_7618;
      boolean var4 = true;
      Class89[] var5 = var1.aClass515_Sub1_7618.aClass89Array8446;

      for(int var6 = 0; var6 < var5.length; ++var6) {
         if(var5[var6].aBool886) {
            var4 = false;
            break;
         }
      }

      if(!var4) {
         var1.aClass576_7617 = this;
         Class579 var7;
         if(this.aBool7608) {
            Iterator var8 = this.aList7607.iterator();

            while(var8.hasNext()) {
               var7 = (Class579)var8.next();
               if(var3 == var7.aClass515_Sub1_7618) {
                  var8.remove();
                  Class332.method6153(var7, -2013956980);
               }
            }
         }

         ListIterator var9 = this.aList7607.listIterator();

         do {
            if(!var9.hasNext()) {
               this.aList7607.add(var1);
               return;
            }

            var7 = (Class579)var9.next();
         } while(var3.anInt8445 * -56073021 < var7.aClass515_Sub1_7618.anInt8445 * -56073021);

         var9.previous();
         var9.add(var1);
      }
   }

   public void method12218() {
      Iterator var1 = this.aList7607.iterator();

      while(var1.hasNext()) {
         Class579 var2 = (Class579)var1.next();
         var1.remove();
         Class332.method6153(var2, -2077686086);
      }

   }

   void method12219(Class579 var1) {
      Class515_Sub1 var2 = var1.aClass515_Sub1_7618;
      boolean var3 = true;
      Class89[] var4 = var1.aClass515_Sub1_7618.aClass89Array8446;

      for(int var5 = 0; var5 < var4.length; ++var5) {
         if(var4[var5].aBool886) {
            var3 = false;
            break;
         }
      }

      if(!var3) {
         var1.aClass576_7617 = this;
         Class579 var6;
         if(this.aBool7608) {
            Iterator var8 = this.aList7607.iterator();

            while(var8.hasNext()) {
               var6 = (Class579)var8.next();
               if(var2 == var6.aClass515_Sub1_7618) {
                  var8.remove();
                  Class332.method6153(var6, -2121797702);
               }
            }
         }

         ListIterator var7 = this.aList7607.listIterator();

         do {
            if(!var7.hasNext()) {
               this.aList7607.add(var1);
               return;
            }

            var6 = (Class579)var7.next();
         } while(var2.anInt8445 * -56073021 < var6.aClass515_Sub1_7618.anInt8445 * -56073021);

         var7.previous();
         var7.add(var1);
      }
   }

   void method12220(Class579 var1) {
      Class515_Sub1 var2 = var1.aClass515_Sub1_7618;
      boolean var3 = true;
      Class89[] var4 = var1.aClass515_Sub1_7618.aClass89Array8446;

      for(int var5 = 0; var5 < var4.length; ++var5) {
         if(var4[var5].aBool886) {
            var3 = false;
            break;
         }
      }

      if(!var3) {
         var1.aClass576_7617 = this;
         Class579 var6;
         if(this.aBool7608) {
            Iterator var8 = this.aList7607.iterator();

            while(var8.hasNext()) {
               var6 = (Class579)var8.next();
               if(var2 == var6.aClass515_Sub1_7618) {
                  var8.remove();
                  Class332.method6153(var6, -2069693225);
               }
            }
         }

         ListIterator var7 = this.aList7607.listIterator();

         do {
            if(!var7.hasNext()) {
               this.aList7607.add(var1);
               return;
            }

            var6 = (Class579)var7.next();
         } while(var2.anInt8445 * -56073021 < var6.aClass515_Sub1_7618.anInt8445 * -56073021);

         var7.previous();
         var7.add(var1);
      }
   }

   Class576(boolean var1) {
      this.aBool7608 = var1;
   }

   static final void method12221(Class508 var0, int var1) {
      int var2 = var0.anIntArray6027[(var0.anInt6003 -= 98312473) * -937710807];
      var0.anIntArray6027[(var0.anInt6003 += 98312473) * -937710807 - 1] = Class500.aClass225_Sub6_5953.aClass463_Sub26_8487.method7808(var2, 103851424);
   }

   static byte[] method12222(File var0, int var1, int var2) {
      try {
         byte[] var3 = new byte[var1];
         Class225_Sub48.method14229(var0, var3, var1, (byte)-30);
         return var3;
      } catch (IOException var4) {
         return null;
      }
   }

   public static int method12223(int var0, int var1, int var2) {
      var1 = var1 * (var0 & 127) >> 7;
      if(var1 < 2) {
         var1 = 2;
      } else if(var1 > 126) {
         var1 = 126;
      }

      return var1 + (var0 & '\uff80');
   }

   static final void method12224(PacketBuffer var0, byte var1) {
      var0.method16031(471130371);
      int var2 = client.anInt7800 * 1458342211;
      Class515_Sub1_Sub4_Sub4_Sub1 var3 = Class5.aClass515_Sub1_Sub4_Sub4_Sub1_113 = client.aClass515_Sub1_Sub4_Sub4_Sub1Array7799[var2] = new Class515_Sub1_Sub4_Sub4_Sub1(client.aClass279_7807.method4917(-2045526760));
      var3.anInt10729 = -1429120305 * var2;
      int var4 = var0.readBits(30, 2062739857);
      byte var5 = (byte)(var4 >> 28);
      int var6 = var4 >> 14 & 16383;
      int var7 = var4 & 16383;
      Class548 var8 = client.aClass279_7807.method4909(-210433012);
      var3.anIntArray10770[0] = var6 - var8.anInt7419 * -843659437;
      var3.anIntArray10779[0] = var7 - var8.anInt7420 * -1518942839;
      var3.method10939((float)((var3.anIntArray10770[0] << 9) + (var3.method16638(1487101767) << 8)), var3.method10912().aClass326_4031.aFloat4037, (float)((var3.anIntArray10779[0] << 9) + (var3.method16638(-1302816047) << 8)));
      Class181.anInt2197 = (var3.aByte8443 = var3.aByte8444 = var5) * -630569699;
      if(client.aClass279_7807.method5026(-1251268989).method4600(var3.anIntArray10770[0], var3.anIntArray10779[0], 1550146108)) {
         if(var1 >= 17) {
            return;
         }

         ++var3.aByte8444;
      }

      if(Class184.aClass225_Sub23Array2208[var2] != null) {
         if(var1 >= 17) {
            return;
         }

         var3.method16788(Class184.aClass225_Sub23Array2208[var2], (byte)15);
      }

      Class184.anInt2209 = 0;
      Class184.anIntArray2204[(Class184.anInt2209 += -387227799) * -583589671 - 1] = var2;
      Class184.aByteArray2212[var2] = 0;
      Class184.anInt2211 = 0;

      for(int var9 = 1; var9 < 2048; ++var9) {
         if(var1 >= 17) {
            return;
         }

         if(var2 == var9) {
            if(var1 >= 17) {
               return;
            }
         } else {
            int var10 = var0.readBits(18, 1974841785);
            int var11 = var10 >> 16;
            int var12 = var10 >> 8 & 255;
            int var13 = var10 & 255;
            Class19 var14 = Class184.aClass19Array2206[var9] = new Class19();
            var14.anInt191 = (var13 + (var11 << 28) + (var12 << 14)) * 685335329;
            var14.anInt190 = 0;
            var14.anInt193 = 525665627;
            var14.aBool192 = false;
            var14.aBool189 = false;
            Class184.anIntArray2205[(Class184.anInt2211 += 1784806105) * 1078781289 - 1] = var9;
            Class184.aByteArray2212[var9] = 0;
         }
      }

      var0.method16033(1807437434);
   }

   public static String method12225(CharSequence var0, byte var1) {
      int var2 = var0.length();
      StringBuilder var3 = new StringBuilder(var2);

      for(int var4 = 0; var4 < var2; ++var4) {
         char var5 = var0.charAt(var4);
         if((var5 < 97 || var5 > 122) && (var5 < 65 || var5 > 90) && (var5 < 48 || var5 > 57) && 46 != var5 && var5 != 45 && var5 != 42 && var5 != 95) {
            if(32 == var5) {
               var3.append('+');
            } else {
               byte var6 = Class313.method5585(var5, (short)176);
               var3.append('%');
               int var7 = var6 >> 4 & 15;
               if(var7 >= 10) {
                  var3.append((char)(var7 + 55));
               } else {
                  var3.append((char)(48 + var7));
               }

               var7 = var6 & 15;
               if(var7 >= 10) {
                  var3.append((char)(55 + var7));
               } else {
                  var3.append((char)(48 + var7));
               }
            }
         } else {
            var3.append(var5);
         }
      }

      return var3.toString();
   }
}
