ItemSwapper
ItemSwapper copied to clipboard
Config Option: Treat shulker boxes as templates
Motivation
One common method of using shulker boxes is to place a stack of each item you want in the box that you want to have inside. When you use the items, you take all but one item from the box, thus preserving which items were placed in the box and in what order. This makes refilling the box both manually and automatically (with hopper) much easier and neater.
Idea
This mod should offer a configuration option to enable a "template" mode for shulker boxes. That means that when switching items out of boxes, one item of that type will be left in the box. When you put that item away via switching, it should always prioritize the templated slot in the box.
Potential Issues
- If the player has a slot for dirt in a box, as an example, they'll have it marked with one dirt block in the box. What should happen when the player is holding a stack of dirt and switches it away? What should happen when you try to switch away a block and there's no room in a box for it?
- Do we distinguish one item being left in a box, thus not being able to switch to it because that would break the template, and no items found at all?
- How do we handle two stacks of partially filled blocks?
Alternatively, if you allow shulkerboxes to contain stacks of 0 items the problem goes away. A stack of 0 items would get priority over normal inventory/shulkerbox slots when putting the items back. You could even go as far as disabling hoppers overwriting the 0 item stacks. I guess shift-clicking would also ignore 0 stacks. And the obvious way to remove a 0 item stack would be right-clicking the slots with an empty hand or other item.
Maybe 0 stacks are too drastic of a modded change, though, and it would be better as a different mod.
I agree, compatibility with a shulker box slot locking mod seems like it would work too.