Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!
RuneMate will permanently shut down on August 7, 2026
due to events outside our control. You can continue using RuneMate until this date after which it will no longer be available. Thank you to everyone that contributed to RuneMate's success and to the community for the opportunity to serve you all these years.

  • Learn about RuneMate Vault and how its zero knowledge local encryption already protects your sensitive information.
  • Edit or delete your RuneMate account from your Account Settings.
  • All account upgrade subscriptions have been cancelled. No action required.

Resolved Getting an Array of GameObjects

Joined
Jul 8, 2016
Messages
1
Sorry i'm pretty new to Java and i'm working on my first bot if someone could explain to me how i could get an array of nearby GameObjects so i can possibly sort them by how close they are and the by the GameObjects animation ID that would be awesome! :D
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,416
Sorry i'm pretty new to Java and i'm working on my first bot if someone could explain to me how i could get an array of nearby GameObjects so i can possibly sort them by how close they are and the by the GameObjects animation ID that would be awesome! :D

in probably the simplest form:

GameObject[] array = GameObjects.getLoaded().toArray();

There are also methods in each of the interactable classes so you don't really have to sort them yourself. Check out the jdocs.
 
Last edited:
Client Developer
Joined
Oct 12, 2015
Messages
3,817
in probably the simplest form:

GameObject[] array = GameObjects.getLoaded().toArray();

Code:
GameObjects.newQuery().filter(new Predicate(){
      private boolean test(GameObject o){
            return o.getAnimationId() == your animation id;
      }
}).results().sortByDistance();
 
Joined
Sep 30, 2015
Messages
86
You can also use LocatableEntityQueryResults

Code:
LocatableEntityQueryResults results = GameObjects.newQuery().results();
 
Top