Storage Drawers

Storage Drawers

180M Downloads

[bug]Integer overflow in the drawer with creative storage upgrade

Forever-178 opened this issue ยท 1 comments

commented

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:

  1. 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"}]}
  2. Use advance logistical transporter insert grass block to this drawer. (Do not use hopper to insert item. It only send 1 item at once.)
  3. Item count will overflow.
commented

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.