Jump to content

is it possible to get a List of all the inventory slots that contain "item"


Recommended Posts

Posted

thanks, sorry i guess i looked over the fact that i can just check if they are the item i want if i have a list of all items.

 

as in the item indices?

 

could do something like

int[] slots = IntStream.range(0, getInventory().getCapacity()).filter(i -> getInventory().getItemInSlot(i) != null && "ItemName".equals(getInventory().getItemInSlot(i).getName())).toArray();

i feel like this would be exactly what i need but since i am still a bit unfamiliar with streams and how they work i would probably not be able to utilize it correctly. thank you for the constant help with almost all of my posts frostbug you are awesome :D

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