Sophisticated Backpacks Sometimes Voids Inventory On Upgrade
anivlys opened this issue ยท 19 comments
Modpack version
0.4.0
Describe the bug
When upgrading a backpack to Iron/Gold/Diamond version it will sometimes void the inventory upon upgrade. You can easily tell when it will void if you hold shift over the output backpack (it will show no items).
This is entirely inconsistent in when it voids and when it doesn't.
Logs
Screenshots
Upgrade voiding inventory.
Upgrade not voiding inventory.
Thanks for the report - This has been fixed, and will be in update 0.4.1 which I plan to get out tomorrow :)
Actually to be clear what I have fixed are the dye recipes when applied to the basic tier of backpacks. The upgrades should work with no issues. However I will need more info on how to recreate as this works for me with no issue.
However the behavior seems similar to the one that happens when backpack is cloned in creative - in that case the backpack will keep the same uuid reference to contents storage and then you can have two backpacks modifying the storage and if one of them gets upgraded the contents are transfered to new uuid and contents for old uuid are cleared (not to leave behind contents that can't be accessed by any backpack).
Are you sure the backpack before upgrade wasn't cloned in creative?
I can confirm I had a backpack voided when upgrading - even got that on video :P
I didn't try and replicate since I saw it was reported already, but I could have a lead for you. Not sure what the criteria for cloned in creative are, but my backpack (and I'm guessing theirs too) was a quest reward from FTBQuests, so likely done via commands. Does that ring a bell?
For those screen shots I just gave myself four backpacks from creative and put items in them to see which would void and which wouldn't.
I did a test with giving myself leather, string, and chests and manually making four backpacks and adding items inside of them. Three of the four would upgrade to iron tier without voiding, one would void. Upgrading a backpack to iron somehow fixed the the fourth so it did not void when upgrading to iron. This is all under the 18th Feb update and not the 24th Feb one.
Edit: I manually updated the mod and will test again to see if it still inconsistently voids.
yup, this is the issue here https://github.com/NillerMedDild/Enigmatica6/blob/master/config/ftbquests/quests/chapters/storage.snbt#L787-L792
Fix is to just remove the contentsUuid from there.
Basically the same UUID in the backpack that's given out that means everyone on server will get their backpack pointed to the same storage and then as soon as the first player upgrades the storage gets wiped for the others (it is borked anyway as the players will override each others backpack inventory given that all their backpacks pointe to the same storage)
I must admit I didn't fully read this issue, I was fairly certain what it was since P3pp3rF1y had contacted me a bit before this :P sorry about that, we'll get this fixed.
While we fix this, we should fix the backpack quests all together... Right now if you dye the backpack when you first get it, further storage upgrades to the backpack will not count towards completion for the next tier quests.. I will look in to this tonight if someone doesn't get to it before me
that should be as easy as adding tags to the colored backpacks and using a tag reward. Can take care of that right now
I'd also prefer not to give out a backpack tbh, I find it's a pretty common first-ish goal.
Outside of quest changes. I tested 18 backpacks (nine manually crafted, nine from the creative menu) with the latest update (2.2.1.178) and upgrading all 18 from basic all the way to netherite and they all retained their inventory. I then went back and reverted to the current version (2.2.0.171) and with nine manually crafted backpacks I was immediately able to see that six of them voided their inventories upon upgrading to iron.
So for general users that aren't trying any UUID cloning shenanigans the latest update appears to fix the voiding issue with upgrading.
All my testing has been done in a single player world, so any quest UUID issue that occur with multiple players wouldn't have been something I would have run across.
Updated the mod, reset the quest, got the backpack again and it didn't contain the items, so got another uuid again.
Crafted a backpack from scratch and upgraded it and lost my items again.
Haven't tested downgrading the mod to whatever version was in 0.3.x yet
I have tested this a bit more and there's definitely something odd going on in here. In regular crafting tables the upgrade will work correctly only if the backpack is put in as the last one - having jei fill the recipe in or placing bars in the grid after the backpack makes it lose the items.
In crafting station it voids almost every single time.
And with just sbp and vanilla this works correctly in whichever order you decide to put the recipe in the crafting table or if you have it prefilled by JEI. I will see what I can do on my side about simplifying the crafting as much as possible to hopefully avoid this minefield that something planted for me here.
Tested with SBP and Fastworkbench wasn't able to recreate so something else is causing it here. Anyway I will try to simplify the recipes so that no copying of contents to new uuid is needed as part of crafting if possible which should get rid of this strange interaction with some mod.
@hvdklauw updating the mod isn't going to help you with the backpack from quest as that has a fixed uuid attached to it (the quest backpack needs to be fixed here) so if someone else on the same server got backpack from quest contents of yours can easily be wiped by them dyeing the backpack or upgrading to next tier.
And donwgrading isn't really going to help here I am not going to go back to storing all of the inventory as one huge nbt right in the backpack item stack.
Just testing with enigmatica and I feel like I know what's happenning here. What crafting table have you used to craft/upgrade the backpacks @hvdklauw? Crafting Station? That seems to mostly not work for as opposed to regular crafting table that always does so I am going to poke in their code.
I have simplified the recipes, tested with E6 pack with both regular crafting table and crafting station and all seems to work correctly. However if anyone is up to retest I would appreciate that.
New version of the mod with this change is up on CF.