Class GroundItems

java.lang.Object
privbot.hooks.GroundItems

public final class GroundItems extends Object
Ground loot query (KSBot-style). Refreshes the snapshot once per game tick while querying.
  • Method Details

    • configuredDrop

      public LootDrop configuredDrop(Predicate<LootDrop> policy, int range)
      The nearest ground stack within range tiles that policy accepts. The policy runs on the client thread inside the scan, so it should read only config and snapshots. Nothing is dispatched.
      Parameters:
      policy - which stacks count as loot
      range - Manhattan distance in tiles, capped at 104
      Returns:
      the nearest accepted stack, or null when none is in range (or this facade has no item API)
      Since:
      1.1.0
    • takeConfiguredDrop

      public LootDrop takeConfiguredDrop(Predicate<LootDrop> policy, int range)
      Scans like configuredDrop(java.util.function.Predicate<privbot.hooks.LootDrop>, int), rechecks the policy and sends a Take on the nearest accepted stack, all on the client thread. A full inventory takes only a stackable the inventory already holds. Callers confirm the inventory gain themselves.
      Parameters:
      policy - which stacks count as loot
      range - Manhattan distance in tiles, capped at 104
      Returns:
      the stack the Take was sent for, or null when nothing was sent
      Since:
      1.1.0
    • getClient

      public net.runelite.api.Client getClient()
      Returns:
      the client this facade reads
    • query

      public GroundItemQuery query()
      Returns:
      a query over the ground items in the scene, read once on the client thread
    • closest

      public PrivGroundItem closest(Predicate<PrivGroundItem> pred)
      Nearest ground item matching pred (same as query().closest(pred)).
    • closest

      public PrivGroundItem closest(String... names)
      Nearest ground item matching any supplied name, or null.
    • nearest

      public PrivGroundItem nearest(String... names)
    • exists

      public boolean exists(String... names)
      Whether a ground item matching any supplied name is currently loaded.
    • takeClosest

      public boolean takeClosest(String... names)
      Takes the closest ground item matching any supplied name.
    • take

      public boolean take(String... names)
      Takes the closest ground item matching any supplied name.
    • nearest

      public static PrivGroundItem nearest(Predicate<PrivGroundItem> pred)
      Static nearest-loot helper that needs no ctx. Named nearest because closest already belongs to the instance API.