Project Zomboid

Project Zomboid

69 ratings
Fix "Rip Clothing" Character Corruption
4
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
229.668 KB
16 Nov, 2023 @ 12:11pm
18 Nov, 2023 @ 8:48pm
4 Change Notes ( view )

Subscribe to download
Fix "Rip Clothing" Character Corruption

Description
When you favorite a recipe, the game saves the recipe name, outputs, and all possible ingredients to an identifier string on your character's save file.
If you have too many mods that add clothing items, the recipe to rip clothing can generate a string larger than 32767 bytes, which makes the game unable to load your save file, if you set it as a favorite recipe.
This generates an error on the log such as
java.lang.RuntimeException: invalid lua table type 99

This mod runs every identifier string through a simple hashing algorithm, which makes sure each identifier is of a predictable size, and, most importantly, smaller than 32767 characters. Your save file might even shrink by a couple Kb.
There will be a performance hit from running the algorithm, no clue how much though.


You should be able to safely add and remove this mod from a running save, and you should only lose your favorite recipes.
Note that this does not fix an already corrupted character.

This mod appends to the
ISCraftingUI:getFavoriteModDataString
method. If any other mod overwrites it, simply move this one later in the load order and it should keep working.

I've made a bug report here: https://theindiestone.com/forums/index.php?/topic/69331-favoriting-the-rip-clothing-recipe-if-you-have-too-many-clothing-mods-can-corrupt-your-character-data/
This mod is just a band-aid until this is fixed.

Workshop ID: 3085491446
Mod ID: fixRipClothingCorruption
22 Comments
cznorton2 25 Jul @ 6:10pm 
Strange reply but ok...
Trigg  [author] 15 Jul @ 11:24am 
Thank you for the informative report, now I know exactly how to make it work!

...On a less ironic note, I have not tested this at all in B42 beta and it likely won't do anything at all.
Also, if you're on B41, make sure the mod is actually enabled.
cznorton2 14 Jul @ 8:44pm 
mod doesn't work
Alyx 4 Jul @ 3:48pm 
OMG you literaly save me! i have a big modpack testing, it works but cant load the character propely, u know the game tells you to make a new one, and your mod fix that, you my hero :8bitheart: thanks so much! :mbnyufufu:
123 2 Feb @ 5:38am 
这是做什么的 可以查看其他mod冲突吗
jeetrix 28 Dec, 2024 @ 3:17am 
ty
Chertolet 15 Dec, 2024 @ 2:45am 
It seems that it was the common sense mod, so this patch had nothing to do with it in the first place
Come and See 10 Dec, 2024 @ 12:47pm 
Ran into this same issue on my current save. I favorited rip clothing, reloaded, and bam I'm a NoneNone.
Trigg  [author] 7 Dec, 2024 @ 6:37am 
The patch I did shouldn't be specific to just clothing, so if food cans are causing a similar problem then it must be something somewhere else; I'd need a save file to look for it, though.

Really, the root cause of the issue lies in the Java part of the code, which can't be patched with mods as far as I know.
Chertolet 7 Dec, 2024 @ 4:39am 
For me there is also the same stuff going on with cans of food, no matter if they require an opener or no. It fixed the bug with clothing for me, but doesn't help with cans. Any idea on how to fix that without disabling all food mods as they didn't use to cause the bug before?