ReefPacksAzuUIFix
UI-only compatibility for worn ReefPacks material counts in AzuCraftyBoxes 1.8.18. Does not change consumption.
模組介紹 作者原文
ReefPacksAzuUIFix 1.0.2
Direct final-text compatibility patch for ReefPacks + AzuCraftyBoxes. Replaces the unsuccessful 1.0.0/1.0.1 UI-bank approach.
Installation
Close Valheim. Replace the old ReefPacksAzuUIFix.dll in your active profile's BepInEx/plugins/ReefPacksAzuUIFix/ folder with the new DLL. Keep only one copy of this plugin. Restart Valheim and view the Hammer recipe. This release has not been installed into your profile automatically.
The release zip uses layout. Source and build scripts are provided separately. Version 1.0.2 can be uploaded as an update under the same team/package.
What changed
The plugin now patches only InventoryGui.SetupRequirement, with a Harmony POSTFIX marked [HarmonyPriority(Priority.Last)] and [HarmonyAfter("Azumatt.AzuCraftyBoxes")]. Registration also orders it after the other owners already present on that method. Other Harmony owners are allowed. Mods installed later with conflicting explicit ordering, or separate UI refresh paths, cannot be guaranteed to run before this patch.
It finds elementRoot.transform.Find("res_amount"), obtains TextMeshProUGUI, reads the resource shared name from Piece.Requirement, and adds the worn ReefPack count to the displayed available numerator. The denominator is preserved. Examples:
- 0/3 + 37 Wood -> 37/3
- 10/3 + 37 Wood -> 47/3
- 0/2 + 40 Stone -> 40/2
When the corrected count meets the displayed requirement, the component color becomes white. Otherwise Azu's existing color remains. Only text.text and text.color are written. No return value, recipe, inventory, eligibility state, consumption method, container list or UI-bank cache is changed. No UiItemBank methods are patched or invoked. No binary hashes or owner allowlists are used.
This is the explicitly requested additive display correction. It assumes Azu's displayed numerator excludes the ReefPack. It does not query containers to determine whether a future Azu release already includes the pack. If native integration starts including it, disable this compatibility plugin to avoid counting it twice. Azu's abbreviated K/M numerator can be parsed, but the original abbreviated count is already rounded, so the resulting sum is approximate. Unsupported custom formats are left unchanged and logged.
Equipped-pack access
Uses the inspected ReefPacks PackUi.WornPack(Player) method, which reads the local player's shoulder equipment reference and recognizes ReefPack items. Only that exact item's existing PackData.cache entry is accessed through TryGetValue; PackData.Item identity is checked and PackData.Inv is read. No carried-pack scanning, main-inventory membership assumption or frame-cache check is performed. Item matching uses the shared name and Valheim's world-level filter.
Never calls PackData.Get, because it can initialize, resize, save or eject items. An unavailable cache entry contributes zero and produces a diagnostic. Missing dependencies/API signatures prevent registration; runtime nulls or exceptions skip only the individual UI element and future elements retry.
Configuration and diagnostic session
BepInEx/config/local.ReefPacksAzuUIFix.cfg:
[General]
Enabled = true
DiagnosticLogging = true
Logging is enabled for testing. Repeated identical messages are suppressed; changing results are logged, up to 200 messages each launch. Disable DiagnosticLogging after the test. Startup reports both dependencies and successful InventoryGui.SetupRequirement registration. Expected messages:
SetupRequirement postfix executed
SetupRequirement $item_wood original=0/3 pack=37 corrected=37/3; read worn pack
SetupRequirement $item_stone original=0/2 pack=40 corrected=40/2; read worn pack
Read BepInEx/LogOutput.log or Valheim's Player.log after opening the Hammer recipe. These diagnostics distinguish missing pack data, an unsupported text format and successful correction later overwritten by another UI path. Errors do not disable the entire session.
Build and tests
Built against
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。
下面這些內容需要先安裝,否則該模組不會生效: