Threshold Switch higher than vanilla stack size
Daldwin opened this issue ยท 4 comments
Describe the Bug
The Threshold Switch doesn't take into account stack size higher than vanilla stack size when calculating available space in a container, specifically a backpack from Sophisticated Backpacks with a stack upgrade doubling its stack size.
Reproduction Steps
1.Place a backpack with a stack upgarde
2.Place upgrade to double stack size in the backpack
3.Place a Threshold Switch observing the backpack
4.Fill the backpack with enough items to fill half of it (would be filled with vanilla stack size)
5.Threshold Switch signals the backpack as filled
Expected Result
Threshold switch should see that the backpack has more possible space thanks to the higher stack size and see it as half-filled.
Screenshots and Videos
Crash Report or Log
No response
Operating System
Windows 10
Mod Version
0.5.1c
Minecraft Version
1.19.2
Forge Version
43.2.14
Other Mods
Sophisticated Backpacks 1.19.2-3.18.50.847
Sophisticated Core 1.19.2-0.5.69.311
Additional Context
No response
When thinking on this issue, it would also be nice to include reading other "potential size" versus "size in use" inventory, such as when reading mods like Functional Storage (reads only the first stack as a percentage, as it seems like it has only a single inventory slot).
I'm seeing this same issue with Functional Storage drawers, the Threshold Switch sees the drawer as completely full even at half.
a 1x1 drawer can hold 2048 items, when half are removed the switch still registers as 100%.
This bug seems to apply to anything that holds a "higher than vanilla" stack size, whether it be Sophisticated Storage/Backpacks or Functional Storage with the drawers. It seems like it assumes the 100% value for any single slot is 64, then multiplies by the number of slots an inventory has to get the "Total items to equal 100%". So if I've got a 2 slot drawer/barrel, it doesn't matter how many stacks can fit in each slot, the Threshold Switch only sees the inventory as able to hold 128 items, and bases the percentage off of that, no matter which slot those 128 items are in.
@zelophed
(Drawers in the image are all full)
Still an issue with (Simple) Compacting Drawer and Storage Controller (Extension) of Functional Storage in d9198f6.
While getting the space amount for each slot in the Compacting Drawer, inv.getSlotLimit(slot)
always returns the total amount (e.g. 41.5 K), regardless of whether the slot
is 'enabled' or not. Similar as Storage Controller (Extension).