[1.19.2 Forge Bug]: Functional storage/Sophisticated storage double left-clicking
GrigorGera opened this issue · 4 comments
■ Your Discord ID or other contacts
ryustar
■ Dragon Survival version and Modpack version (if have)
DragonSurvival-1.19.2-23.11.2023 + functionalstorage-1.19.2-1.1.9 + sophisticatedstorage-1.19.2-0.8.48.632
■ Single game or server?
Single (Default)
■ Do you delete old configs before writing a bug report?
I always delete configs
■ Bug Description and Reproduce
When you have an axe in your axe claw slot, left-clicking on any drawer from "functional storage" mod or any limited barrel from "sophisticated storage" mod will give you two items instead of one. When you don't have an axe in your axe claw slot everything works as intended for the human player.
■ Expected behavior
I expected left-clicking to give me just one item.
■ Crash Report File and Logs
No response
I can confirm that this bug is present. When using the axe directly it does not affect it. This affects ONLY the axe slot. The other claw slots are not affected in any way
https://github.com/DragonSurvivalTeam/DragonSurvival/assets/43911230/452d3494-e763-4601-81b1-793f461d34f6
cannot reproduce with just dragonsurvival and sophisticated storage (limited barrel)
dont know how refined storage works
does this also happen if you hit the storage with axe in hand (even as human)
We encountered the issue with Storage Drawers too, in 1.20.1, it also happens the same way with an axe for regular drawers, and with a pickaxe for Compacting Drawers (a stone-type block).
Having only the axe equipped affects only the wooden drawers. Having only the pickaxe equipped affects only the compacting drawer. Having both equipped affects both. Having neither in the Dragon Tool slots makes it work as intended.
My suspicion is that the drawer receives two inputs, one from the left-click, and another from the appropriate tool activating.
I think I managed to pinpoint the root cause. (This is for ver 1.20.1) Storage Drawers (and, I assume, other mods like Functional Storage) run into the same issue whenever the currently held item changes while left click is held down.
Repro steps for the general case:
- Left click a Storage Drawer (or any such container)
- While holding LMB, change your held item somehow, examples:
- Press F to swap a different item from your shield slot to your main hand slot
- Scroll to a different hotbar slot with a different item
- Pick up an item from the ground so that it goes into your currently empty hand slot
I believe the immediate culprit in this mod is startSwap
that gets injected into continueDestroyBlock
. From my understanding, this effectively swaps the held item while the block is being destroyed. This aligns with the observation that, in other cases, swapping the held item in other ways as listed above causes another item to be retrieved every time.
Further observations:
- Clicking quickly enough so that
continueDestroyBlock
does not yet trigger drops one item, as expected - Clicking with a tool, weapon, or another item that fails the
shouldUseDragonTools
also drops only one item - If a Dragon Inventory tool activates, the other mentioned methods of causing the same problem stop working. In other words, beginning to hold LMB on a wooden drawer with an axe in the Dragon Inventory, and then scrolling to another hotbar item, does not cause more items to drop. Doing the same without an axe in the Dragon Inventory drops a new item each time the held block changes.
- However, this still happens when the item being switched to is a tool or a weapon (like mentioned above, likely anything that fails the
shouldUseDragonTools
check). I assume this is because it does another held item swap.
I can't clearly say if this is an issue with Dragon Survival, storage-drawer-like mods, or Forge itself. Repeated triggering of the drawer is consistent behavior, but not sure if it's expected, and the under-the-hood tool swap that Dragon Survival performs (to account for e.g. modded enchantments that check the held item) leads to this problem.