Valheim
Install with App

Details

Latest version
1.0.1
Last Updated
First Uploaded
Downloads
103
Likes
0
Size
48KB
Dependants
ADDatHost Valheim hosting
€1

Valheim Auto Sort Chests

BepInEx mod for Valheim that adds a Sort button to every container (chest) window, between the game's own "Take all" and "Place stacks" buttons.

Clicking it:

  1. Merges identical item stacks into as few stacks as possible (same rule the game itself uses to decide if two items can stack).
  2. Lays out the remaining items in a consistent order: by item type, then alphabetically by name.

A chest after sorting: stacks merged and grouped

Unofficial mod. This is a fan-made mod, not affiliated with or endorsed by Iron Gate. It marks your game as modded (the game shows this in the main menu), as Iron Gate asks mod authors to do.

Requirements

  • Valheim (tested on 1.0.15)
  • BepInEx 5.4.x

Installation (players)

  1. Install BepInEx for Valheim if you haven't already (see link above, or use r2modman).
  2. Download AutoSortChests.dll from the latest release.
  3. Drop it into <Valheim install folder>\BepInEx\plugins\AutoSortChests\.
  4. Launch the game and open any chest - you'll see the new "Sort" button.

Upgrading from 0.1.0: the DLL used to be called Mod3-AutoSortChests.dll. Delete the old BepInEx\plugins\Mod3-AutoSortChests\ folder after installing the new version (the mod keeps no data there).

Building from source

Requires the .NET 8 SDK (or newer) and a local Valheim install with BepInEx installed.

git clone https://github.com/Ab5oluteZer0/valheim-auto-sort-chests.git
cd valheim-auto-sort-chests
dotnet build -c Release -p:ValheimPath="C:\Path\To\Valheim"

If you don't pass -p:ValheimPath, the build looks for a VALHEIM_PATH environment variable, then falls back to the default Steam location (C:\Program Files (x86)\Steam\steamapps\common\Valheim).

The build automatically copies the built DLL into <Valheim>\BepInEx\plugins\AutoSortChests\ for quick in-game testing.

How it works

A Harmony postfix on InventoryGui.Awake clones the existing "Stack All" button to create the new "Sort" button (same style, correctly anchored), positioned between "Take All" and "Stack All". Sorting operates directly on Inventory.GetAllItems() (the live internal list) and reassigns each item's grid position - no reflection into private container internals needed beyond one field lookup for the currently-open container.

Support

All my mods are free and will stay free. If you enjoy them and want to say thanks, you can leave a voluntary tip via PayPal - it doesn't unlock anything, it just helps me keep making mods.

License

MIT - see LICENSE.

DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro