[Fabric] Expanded Iron Bundles

[Fabric] Expanded Iron Bundles

24 Downloads

Items Disappearing

spAnser opened this issue ยท 3 comments

commented

It seems like once a single item type reaches 128 in a bundle it deletes all of the items in the bundle of that type.

commented

Hi, I just checked on my end and they all appear to be doing it.

It looks like the item count goes into the negative when you insert more than 128 of a single item type.
However, the items aren't technically lost since when you insert more of the same item as long as you don't empty the bundle again, the game creates a new NBT list entry and keeps the old one that is in the negative intact.

I'm sorry if you lost any item to that bug, I'll see if I can add a check that puts the negative numbers back in the positive and how to bundles handle and excess of items at the same time.

I'll also add a warning to the mod page in the meantime.

Thank you so much for taking the time to report this issue.

commented

The problem should be now fixed in the fabric-1.19-fix_byte_overflow branch.

The cause was that Minecraft uses a 'byte' internally to store a stack's size in NBT tags, which caused it to overflow at 128 and go in the negatives when reading or writing NBT tags.

The modded bundles now use the 'int' type which should let them store up to ~2.4 billion of a specific item just like the game does internally when it isn't passing through NBT tags.
The update should also progressively upgrade the old bundles to the new format when items are removed or inserted back into it.
And if you didn't attempt to remove items from the bugged bundle when it appeared to be empty, you should see your previously lost items as a separate stack in the tooltip.

I'm gonna do a couple more tests to make sure everything works on that front, and I'll be making a pull request to merge all the chanegs back in the appropriate branch before puching the update to modrinth and curseforge.

commented

Thanks. I was mostly testing it out so nothing of value was lost.