Xaritomi-ValheimMagnet icon

ValheimMagnet

Client-side toggleable item magnet: auto-pickup reaches further. No harvesting. Works on any server.

Last updated 3 days ago
Total downloads 73
Total rating 0 
Categories Tweaks Client-side Utility AI Generated
Dependency string Xaritomi-ValheimMagnet-1.0.1
Dependants 0 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2360 icon
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.2360

README

ValheimMagnet

A client-side BepInEx 5 plugin for Valheim 1.0.x. It extends the game's own auto-pickup radius, and you can turn it on and off with a hotkey.

What it does

  • While the magnet is on, auto-pickup reaches up to Radius metres instead of the vanilla ~2 m.
  • It only picks up items that vanilla auto-pickup would already take: items that spawn in the world (mob loot, logs, stone, ore and so on), but not items you drop yourself, which vanilla never auto-picks up. The game's own checks still apply: weight, inventory space, item ownership and so on.
  • It respects the game's own auto-pickup toggle. If vanilla auto-pickup is off, the magnet does nothing.
  • Press the hotkey to toggle it. A message in the centre of the screen shows Magnet: ON (8 m) or Magnet: OFF, and the state is saved to the config.

What it does NOT do

  • It does not harvest. Berries, mushrooms, flint, crops and other pickables are left alone.
  • It does not touch containers, plants or anything you would normally have to interact with.
  • It does not change vanilla's own pickup range. Turn it off and you get exactly vanilla behaviour.
  • It does not check line of sight (vanilla doesn't either), so items behind walls inside the radius get pulled too.

Client-only

The plugin only affects your own player and sends nothing over the network. It works on any server, including vanilla dedicated servers, and nobody else needs to install it. It does not load on a dedicated server.

Install

  1. Install BepInExPack for Valheim (BepInEx 5).
  2. Copy ValheimMagnet.dll into Valheim/BepInEx/plugins/.
  3. Start the game. The config is created at BepInEx/config/valheimmagnet.cfg.

Config ([General])

Key Default Notes
Enabled true Magnet on/off. Saved when you toggle it with the hotkey.
Radius 8 Pickup radius in metres while the magnet is on, clamped to 2–25.
ToggleKey Period Toggle hotkey; modifiers are supported, e.g. Period + LeftShift.

The hotkey does nothing while chat, the console, a text field, a menu, the inventory or the map is open.

Build from source

Source: https://gitlab.com/xaritomi/valheim-magnet

You need the .NET 8 SDK.

git clone https://gitlab.com/xaritomi/valheim-magnet.git
cd valheim-magnet
dotnet build -c Release

The output is bin/Release/net48/ValheimMagnet.dll.

Game, Unity and BepInEx reference assemblies come from NuGet (Digitalroot.Valheim.Common.References, BepInEx.Core, UnityEngine.Modules) and are used only to compile. They are not shipped with the plugin. Game DLLs are copyrighted: never commit them to this repo.

The references target Valheim 1.0.x. A build against the 0.221.x references compiles, but throws MissingMethodException on the live game.

Manual in-game test

  • [ ] Press . (Period): the message Magnet: ON (8 m) appears. Press it again: Magnet: OFF appears.
  • [ ] Magnet on: kill a mob (or fell a tree, or mine a rock), step about 6 m away from the drops, and they get pulled in. Items you drop yourself stay put, as in vanilla.
  • [ ] Magnet off: items only get picked up within about 2 m, as in vanilla.
  • [ ] Turn vanilla auto-pickup off: nothing is picked up, even with the magnet on.
  • [ ] Bushes, mushrooms and other pickables stay where they are when you walk past with the magnet on.
  • [ ] Typing an l in chat or the console does not toggle the magnet.
  • [ ] After you die and respawn, the magnet still works and the toggle state is unchanged.
  • [ ] After you log out and back in, it still works.
  • [ ] Join a vanilla dedicated server: the plugin works and the server does not complain.

License

MIT, see LICENSE.

AI disclosure

This mod's code, documentation and icon were written with the help of an AI assistant (Claude), then reviewed and tested in-game by the author.