for ( int id : instance().newVillagerIds ) {
      if ( instance().spawnConditionHandlers.get( id ) != null ){
          if( instance().spawnConditionHandlers.get( id ).typeIsValidForVillager( villager, rand ) ){
              validVillagerIds.add( id );
          }
      }
    }

I think that is what you meant