Tech Reborn

Tech Reborn

30M Downloads

Locking Storage Units to a certain item

Katorone opened this issue · 8 comments

commented

Is your feature request related to a problem? Please describe.
After all items in a Storage Unit have been removed, it reverts to being able to accept and store any item. Having the option to lock the Storage Unit for a certain item would make storage setups more predictable. Even more so in chained crafting setups with multiple in- and outputs.

Describe the solution you'd like
The behavior of the Auto Crafting Table is pretty intuitive, and I like to see it replicated in the Storage Unit. By adding a "lock-icon" in the interface, the player can choose whether to lock a Storage Unit for a certain item or not. Optionally, replicating the behavior of popular barrel mods, shift-right clicking the Unit to toggle the locking.

Describe alternatives you've considered
A separate routing & filtering block. Though with this added functionality to storage units, they would be able to act as both routing & filtering blocks already.

commented

Merged in #2124 , unless I'm missing something, this has be fulfilled (The suggested alternative upgrades fall under #1988 )

commented

Yep, for some reason someone else recommitted my code under their name, but it's merged. Hopefully it won't break =3

commented

It was me who merged your PR. Here is commit: c3d405e

commented

Hi @Katorone , I liked your idea and implemented a prototype of it (1.15 fabric):
https://github.com/Sturmlilie/TechReborn/tree/lockable_su

Compiled jar: [outdated]

By clicking the lock icon in the upper right, the currently stored item will be "locked in" (only works when the storage unit isn't empty); while locked, the behavior and visuals will stay the same even if the item count drops to zero.

I would be grateful for feedback!

commented

Thank you for this!
I've did a few tests with my setup, and noticed the following:

  • After clicking the lock icon and removing all contents of a Storage Unit manually, it will still auto pull other items (they don't seem to be ghost items, i can pull them out fine).
  • It seems to only pull once, if the OUT box contains the wrong item, it doesn't appear to let more of those items in.
  • Inserting the correct item manually either through the UI or in-world deletes the wrong item in the OUT box.
  • The front image does stay on the configured item, which is great!
commented

Oops, I totally forgot to consider the auto-input feature. I think it should work as you'd expect now, please give it a try: jar link

I also noticed some ghosting / apparent item duplication (only visual / client side though) when shift-clicking different items into the IN slot and back, but that bug exists independently of my code.

Thanks for playtesting!

commented

I've done the same tests as yesterday, and now your fork does exactly what's expected!
You're right about the ghosting, I've noticed them before.

Thanks again for going through the effort of coding this. I love the addition!
Now it's possible to use Storage Units as filters for machines. They'll only grab the items they can store, and provide machines with them.

commented

Glad it works =)
Although I wasn't using them as filters, I had a similar problem on my world where I had storage units hooked up to some processing chain that I would fill with manually harvested stuff, but once all contents had been processed I couldn't just right-click them to deposit my hand anymore, which was annoying.

Time to make a PR.