[1.16.5] Items found in backpacks on multiplayer can be crossed between players or go entirely missing
Kaleidio opened this issue ยท 10 comments
Describe the bug
For whatever reason, without any log of the misbehaviour whatsoever, it is possible for backpacks to either shuffle slots between player data, or lose random items entirely. This occurs when at least a second player joins and starts using the backpack, dies with keep inventory on, or the world autosaves on multiplayer servers.
To Reproduce
Steps to reproduce the behavior:
- download Kaleidio's Battle Pack 4.0.0 (available on curseforge here:) https://www.curseforge.com/minecraft/modpacks/kaleidios-battle-pack/files
- download server pack and install (available on the same link as above)
- play on the server for a while with at least one other player present, using the backpack as much as possible
- watch your backpack fill with items the other player put in theirs, then die a few times until items start disappearing.
Expected behavior
I have absolutely no idea what's going wrong here. I have a feeling the mod is misbehaving reading incoming client packets when it comes to items being synced, causing some of them to drop off the face of the earth for no reason. I am unable to verify whether it gets ditched from the world save data at all or not, I have not been checking the nbt files.
note that the issue does not happen with expanded storage, nor atum, nor any other mod providing chests or even quark's backpack which I have disabled by default anyway, so it's something wrong with your mod alone. I have not tested if I can reproduce it with this mod by itself. it is possible it is a conflict with roadrunner (lithium forge)
Versions
mc 1.16.5
forge 36.2.22
sophisticated backpacks 3.15.1.503
There's no good way to know there are duplicates. Potentially there would be a way to check there are no duplicates in one player's inventory but checking between players who can be both online and offline, chests and even all kinds of modded inventories that's a huge and complicated task which would likely consume quite a bit of processing power.
Anyway the issue is resolved for you so I am going to close.
issue does not occur when your mod is by itself. I am investigating mod collisions now
seems to be a collision with Roadrunner mod. still investigating to verify that is the case
that is possible, when roadrunner is installed the log does spam with attempts from Random Patches trying to deduplicate UUIDs of a lot of entities. said mod does not have success with tileentities. I will try to test but I cannot guarantee I will be able to replicate that
This sounds a lot like the two players having a backpack with the same UUID - could you check if it's the same (shows in tooltip when advanced tooltips are turned on - F3 + H)
oop yep that's the issue, Custom Starting Gear had the UUID's stored in nbt data so it was handing all players the same nbt.
"{id:"sophisticatedbackpacks:backpack",Count:1b,tag:{inventorySlots:27,upgradeSlots:1,contentsUuid:[I;-107445577,561201305,-1344835719,1600055894]}}"
if I remove the contentsUuid tag from this, will that break the mod, or will the mod autogenerate new uuid's according to player
oh you know what it might be, are you storing the UUID as nbt by any chance. I have Custom Starting Gear installed in my modpack which provides players with the same tier backpack. that might accidentally be making it have the same UUID across players as well, the UUID I saved the item to config with. what's weird is uninstalling roadrunner seemingly fixed things but I might wanna try CSG instead and see
hmmm still seems possible roadrunner is giving a duplicate uuid tho. might want to add checks for that in your code
if you remove the contentsUuid that doesn't cause any issue - basically any freshly crafted backpack doesn't have that tag and it only gets generated once you open it for the first time
okay so what was happening was I saved the backpack to custom starting gear after I already opened it, causing it to have an nbt saved so it was handing out duplicates. that could explain this misbehaviour.
by any chance can you add code to track the world's backpack uuids and swap them if there's a duplicate? I have fixed the issue on my end either way. this can be closed if you wish tho I advise investigating roadrunner behaviour just in case I'm incorrect here