gr8pefish / IronBackpacks

A Minecraft mod that adds portable storage in the form of tiered backpacks with modular upgrades.
GNU General Public License v3.0
60 stars 33 forks source link

Duplication/Deletion bug with Inventory Sorter #255

Open Ben-IQ opened 5 years ago

Ben-IQ commented 5 years ago

Foreword:

Similar issue to #133 but not the same, that seemed to be an issue with nested backpacks, this is not.

Issue appeared in a custom modpack, however testing was done in a fresh install with only the two mods.

Issue Description:

Backpack is removing/duplicating items when the inventory is sorted while it is open.

What happens:

The backpack functions normally if opened with right click from the hotbar. If opened using the keybind from the inventory however, items placed or removed inside the backpack will be reverted upon reopening the backpack if the main inventory is sorted before closing the backpack. Video: https://streamable.com/wv2js

What you expected to happen:

Items placed/removed to be remembered regardless of sorting.

My Theory

I think what's happening is that Iron Backpacks copies the content of a backpack to an interface. Upon closing the interface changes are saved to the backpack that was opened. I'm guessing Inventory Sorter is creating a new instance of the backpack when it is sorted and removing the old one. This means that when the backpack is closed the changes are not saved to this new instance and therefore it is reverted to it's previous state when reopened.

Steps to reproduce (important):

  1. Make sure backpack is in inventory
  2. Open backpack with keybind
  3. Add or remove an item from the backpack
  4. Sort your main inventory with middle click while the backpack is still open
  5. Close the backpack (with esc) then reopen it with the keybind and your changes will be reverted (i.e. duplication or deletion)

    Affected Versions (Do not use "latest"):