Barrels Notifications showing null when containing more than 127 items
tommyTT opened this issue ยท 7 comments
Bug and steps to reproduce
Put down a Charset Barrel and insert one item. Clicking with an empty hand on the barrel brings up the notification for the player of how many items are in the barrel and what the name of the item is. Insert exactly 127 items and bring up the notification again, it still works. Now add one more item and once again bring up the notification. It will show the correct amount of items but the name of the item now is "null". Removing one item will show the correct version of the notification, anything over 127 and under 257 items however brings up the faulty one.
Environment and Versions
Minecraft: 1.12.2
Forge: 14.23.4.2725
Charset: 0.5.0.248
Other installed mods: jei_1.12.2-4.10.0.200
Diagnosis
I looked into what is going on and the culprit seems to be the serialization code for the NotificationComponentItemStack part of the notification message that is being sent. It serializes the entire item stack of the barrel through the standard forge methods but the count of the item stack will be serialized as a byte. Deserialization then reads the item count as a byte, but if there was an overflow during serialization, now receives a negative item count (e.g. 128 items will be deserialized as -127 items). During construction of the item stack instance on the client side any item stack with a negative count will return true for isEmpty and therefore render as "null".
This was fixed in Charset 0.5.0.248e or 248f, and is thus a duplicate. Always check with the latest release.
As I explained to you in the previous issue, our Maven/CI situation is in a mess - especially as the repository is being updated on git.asie.pl, while the issues are still maintained here; the Jenkins I used it not fully configured to use git.asie.pl, etc.
This is also the reason why the numbering system has moved on to letters - until I resolve automatic building I'm not really planning to increment the build number, as there has been no automatic build.
(I'll admit I feel a bit bad, as this is one of the better bug reports I've gotten... and all in vain.)
I'll get around to fixing the Maven/CI/repository situation at some point, but it's a lot of small issues to deal with.
No worries, it's my fault, I should have double checked the newest version. My main reason for doing all this is another bug I'm trying to find that sometimes doesn't allow me to insert items into non-empty barrels. But since I cannot reproduce it in a reliable way, I haven't filed a bug report. I will try again with the latest version and checkout the latest source from git.asie.pl now that I know the setup.
Thanks for your help!
I'm trying to find that sometimes doesn't allow me to insert items into non-empty barrels.
I'll give my best hint: Charset has a feature where, if you double-right-click (within some kind of duration, I think about 0.5 seconds), it will insert all items matching the one you just inserted into the inventory. Maybe that is causing the problem?
Or maybe it's related to the faces?
Sorry. TileEntityDayBarrel is a mess in need of some work.
What does "sometimes" mean? Does it persist across world reloads, specifically? If so, you could just send me the broken instance and I could have a look. If not, try to reproduce it in a debug environment and put a breakpoint somewhere in the barrel's logic to check its inner state.
Thanks for the suggestions. As I said, I can't reproduce it reliably, therefore I didn't want to bother anyone yet.
"Sometimes" means, that I have a wall of barrels containing items and I want to insert new items into those barrels. Some of the barrels work, but for some I can't insert any items. I can take them out, but putting them in again won't work. Taking out all items and inserting them again fixes it, re-logging helps sometimes, but not all the time. Double clicking and so on doesn't work as well in those situations.
This might be also be some interaction with another mod, since it is happening in a custom modpack with about 180+ mods. It might not be a fault with the barrels at all. Thanks for offering to look into it, but the broken instance would require a lot of setup for you at the moment, I will try to find a "vanilla" example in the dev environment and then give you a full bug report.