Im A Baller 348 Share Posted December 29, 2016 AbstractItemContainer#getSlotForNameContaining(String name) - very useful for both banking and using inventory slots for items such as Potions(4,3,2..), Waterskins(4,3,2..), Glory(6,5,4,...), Ring of dueling(8,7,6...), and the list goes on. This method would find a slot that holds any given item whose name contains the given string. If no such item is found, it would return a -1. I'm currently just using my own ghetto implementation: public int getSlotForNameContaining(AbstractItemContainer<Item> container, String contained) { for(int i = 0; i < 28; i++) { if(container.slotNameContains(i, contained)) { return i; } } return -1; } Link to comment Share on other sites More sharing options...
Hashtag 8670 Share Posted December 29, 2016 Aren't you able to use a filter? Link to comment Share on other sites More sharing options...
Im A Baller 348 Author Share Posted December 29, 2016 Aren't you able to use a filter? Probably should have used a filter instead of the method above. Good point, though that doesn't necessarily negate the utility of this method Link to comment Share on other sites More sharing options...
Nuclear Nezz 2040 Share Posted December 29, 2016 I think what he means is Item item = getX().get(filter);item.getSlot(); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.