Jump to content

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


roguehippo

Recommended Posts

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

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