Salandora / SophisticatedBackpacks

Sophisticated backpacks is yet another minecraft backpack mod this time with backpack you can place in world, color in different color combinations, upgrade with more inventory and enhance with many functional upgrades.
https://www.curseforge.com/minecraft/mc-mods/sophisticated-backpacks-unofficial-fabric-port
GNU General Public License v3.0
18 stars 7 forks source link

Advanced refill upgrade causes items to be deleted from inventory #32

Open mkern1200 opened 2 months ago

mkern1200 commented 2 months ago

Describe the bug When using an advanced refill upgrade, the player is able to use the 'pick block' button/key to move up to a stack of items from their backpack to the currently-selected hotbar slot. If there is another item in the hotbar slot already, it will try to swap the current item with the selected one, so using 'pick block' moves the item in the player's hand to the backpack and replaces it with the block that was picked.

However, there seems to be an issue where the game will attempt to move the item from the hand into the backpack even if the backpack cannot hold it. I've tested this using another backpack (without the inception upgrade), where using 'pick block' places the item picked into the hand from the worn backpack, but causes the second backpack that was already in the hand to disappear entirely (since it can't be moved into the empty slot in the worn backpack). Likewise, using 'pick block' when all slots in the backpack are full and the item in the hand cannot be placed in the backpack (such as over-filled backpack slots using a stack upgrade) causes the held item to be deleted and replaced with the picked item.

I've tested this both with and without the hotbar being full of other items, and it seems to happen consistently in both cases. This was also tested on a minimal instance using only Sophisticated Backpack and its required dependencies. (This bug doesn't occur in creative mode, as the vanilla 'pick block' function seems to override the advanced refill upgrade's function in creative.)

To Reproduce Method 1:

  1. Open a world with only Sophisticated Backpacks and its dependencies installed.
  2. Give yourself 2 backpacks and apply the advanced refill upgrade to one, then put it on.
  3. Hold the second back pack in your hand, and place items in the worn backpack with the refill upgrade.
  4. Exit your inventory and look at one of the items in your worn backpack, then use 'pick block' (with the second backpack in your hand).
  5. The picked items will be moved from the worn backpack to your hand, but the backpack that was in your hand cannot be place in the worn backpack, so it is simply deleted.

Method 2:

  1. Give yourself 1 iron or higher backpack, and apply the advanced refill upgrade and a stack upgrade (any tier).
  2. Fill all slots in the backpack with at least 65 of any item, so that every slot holds more than 1 stack of its item (they can all be the same item).
  3. Hold a different item (one that isn't in the backpack) in your hand, and use 'pick block' while looking at an item that is in the backpack.
  4. One stack of the picked item will be moved to your hand from the backpack, but the slot in the backpack will still contain more of that item. This means that the item in your hand can't be placed into the backpack, so it is simply deleted.

Expected behavior Expected that a item would not attempt to move to the backpack if the backpack can't hold that item, and would therefore not be deleted when using the 'pick block' with an advanced refill upgrade.

Versions Minecraft 1.20.1 Fabric Loader 0.15.11 Fabric API 0.92.2 Forge Config API Port 8.0.0 Sophisticated Backpacks (Unofficial Fabric Port) 3.19.5-build.104 Sophisticated Cord (Unofficial Fabric Port) 0.5.109-build.104

Salandora commented 1 month ago

Fixed in dev-feature-update