Jump to content

Casting Entity to RS2Object


dungeonqueer

Recommended Posts

I'm attempting to find all Objects on my cursor that fall under a specific set of attributes.

getMouse().getEntitiesOnCursor().stream().filter(obj -> obj.exists() && obj.hasAction("Chop")).forEach(setup::manage);
 

However,

getObjects().closest(trees);

only accepts an RS2Object an not an Entity which is given by

getMouse().getEntitiesOnCursor()

 

How would I go about finding the closest Entity that I've found through using #getEntitiesOnCursor()?

Could I check for it to be an instanceof RS2Object and cast it as such?

Link to comment
Share on other sites

10 minutes ago, dungeonqueer said:

I'm attempting to find all Objects on my cursor that fall under a specific set of attributes.


getMouse().getEntitiesOnCursor().stream().filter(obj -> obj.exists() && obj.hasAction("Chop")).forEach(setup::manage);
 

However,


getObjects().closest(trees);

only accepts an RS2Object an not an Entity which is given by


getMouse().getEntitiesOnCursor()

 

How would I go about finding the closest Entity that I've found through using #getEntitiesOnCursor()?

Could I check for it to be an instanceof RS2Object and cast it as such?

 

Pretty sure you can just filter objects using getObjects().closest() and the method isOnCursor()

Sorry on phone but:

getObjects().closest(obj -> obj.hasAction("Chop") && obj.isOnCursor())

Edited by Explv
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...