var4 = 0;
while(var22.in.position() > 0 && var4++ != 100) {
var22.in.flip();
byte var5 = var22.in.get(0);
PacketType var6;
if((var6 = PacketType.packets[var5]) == null) {
throw new IOException("Bad command: " + var5);
}
if(var22.in.remaining() < var6.length + 1) {