Sophisticated Backpacks

Sophisticated Backpacks

89M Downloads

Quark sort button deletes a lot of stacks

genderneutralnoun opened this issue ยท 12 comments

commented

Describe the bug
When using the Quark sort button on the backpack inventory, a bunch of stacks (here meaning anything in one slot) are deleted. There seems to be no rhyme or reason to it; clicking it again deletes more items. I'm using a golden green-dyed backpack.

To Reproduce
Steps to reproduce the behavior:

  1. Open backpack
  2. Click quark sort button
  3. Inventory is sorted according to Quark rules, but several stacks are deleted.

Expected behavior
I expected for the inventory to be sorted according to Quark rules and for my stacks to not be deleted.

Screenshots
Screenshot (221)
Lost a lot of items from a mining trip, but didn't screenshot before.
Screenshot (222)
After clicking the Quark button once.
Screenshot (223)
After clicking the Quark button a second time.

Versions
Using Sophisticated Backpacks version 1.16.5-3.12.0.407, and Forge 36.2.8. Quark is r2.4-321.

commented

can repro. An almost full backpack got wiped

commented

Same with me. Using the key bind for quarks sort target inventory does it as well.

commented

I would definitely recommend using backpack's sort button not the quark one to prevent issues like this with any sorter.

I will need to debug to see what Quark is doing there that it gets messed up this way.

commented

I can see why that is the case now and I have a dilemma of removing functionality to support Quark sorting in addition to sorting that's already included in the mod (inserting items into preexisting stacks or memorized stacks before empty ones would have to go at least when these are being inserted by hoppers or any modded pipes). Or the other option is to somehow prevent Quark sorting from appearing in backpack gui as it's not needed anyway, but this doesn't seem to be doable without hacks, I guess I will try one where I will prevent the quark button from being added in the screen and replace it with the same looking button which actually calls backpack logic for sorting.

You also have the issue that quark lets you use a key bind to sort the backpack, not just the GUI button.

commented

I can see why that is the case now and I have a dilemma of removing functionality to support Quark sorting in addition to sorting that's already included in the mod (inserting items into preexisting stacks or memorized stacks before empty ones would have to go at least when these are being inserted by hoppers or any modded pipes). Or the other option is to somehow prevent Quark sorting from appearing in backpack gui as it's not needed anyway, but this doesn't seem to be doable without hacks,
I guess I will try one where I will prevent the quark button from being added in the screen and replace it with the same looking button which actually calls backpack logic for sorting.

commented

right, yeah so that is even harder to work around. it would really be the best if both of these could be disabled for backpack as backpack has the functionality already

commented

I've tried to see if I can recreate the issue with Inventory Tweaks Renewed 1.16.4-1.0.1 but it seems like the issue is only present with Quark. So I've just switched the key binds to use Inventory Tweaks. It seems that both sort under curser and external inventory sort work perfectly. So maybe its a bug with quark?

commented

I wouldn't really call a bug - they expect that the stack was inserted exactly in the slot where they asked for it to be inserted but the logic in sbp inserts it where there's already preexisting stack and because they clear the slot where the stack is being inserted to just before the insert the following slots may still have contents that are supposed to be overriden by quark logic, but will cause sbp logic to insert in them if they match what is being inserted.

But it's true that if quark logic first cleared all of the slots and then inserted in the correct order this issue wouldn't happen

commented

I prefer Quark's rules for sorting, but I've found an alternative that satisfies me in Inventory Profiles, which doesn't have the same problem. I'm not a dev, but I'd suggest maybe warning players of this mod if you can't find a way to fix things on your end. Maybe I should submit the issue on Quark's end?

commented

So the only solution here is to prevent quark from adding buttons / keybinds of buttons working here. Config update with this will do the trick.

"Ignored Screens" = ["net.p3pp3rf1y.sophisticatedbackpacks.client.gui.BackpackScreen"]

Btw @genderneutralnoun what do you prefer about quark's rules for sorting? I am not aware of those, but doesn't it just sort by the name?

commented

So I actually ended up implementing a logic that will automatically replace Quark's sort button with almost identical one the only difference being that it calls SBP logic for sorting. And also added a bit of code that prevents Quark's sorting to run on backpack through its keybind.
You can actually set sorting keybind in SBP to the same key and they will work really well in tandem - SBP one is only set to work on backpack's inventory and is skipped in all the other cases and it also has a higher priority so it should run before Quark has a chance to run its logic.

commented

I just saw this and got up to make bug review... this saved my time for this morning and hoping this works, I am going make some breakfast now