Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Implemented SlotAction.isAvailable()

Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
We need a method to return whether the slot item is available. For example if we don't have any logs in the inventory and the slot contains logs it'll return false.

Here's a use case: In my woodcutter i'm using the action bar to drop logs. I'm not storing the name of the type of logs i've cut so i'm searching for a SlotAction who's name in lowercase contains 'logs'. All is well and good up to that point, but then if you have logs in the actionbar slot and you've been cutting oak logs it'll try and use the logs slot button which obviously isn't going to work.

This can be achieved by checking the color of the text. If it's 255,255,255 the item is available.
I tried implementing this myself by using SlotAction.getSlot().getComponent().getTextColor().equals(new Color(255,255,255))
But in doing so i found that you're using the component that doesn't contain the actions, so it doesn't work.

@Cloud @Arbiter
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Okay so I'm planning on adjusting SlotAction#isReady to account for this too, but should there be a seperate method for it? Something such as SlotAction#isActivatable? Or maybe rename isReady to isActivatable and make it handle all of that?
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Okay so I'm planning on adjusting SlotAction#isReady to account for this too, but should there be a seperate method for it? Something such as SlotAction#isActivatable? Or maybe rename isReady to isActivatable and make it handle all of that?
I like isReady(), it's shorter :)
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Can someone please verify that the current ActionSlot#isReady works for this situation?
 
Top