- Joined
- Dec 3, 2013
- Messages
- 7,032
- Thread Author
- #1
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
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