Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
PortalMetalLock
Metals/ores/bars/scrap (vanilla AND mod-added) can't be carried through wood portals; the Ashlands stone portal still carries everything. Server-enforced for all clients; config is server-authoritative (locked).
By Baka_Gaijin
CHANGELOG
Changelog
1.5.1
- Adds a second teleport-gate patch on
Humanoid.IsTeleportableas a fallback for Valheim builds where the portal calls the Humanoid method directly. The originalInventory.IsTeleportablepatch is kept. Both patches re-stamp the inventory at the instant of the teleport check. - Startup patch verification — logs exactly which Harmony patches applied and warns if a critical gate is missing, making silent patch failures visible in the BepInEx log.
- Diagnostic logging — when the teleport-gate re-stamp catches items that had reverted to teleportable, it logs the count (throttled to avoid spam).
1.5.0
- Fixes modded metals still teleporting through wood portals. In 1.4.0 the vanilla metals were blocked, but the Final Sunset (Balrond) modded tiers — Lead, Zinc, Nickel, Cupronickel, their ores/scraps, and ingots — could still be carried through a wood portal. Cause: those modded items are rebuilt by the mod loader with a fresh "teleportable" flag at the moment of teleport, which the per-inventory/per-drop re-stamp could miss. The item prefab was correctly flagged (confirmed in the item dump), but the live item the portal actually checks wasn't always caught in time. The mod now re-stamps the flag on the exact inventory the wood portal is about to check, at the instant it checks it, so a modded metal can never slip through on a timing edge. Vanilla metals were unaffected (the base game already marks them non-teleportable), which is why only modded metals leaked. The Ashlands stone portal still carries everything (it short-circuits the per-item check before this runs).
- Brass Chain is no longer blocked.
BrassChain_balis a finished component you craft from metal (like nails), not a raw bar/ore/scrap, so it now teleports through wood portals in line with the rule "raw metal can't teleport, but things you make from metal can." (All nails — Bronze, Iron, Darksteel, Wood — were already teleportable.) - This minor bump is mandatory for everyone. Because the wood-portal check runs on each player's own client, every client must update to 1.5.0 (the server enforces a matching major.minor or the client is kicked at connect).
1.4.0
- Fixes the drop/pickup bypass. Previously a freshly-crafted metal was correctly blocked, but after you dropped it on the ground (or stashed it in a chest) and picked it back up, it became teleportable again. Cause: the non-teleportable flag lives only on the item prefab and is never saved per-item — the game re-derives it from the item database every time an item is rebuilt, and modded item databases get rebuilt in several waves, resetting the flag. The mod now re-stamps the flag on the live item whenever your inventory changes and whenever an item is dropped in the world, so metals stay blocked across drop / pickup / chest / reload. (It only ever adds the block — it never makes another mod's item teleportable, so the Ashlands stone portal still carries everything.)
- All equipment is now guaranteed to go through wood portals. 1.3.0 wrongly blocked metal-named gear — bronze pendant, iron brooch, iron horse armour, metal trinkets, capes, and even the vanilla "Heart of the Forest." The block is now hard-gated to raw Material items only; weapons, armour, tools, trinkets, jewellery, capes and food can never be blocked regardless of their name.
- Expanded keyword coverage for the Final Sunset (Balrond) metals that were slipping through — Nickel, Zinc, Lead, Brass, Cupronickel, Bell metal, Cobalt, Dark steel, Frosteel, Molten steel (displays as "Aurametal"), White metal, Vanadium, Gold, plus Ferroboron/Dark iron ("Thorium") and Ifrytium ("Cerium") by both their internal and displayed names.
- Verifiable classification. With LogDecisions on, the mod now writes a full item dump to
BepInEx/config/PortalMetalLock_items.txt(prefab | display | type | teleportable | decision) so exactly what is and isn't blocked can be checked from ground truth.
1.3.0
- Matching is now genuinely mod-aware and far more accurate. The old version matched a small English keyword list as a raw substring, which caused two bugs:
- False positives (items wrongly blocked from portals):
tinmatched chitin,orematched surtlingcore,ironmatched IronNails,scrapmatched meat scraps. - Misses (modded metals that wrongly stayed teleportable):
Nickel,Zinc,Lead,Brass,Cupronickelwere never in the keyword list; and metal "scrap" items registered as a non-Material type slipped past the Material-only gate.
- False positives (items wrongly blocked from portals):
- Keywords now match on whole tokens (names are split on camelCase + non-letters), so
tinno longer matcheschitinandoreno longer matchescore. - Greatly expanded default keyword list: adds
metal,steel,nickel,zinc,lead,brass,cupronickel,bellmetal,frosteel,darksteel,moltensteel, and more. Barescrap/barare intentionally NOT keywords (metal scraps/bars already carry the metal's name token), preventing leather/food false positives. - New ExcludeTokens guard (default
nail,nails,meat,necklace,food,fish,key,coin,gem) keeps nails, food and jewellery teleportable. - The type gate is relaxed from "Material only" to "anything that is not equipment/consumable" (toggle IncludeNonEquipTypes, default on), so metal scraps some mods register as Misc/Trophy are caught while weapons/armour/tools/food/jewellery stay teleportable.
- Extra delayed rescans (12s/18s/30s after load) catch mods that register metals in late waves.
- New LogDecisions option (default on) logs exactly what was marked non-teleportable and which metal-ish items were skipped (and why), so the block list can be tuned from config with no rebuild.
1.2.0
- Config is now server-authoritative: all settings are admin-only and synced from the server via Jötunn, then locked on clients. Players can no longer edit their local config to bypass the rule — the server defines what is blocked for everyone.
1.1.0
- Server-enforced via Jötunn NetworkCompatibility (EveryoneMustHaveMod, Minor strictness): every connecting client must have a matching major.minor version of the mod installed or it is rejected at the connection handshake. This guarantees the rule applies to everyone on the server, since the teleport gate is evaluated client-side.
- Adds Jötunn as a dependency.
1.0.0
- Initial release.
- Marks metals/ores/bars/scrap (vanilla and mod-added) as non-teleportable so wood portals refuse them.
- Ashlands stone portal still carries everything (vanilla
m_allowAllItemsbehaviour). - Matching restricted to Material-type items to protect weapons/armour/tools/jewellery.
- Re-scans on ObjectDB.Awake, ObjectDB.CopyOtherDB, and a delayed pass after scene load to catch Jotunn-registered mod items.
- Configurable keywords, extra prefabs, and exclusion list.