Package rsb.methods

Class NPCs


public class NPCs extends MethodProvider
Provides access to non-player characters.
  • Field Details

    • ALL_FILTER

      public static final Predicate<RSNPC> ALL_FILTER
      A filter that accepts all matches.
  • Method Details

    • getAll

      public RSNPC[] getAll()
      Returns an array of all loaded RSNPCs.
      Returns:
      An array of the loaded RSNPCs.
    • getAll

      public RSNPC[] getAll(Predicate<RSNPC> filter)
      Returns an array of all loaded RSNPCs that are accepted by the provided Filter
      Parameters:
      filter - Filters out unwanted matches.
      Returns:
      An array of the loaded RSNPCs.
    • getNearest

      public RSNPC getNearest(Predicate<RSNPC> filter)
      Returns the RSNPC that is nearest out of all of loaded RSPNCs accepted by the provided Filter.
      Parameters:
      filter - Filters out unwanted matches.
      Returns:
      An RSNPC object representing the nearest RSNPC accepted by the provided Filter; or null if there are no matching NPCs in the current region.
    • getNPCs

      public net.runelite.api.NPC[] getNPCs()
    • getNearest

      public RSNPC getNearest(int... ids)
      Returns the RSNPC that is nearest out of all of the RSPNCs with the provided ID(s). Can return null.
      Parameters:
      ids - Allowed NPC IDs.
      Returns:
      An RSNPC object representing the nearest RSNPC with one of the provided IDs; or null if there are no matching NPCs in the current region.
    • getNearest

      public RSNPC getNearest(String... names)
      Returns the RSNPC that is nearest out of all of the RSPNCs with the provided name(s). Can return null.
      Parameters:
      names - Allowed NPC names.
      Returns:
      An RSNPC object representing the nearest RSNPC with one of the provided names; or null if there are no matching NPCs in the current region.