Jump to content

Confusion with GroundItems...


XenoTools

Recommended Posts

Hey everyone, I'm attempting to get all of the ground item stacks around a player. I've been going through the documentation and I'm slightly confused on how to represent an ItemStack on the ground that should be looted.

 

For example, say there's two item stacks on the ground. However I want to loot the item stack with the most items in it. I've looked at the class "GroundItemStack" but it seems to have absolutely no methods for obtaining information about the items even though the documentation say that it's a ground item container. "Represents a ground item container.

 

Next I turned to "GroundItems" and I saw it had a .get(x, y) and a .getAll() which returned a List<>. However these are not available to me, as they do not exist. The only existing methods are gRandom(iiiiiiiiii) and random(iiiiiiii). 

 

I would have also of expected the GroundItemStack class to provide information on the item stack, such as the Position. 

 

If anyone can give me a nudge I'd be very greatful. 

Link to comment
Share on other sites

Your Script instance has a field called groundItems which you can use to access the whole collection of GroundItem instances currently available to your player as well as perform some other operations. For example the operation you mentioned is available to you in the following form

groundItems.get(x, y);
Link to comment
Share on other sites

get(x, y) and getAll() should very much be available to you through the GroundItems class. As well as closest() and filter(), since the class extends API. It sounds like you're trying to access it statically, which won't work. Use it through MethodProvider

Edited by FrostBug
Link to comment
Share on other sites

get(x, y) and getAll() should very much be available to you through the GroundItems class. As well as closest() and filter(), since the class extends API. It sounds like you're trying to access it statically, which won't work. Use it through MethodProvider

 

 

 

Your Script instance has a field called groundItems which you can use to access the whole collection of GroundItem instances currently available to your player as well as perform some other operations. For example the operation you mentioned is available to you in the following form

groundItems.get(x, y);

 

 

Oh doi, my lack of sleep had me looking for global getters. Thanks for pointing it out. Really need some rest. 

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...