HTF MoreItemAPI

版本 v2.0.0·更新於 2026-08-30

Runtime API for How to Fish custom-item mods, with automatic Item IDs, AssetBundle icons and hand poses, game-component reconstruction, and FishNet spawning.

模組介紹 作者原文

HTF MoreItemAPI

Language / 語言: English · 簡體中文

English

HTF MoreItemAPI is a BepInEx runtime API that lets C# content mods register independent custom items in How to Fish. A content mod loads its own AssetBundle and calls one registration method; the API copies a compatible original item skeleton, reconstructs the game and FishNet components, applies the authored physics and hand-pose data, and registers the result.

Use the separate HTFItemSDK Unity package to author prefabs, embedded inventory icons, visual hand poses, item-definition assets, and validated AssetBundles.

Supported environment

  • How to Fish 1.0.10
  • Unity 6000.4.4f1
  • BepInEx 5.4.23.5
  • HTF MoreItemAPI 2.0.0
  • BepInEx GUID xiaohai.HTF.MoreItemAPI
  • HTFItemSDK / Contracts 0.1.3

The generated-item pipeline validates the current Assembly-CSharp MVID before cloning game structures. An unsupported game update is rejected with a compatibility error instead of registering a partial network prefab.

Install

Copy these two assemblies from dist/ into the game's BepInEx/plugins/HTF-MoreItemAPI/ directory:

HTFMoreItemAPI.dll

HowToFish.ItemSDK.Contracts.dll

Every multiplayer participant must install the same API, content-mod DLL, and AssetBundle versions.

Recommended SDK definition workflow

Declare a hard dependency from your content mod:

[BepInDependency(ItemApiMetadata.PluginGuid, BepInDependency.DependencyFlags.HardDependency)]

Load the HTFItemDefinitionAsset built by HTFItemSDK and register it before connecting or starting a server:

AssetBundle bundle = AssetBundle.LoadFromFile(bundlePath);

HTFItemDefinitionAsset definition =

bundle.LoadAsset("C4ItemDefinition");

ItemRegistrationHandle handle = ItemRegistry.RegisterGenerated(

GeneratedItemRegistration.FromDefinition(

definition,

"com.example.c4item"));

Creators do not select an ItemId. Keep modGuid and the definition's InternalName stable after release; HTF MoreItemAPI uses their normalized modGuid:internalName key as the logical item identity and assigns the game-local byte slot centrally.

Lower-level generated-item workflow

You can load a normal content prefab and icon directly instead of using an SDK definition:

GameObject contentPrefab = bundle.LoadAsset("EnergyDrinkItem");

Texture2D icon = bundle.LoadAsset("EnergyDrinkIcon");

ItemRegistrationHandle handle = ItemRegistry.RegisterGenerated(

new GeneratedItemRegistration

{

ModGuid = "example.author.items",

InternalName = "energy_drink",

ContentPrefab = contentPrefab,

DisplayName = "Energy Drink",

InventoryIcon = InventoryIcon.FromTexture(icon),

PickupRadius = 0.55f,

Buoyancy = 1f

});

An AssetBundle Sprite can also be used:

Sprite icon = bundle.LoadAsset("EnergyDrinkIcon");

InventoryIcon inventoryIcon = InventoryIcon.FromSprite(icon);

The API never reads external PNG, ICO, JSON, or resource-path files. The inventory icon remains inside the content mod's AssetBundle.

Content prefab contract

ContentPrefab must be a prefab asset returned by AssetBundle.LoadAsset(), not a scene instance. Prepare the following normal Unity content:

  • Model, materials, lights, particles, audio, and other presentation assets.
  • Exactly one Rigidbody on the prefab root. Its mass, damping, gravity, interpolation, collision mode, and constraints become the final item settings.
  • At least one Collider for world collision.
  • A Texture2D or Sprite inventory icon.

Do not include Item, RigidbodySync, NetworkObject, FishNet components, or missing game scripts. HTF MoreItemAPI supplies and reconstructs them from a compatible original item template. It resets the cloned content root position and rotation, preserves scale, copies the authored Rigidbody settings to the generated game root, removes the content Rigidbody, and registers the content colliders as Item._worldColliders. A separate game-owned pickup trigger is created from PickupRadius.

The advanced ItemRegistry.Register(ItemRegistration) interface remains available for prefabs that already contain a complete o

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack

檔案與校驗

檔案名稱
HTF_MoreItemAPI-2.0.0.zip
檔案大小
94.6 KiB