Tiviacz1337 / Travelers-Backpack

Unique and upgradeable backpacks with customisation, Curios API/Trinkets integration and more!
133 stars 77 forks source link

Trinkets integration causing item duplication #848

Closed LeeThorogood closed 3 months ago

LeeThorogood commented 3 months ago

Minecraft: 1.20.1 (single player) & 1.20.4 (single player) Fabric Loader: 0.14.25 & 0.15.7 Fabric API: 0.91.0 & 0.96.4

Trinkets: 3.7.2 & 3.8.1 Travelers Backpack: 9.1.9 & 9.40

Description: When using a version of Trinkets mod greater than 3.7.1 and with the Travelers Backpack config option 'trinketsIntegration' set to 'true', after transferring more than one item stack from backpack to player inventory using shift + left click(s) upon closing and then reopening the backpack inventory screen (default 'B' key) only the first item stack has been moved, all subsequent item stacks are duplicated (present in both backpack and player inventories).

Steps to reproduce:

  1. With 'trinketsIntegration' in the Travelers Backpack config set to 'false',
  2. Start Minecraft
  3. Load a single player world.
  4. Equip backpack (right click while backpack is in main hand slot).
  5. Open backpack inventory screen (default 'B' key) and add several item stacks to backpack inventory.
  6. Unequip backpack.
  7. Close Minecraft.
  8. With 'trinketsIntegration' in the Travelers Backpack config set to 'true'.
  9. Start Minecraft
  10. Load the same single player world.
  11. Equip backpack in the trinkets backpack slot.
  12. Transfer several item stacks from backpack to player inventory using Shift + Left click(s).
  13. Close and then reopen the backpack inventory screen (default 'B' key).
  14. See that only the first item stack was moved from backpack to inventory, all subsequent item stacks have been duplicated (are now present in both backpack and player inventories).

Expected Behaviour: When multiple item stacks are transferred from backpack to player inventory, and after closing, and then reopening the backpack inventory screen (default 'B' key), all of the item stacks previously transferred are absent from the backpack inventory.

Additional Details: This issue appears to be caused by recent changes to the Trinkets code base. The issue was initially reported on the Trinkets repo (see: https://github.com/emilyploszaj/trinkets/issues/298), but was determined to be a Travelers Backpack issue by the Trinkets Developer(s).

Tiviacz1337 commented 3 months ago

I'll work on fix it should be available up to one or two weeks, as for now use older trinkets version or disable integration

LeeThorogood commented 3 months ago

Wonderful! Thank you so much! 🙏😊

Tiviacz1337 commented 3 months ago

Why do you switch trinketsIntegration mid game? It's supposed to stay the same all the time

Tiviacz1337 commented 3 months ago

Trinkets 3.7.2, fabric 0.92.0 cant reproduce the issue

LeeThorogood commented 3 months ago

Why do you switch trinketsIntegration mid game? It's supposed to stay the same all the time

I saw #846 and unsure if it was related, I figured the best way to ensure the item stacks get added to the backpack was to do so without the integration, then switch over to demonstrate the duplication issue with the integration.

Trinkets 3.7.2, fabric 0.92.0 cant reproduce the issue Hmm, just to triple/quadruple check, I have just done the following:

  1. Create a new 'installation' in the Minecraft Launcher using game version 1.20.1, Fabric Loader 0.14.25, and for the 'Game Directory' I created a new empty folder.
  2. In the newly created 'Game Directory' folder I created a 'mods' subfolder.
  3. Went to Modrinth, and downloaded the following mods into that subfolder:
    • Cardinal Components 5.2.2
    • Cloth Config 11.1.118
    • Fabric API 0.91.0+1.20.1
    • Travelers Backpack 9.1.9
    • Trinkets 3.7.2
  4. Launched the 'installation' via the Minecraft Launcher.
  5. Created a new world with 'Allow Cheats' set to 'On'.
  6. Loaded the world.
  7. Switched to 'Creative Mode' using F3+F4 keyboard toggle.
  8. From the 'Creative Inventory' I grabbed the following and placed them in my hot bar:
    • Dragon Travelers Backpack
    • Iron Tier Upgrade
    • Gold Tier Upgrade
    • Diamond Tier Upgrade
    • Netherite Tier Upgrade
    • Smithing Table
    • A stack of 64 Leather
    • 9 stacks of 64 Block of Copper (placed in player inventory, not hot bar)
  9. Using the Smithing Table, 64 Leather, Dragon Travelers Backpack, and Tier upgrades, I fully upgraded the backpack.
  10. With the Dragon Travelers Backpack as the main hand I used right-click to access it's inventory. (I just remembered you could do this!)
  11. Moved each of 9 stacks of 64 Block of Copper from my player inventory to the top 9 slots (top row) of the backpack inventory.
  12. Closed the backpack inventory using 'esc' on my keyboard.

In the first hotbar slot there is now a Netherite Tier, Dragon Traveler's Backpack, with a stack of 64 Block of Copper in each of the top 9 backpack inventory slots.

  1. Save the world and close Minecraft.
  2. In the config subfolder of the 'Game Directory' open 'travelersbackpack.json5'.
  3. Edit the 'trinketsIntegration' setting from 'false' to 'true'.
  4. Save and close the json5 file.
  5. Relaunch the 'installation' via the Minecraft Launcher.
  6. Reload the same world (save) as before.
  7. Switch to 'Survival Mode' using the F3+F4 keyboard toggle.
  8. Move the Dragon Travelers Backpack from the first hot bar slot to the Trinkets backpack slot.
  9. Open the backpack inventory screen using 'B' on my keyboard.
  10. Shift + left click the first four (left-to-right) stacks of 64 Block of Copper to move them from the backpack inventory to player hot bar (last four slots).
  11. Close the backpack inventory screen using 'esc' on my keyboard.
  12. Reopen the backpack inventory screen using 'B' on my keyboard.
  13. Observe that there are 8 stacks of 64 Block of Copper in the top row of the backpack inventory (first slot is empty), as well as the 4 stacks of 64 Block of Copper in the last four slots of the hot bar.

I used the exact same version of Minecraft, Fabric Loader, and mods (including Fabric API) as my main installation. I upgraded the backpack to Netherite Tier to match what I have in my main save/world. I chose to use Block of Copper as that's what I had in my backpack when I first experienced this bug. Finally as this was a new 'installation' I couldn't turn on the trinkets integration until the config had been generated/populated.

I also repeated the above steps but using Minecraft 1.20.4, Fabric Loader 0.15.7, and mod versions:

Thanks again for taking the time to look into this issue. 👍

NolanHewitt commented 3 months ago

Can confirm this happens to me as well on 1.20.1

Tiviacz1337 commented 3 months ago

https://modrinth.com/mod/travelersbackpack/versions https://www.curseforge.com/minecraft/mc-mods/travelers-backpack-fabric/files/all?page=1&pageSize=20 Fixed for Fabric

Tiviacz1337 commented 3 months ago

https://www.curseforge.com/minecraft/mc-mods/travelers-backpack-fabric/files/all?page=1&pageSize=20 fixed

NolanHewitt commented 2 months ago

This is happening again in the new crafting section of the backpack

Tiviacz1337 commented 2 months ago

This is happening again in the new crafting section of the backpack

I'll release fix tomorrow