Valheim1CompatBridges
BepInEx preloader that adds old API signatures back to Valheim 1.0 so pre-1.0 mods (Weedheim, WeedheimShip, Marketplace And Server NPCs) load again. Includes a script for Marketplace two remaining IL
模組介紹 作者原文
Valheim1CompatBridges
BepInEx preloader patcher for Valheim 1.0 (Unity 6). It adds the old method overloads, fields and
interface defaults back into assembly_valheim.dll at load time, so mods compiled against pre-1.0 builds stop
crashing with MissingMethodException, MissingFieldException: ZRoutedRpc.Everybody, `TypeLoadException:
VTable setup failed or Harmony Undefined target method`. No mod DLL is redistributed.
Tested with (client + dedicated server, BepInEx 5.4.2350):
| Mod | Result |
|---|---|
| MagicMike-Weedheim 2.0.4 | loads and works |
| MagicMike-WeedheimShip 1.0.2 | loads and works |
| KGvalheim-Marketplace_And_Server_NPCs_Revamped 9.8.1 | loads and works, with fix-kg-marketplace.ps1 applied once (see below); NPC map right-click (fashion) has no equivalent in 1.0 and does nothing; transmog icons in the inventory grid are not refreshed |
Install
Put the patchers/Valheim1CompatBridges folder into BepInEx/patchers/ on the client and on the
dedicated server (r2modman Mod Manager do this automatically). Look for
[Valheim1CompatBridges] Gotowe: N mostkow in BepInEx/LogOutput.log.
What it bridges
- Inventory.Changed() → Changed(false, false) (original renamed to ChangedEx, game calls rerouted so
Harmony postfixes on Changed still fire)
- ZRoutedRpc.Everybody const → static field
- InventoryGrid.Element wrapper type (m_go, m_pos, mirrored fields), GetElement/GetHoveredElement
overloads returning it, empty List m_elements_compat (deliberately not named m_elements:
two same-named fields are legal in IL but make AccessTools.Field(type, "m_elements") throw
AmbiguousMatchException, breaking mods that inject ___m_elements by reflection, such as
AzuExtendedPlayerInventory and AzuAutoStore)
- InventoryGrid.Awake() (called from OnEnable), Minimap.OnMapRightClick() stub
- Hoverable.GetHoverOffset() default implementation
- old overloads of: Character.Message, MessageHud.ShowMessage, EffectList.Create,
SEMan.AddStatusEffect (×2), ItemData.GetTooltip, Inventory.IsTeleportable, Humanoid.IsTeleportable,
Inventory.AddItem (12 params), Terminal.ConsoleCommand ctor (12 params), Terminal.ConsoleEventArgs
ctor, YesNoPopup ctor, Heightmap.Poke(bool), TerrainComp.Save(), Piece.SetCreator(long),
VisEquipment.Set*Item(string, …) (prefab name → hash)
Using Marketplace as well?
Marketplace has two breakages the preloader cannot reach, because they live in the mod's own IL: its
Hud.UpdatePieceList transpiler hardcodes local slot 12 for a Piece that Valheim 1.0 moved to 13
(InvalidProgramException, quest markers missing from the build menu), and it reads the old
InventoryGrid.m_elements field from IL. The mod is closed-source, so there is no upstream fix to wait for.
Run this once per machine, against your own copy of the DLL:
pwsh -File tools/fix-kg-marketplace.ps1 -Dll "/BepInEx/plugins/KGvalheim-Marketplace/kg.Marketplace.dll" -Apply
It reads the real slot numbers out of your assembly_valheim.dll instead of trusting a hardcoded one, is
idempotent, and refuses to guess if the layout it expects is gone. Keep the original DLL, and re-run it after
every Marketplace update. The script lives in the repo, not in this package.
Source, and why this is a new project rather than pull requests:
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。
下面這些內容需要先安裝,否則該模組不會生效: