[bug]Integer overflow in the drawer with creative storage upgrade
Forever-178 opened this issue ยท 4 comments
Item count overflows in the drawer with creative storage upgrade when insert items which count closing to Integer maximum value in the drawer.
Environment:
Minecraft version: 1.21
Mod loader: NeoForge 21.0.167
Mod List:
- Storage Drawers-neoforge-1.21-13.8.3
- Mekanism-1.21-10.6.7.54
Step to reproduce:
- Use this command to generate a drawer that item count closes to integer maximum.
/setblock ~ ~ ~ storagedrawers:oak_full_drawers_1[facing=north]{Drawers:[{Count:2147483646,Item:{Count:1b,id:"minecraft:grass_block"}}],Upgrades:[{Count:1b,Slot:0b,id:"storagedrawers:creative_storage_upgrade"}]}
- Use advance logistical transporter insert grass block to this drawer. (Do not use hopper to insert item. It only send 1 item at once.)
- Item count will overflow.
I read the source code of 1.12. I think the problem may lie here. Forever-178@2631e4c
I haven't conducted detailed tests for various edge cases, but it works fine in the tests mentioned above.
Thanks for pointing out the prior commit. Must have missed copying that to the newer versions. Will be fixed in the next release.