Jump to content

Confusion with GroundItems...


Recommended Posts

Posted

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. 

Posted

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);
Posted (edited)

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
Posted

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. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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