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
| Last updated | 15 hours ago |
| Total downloads | 97 |
| Total rating | 1 |
| Categories | Server-side Client-side AI Generated |
| Dependency string | Baka_Gaijin-PortalMetalLock-1.5.1 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
denikson-BepInExPack_Valheim
BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.
Preferred version: 5.4.2333ValheimModding-Jotunn
Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.
Preferred version: 2.29.0README
PortalMetalLock
Keep metals where they belong. Metals, ores, bars, and scrap — vanilla and mod-added — can no longer be carried through normal (wood) portals. The Ashlands stone portal (the "advanced" portal) still carries everything, exactly like vanilla.
Why
Vanilla already blocks vanilla metals from wood portals, but many content mods add their own ores/bars and leave them teleportable, quietly undoing that restriction. PortalMetalLock closes that gap: it scans the item database (including items registered late by Jotunn-based mods) and flags matching materials as non-teleportable, so wood portals refuse them again.
How it works
Valheim wood portals refuse to teleport a player whose inventory holds any non-teleportable item. The Ashlands stone portal sets m_allowAllItems, which the game checks before the per-item test, so it keeps carrying everything with no extra handling.
This mod simply sets m_teleportable = false on matching items. Matching is restricted to items of type Material, so weapons, armour, tools, and jewellery (e.g. SwordBronze, SilverNecklace) are never affected — only raw metal/ore/bar/scrap.
Configuration (server-authoritative — locked on clients)
All settings are admin-only and synchronised from the server via Jötunn. When connected to a server, the server's values are pushed to every client and locked — players cannot edit their local config to make metals teleportable again. Only the server admin can change these (edit baka.PortalMetalLock.cfg on the server while it is stopped, or via the in-game Configuration Manager as an admin):
| Setting | Default | Description |
|---|---|---|
| Enabled | true |
Master switch. When on, matching materials are made non-teleportable. |
| MetalKeywords | copper,tin,bronze,iron,silver,blackmetal,flametal,ore,scrap,ingot |
Comma-separated, case-insensitive substrings. Any Material whose prefab name or localized name contains one is blocked. |
| ExtraPrefabs | (empty) | Comma-separated EXACT prefab names to also block, for mod metals the keywords miss. Use VNEI in-game to find exact names. |
| ExcludePrefabs | BronzeNails,LeatherScraps |
Comma-separated EXACT prefab names to never touch (false-positive guard). |
After changing keywords/prefabs on the server, reload the world (or restart) so the item database is re-scanned.
Server enforcement
This mod uses Jötunn's NetworkCompatibility at level EveryoneMustHaveMod with Minor version strictness. When it runs on a dedicated server, every connecting client must also have PortalMetalLock installed at a matching major.minor version — clients that are missing the mod or on a mismatched version are rejected at the connection handshake with an error screen. This guarantees the rule is enforced for everyone on the server, not just players who happen to have it.
(The teleport gate itself is evaluated client-side, so without this enforcement a vanilla/missing-mod client could otherwise carry mod metals through. EveryoneMustHaveMod closes that gap.)
Requirements
- BepInEx
- Jötunn (for the server-side enforcement handshake)
Notes
This is a personal quality-of-life / rules mod. It only flips a per-item teleport flag; no world data, recipes, or items are otherwise changed. Safe to add or remove at any time.