-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fill all and empty all container actions #7837
Conversation
15d4dc1
to
f7feac7
Compare
Rebased the PR on main. I also switched to a different approach for the single operation amount. It now uses the amount per unit defined by the key. For fluids, this is still 1000 but if an addon registers a custom container strategy, we should respect their own operation amount in case they are base 2 or something like that. |
df5a5e1
to
103846d
Compare
what); | ||
} else if (action == InventoryAction.EMPTY_ITEM) { | ||
handleEmptyHeldItem((what, amount, mode) -> realInv.insert(realInvSlot, what, amount, mode)); | ||
what, action == InventoryAction.FILL_ALL_ITEM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You ran spotless, yes? Since this formatting is not great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did and now I reran it and I get the same output.
This pull request introduces two new actions for containers: fill all and empty all.
It also changes the default behavior of normal rightclick and leftclick of containers in terminals. The old implementation tried to insert and extract as much as possible and was only limited by the insertion/extraction limit set by the respective handlers of other mods. Basic Mekanism tanks for example only allowed 1 bucket per operation.
The new implementation follows the same approach but tries to insert/extract a bucket at most when leftclicking or rightclicking.
The new feature makes use of the shift key. If you shift-leftclick with a container on a fluid, it will try to fill the whole container. If a container doesn't allow to fill itself at once, the implementation will iterate to repeat the operation. It's limited to 10k iterations tho which is unlikely to happen.
Shift-rightclick allows the opposite and will try to empty the whole container at once.
This pull request covers some of the features requested in issue #3782
It does not implement the filling of stacked items tho.
Let me know if changes are required by submitting a review.