ValheimWorldConvertDiag
Diagnostic BepInEx plugin for locating malformed legacy inventories that cause Valheim 1.0 world conversion to fail.
模組介紹 作者原文
ValheimWorldConvertDiag
Diagnostic BepInEx plugin for tracking down legacy inventory data that causes Valheim 1.0 world conversion to crash.
This was created after a previously healthy vanilla world failed to load after updating to Valheim 1.0 with:
System.NullReferenceException: Object reference not set to an instance of an object
at ItemDrop+ItemData.IsSameType
at Inventory.AddItem
at Inventory.AddTempItem
at Inventory.LoadOld
at ZDOMan.ConvertInventories
World load failed mid-file. Exiting without save. Check backups!
The same world loaded correctly on the previous Valheim version, including backups going back about a year.
The problem turned out to be one malformed legacy container inventory.
What this plugin does
ValheimWorldConvertDiag patches the legacy world inventory conversion process and logs the inventory and ZDO being processed when conversion fails.
It records details such as:
- inventory size
- loaded item count
- last item name
- prefab hash
- stack size
- durability
- inventory grid position
- crafter data
- ItemData.IsSameType() state
- m_shared null state
- recent items processed in the same inventory
- source ZDO UID
- source ZDO world position
- source prefab hash
The most useful part is the ZDO position.
Instead of manually opening hundreds of chests, you can use the logged coordinates to find the exact world object causing the conversion failure.
Important
This plugin is diagnostic only.
It does not:
- modify world data
- delete items
- skip broken inventories
- suppress the original exception
- automatically repair the world
Always work from a backup.
Confirmed real-world case
The world used to develop this plugin contained more than 1.4 million ZDOs and had never been modded.
Valheim 1.0 failed while converting this legacy inventory:
Inventory size: 4x4
Loaded items before failure: 6
Recent items included:
Wood x50 pos 1,0
Stone x7 pos 3,0
Stone x50 pos 0,1
CharredBone x50 pos 2,1
CharredBone x50 pos 4,1
CharredBone x14 pos 1,1
Wood x38 pos 4,1
The suspicious part was that a 4-wide inventory contained items at:
pos=4,1
and multiple items appeared to overlap at that same position.
The crash occurred inside:
ItemDrop+ItemData.IsSameType
while both ItemData objects had:
m_shared=
The plugin identified the source ZDO as:
UID: 1:183157
Position: (-866.75, 31.46, -8632.98)
Prefab hash: 328745978
That location turned out to be an unimportant chest at an old Ashlands landing camp.
The world was loaded using the previous Valheim version, the offending chests were destroyed, dropped items were removed, and the world was saved again.
After that, Valheim 1.0 converted the world successfully.
Recommended recovery workflow
Do not try to repair the world directly in Valheim 1.0.
The safest process is:
- Keep an untouched backup of the original pre-1.0 world.
- Run Valheim 1.0 with this diagnostic plugin.
- Let conversion fail normally.
- Read the logged ZDO coordinates.
- Switch back to the previous Valheim build.
- Load the same world on that older version.
- Travel to the logged coordinates.
- Remove or empty the offending container/object.
- Save the world normally.
- Switch back to Valheim 1.0.
- Try conversion again.
- Repeat if another malformed inventory is found.
This avoids editing the save file directly.
Using the previous Valheim build
Valheim keeps an older stable branch available through Steam.
For the regular game client:
- Open Steam.
- Right-click Valheim.
- Select Properties.
- Open the Betas tab.
- Select the previous stable branch, commonly named:
default_old
- Let Steam download the older build.
- Start Valheim.
- Load the affected world.
- Fix the object at the coordinates reported by the plugin.
- Save and exit cleanly.
When finished:
- Return to Properties > Betas.
- Switch back to the normal/default branch.
- Let Steam update to Valheim 1.0 again.
- Retry the world conversion.
Branch names can change over time, so if de
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。
下面這些內容需要先安裝,否則該模組不會生效: