


Part of the BreakoutMods modding suite.
CIR, short for Custom Item Registry, is a Valheim modding API for developers who want to ship custom 3D item prefabs from AssetBundles without rewriting ObjectDB, ZNetScene, recipe, and multiplayer registration glue in every mod.
Repository: BreakoutMods/CIR-CustomItemRegistry
The library is built for BepInEx 5.x, Harmony, and Jotunn. It leans on Jotunn's PrefabManager and ItemManager for multiplayer-safe prefab and recipe registration, while exposing both the original small API and a CIR 0.2 builder API.
Reference CustomItemRegistry.dll from your mod project and add BepInEx dependencies:
[BepInDependency(CustomItemRegistryPlugin.PluginGuid)]
[BepInDependency(Jotunn.Main.ModGuid)]
Register a modern item from Awake:
CustomItemRegistry.Item("BreakoutSword")
.FromBundle(assetBundlePath, "BreakoutSwordPrefab")
.DisplayName("$item_breakoutsword")
.Description("$item_breakoutsword_desc")
.Icon("BreakoutSwordIcon")
.Recipe(recipe => recipe
.At("forge")
.RepairAt("forge")
.StationLevel(2)
.Amount(1)
.Requires("FineWood", 4)
.Requires("Iron", 10))
.Gear(gear => gear
.OneHandedWeapon()
.Weight(2f)
.StackSize(1)
.Durability(200f)
.MaxQuality(4)
.SlashDamage(35f)
.BlockPower(20f)
.MovementModifier(-0.05f))
.Register();
The original API remains supported:
CustomItemRegistry.RegisterItem(
"MyCrystalSword",
Path.Combine(Path.GetDirectoryName(Info.Location), "myitems"),
"MyCrystalSwordPrefab",
new CraftingRecipe(
new List<Ingredient>
{
new Ingredient("FineWood", 8),
new Ingredient("Crystal", 12),
new Ingredient("Silver", 4)
},
"forge",
1));
The AssetBundle prefab must include an ItemDrop component. If it does not already include a ZNetView, CIR adds one and marks it persistent for networked item drops.
CustomItemRegistry.Item(string itemName) fluent builder entrypoint.RegisterItem(string itemName, string assetBundlePath, string prefabName, CraftingRecipe recipe) legacy API.RegisterItem(CustomItemDefinition definition), TryRegisterItem(...), and RegisterItems(...).CustomItemBuilder, RecipeBuilder, GearBuilder, CustomItemDefinition, ItemRegistrationResult, and CustomItemRegistrationException.CraftingRecipe with ingredients, crafting station, repair station, station level, amount, enabled flag, require-only-one ingredient, and quality result multiplier.Sprite..ConfigureSharedData(...) escape hatch for advanced ItemDrop.ItemData.SharedData edits.BepInEx/plugins.PrefabManager for multiplayer-safe ZNetScene registration.ItemManager.ObjectDB.CopyOtherDB and ZNetScene.Awake to flush items into live databases when Valheim creates or copies them.ItemDrop, duplicate item names, invalid recipes, and missing craftable item icons with clearer log messages.The src/ExampleCustomItemPlugin project shows builder, definition, try-register, and legacy API usage. Its sample AssetBundle and prefab names are placeholders, so replace them with real assets before shipping.
If you're using a mod manager, you can likely ignore this section.
CustomItemRegistry.dll into BepInEx/plugins/CustomItemRegistry.BepInEx/plugins.This repo expects to live under a Valheim install like:
Valheim dedicated server/
BepInEx/
valheim_server_Data/
Modding/
CIR-CustomItemRegistry/
Build with:
.\build.ps1 -Configuration Release
Debug builds copy the API DLL into BepInEx/plugins/CustomItemRegistry and the example DLL into BepInEx/plugins/ExampleCustomItemPlugin.
Wood, Bronze, LeatherScraps, FineWood, or Crystal.piece_workbench, forge, and piece_cauldron. Passing null or an empty string makes the recipe craftable without a station.ItemDrop shared data, pass a direct Sprite, or call .Icon("SpriteAssetName") for craftable items.Please open issues with the Valheim version, BepInEx version, Jotunn version, the item prefab name, and the relevant BepInEx log lines. Pull requests that keep the public API small and improve interop with Jotunn are welcome.
See CHANGELOG.md.