Anatta_Labs-NewtSortingChests icon

NewtSortingChests

Press F10 and every chest in your base is sorted: one chest per category, laid out row by row the way you see your shelves, every item in one place. Potion and cooked-food chests stay yours. Companion to SargamAutoStore.

Last updated 2 weeks ago
Total downloads 87
Total rating 1 
Categories Utility AI Generated Client-side
Dependency string Anatta_Labs-NewtSortingChests-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

Anatta_Labs-SargamAutoStore-1.0.0 icon
Anatta_Labs-SargamAutoStore

Smart auto-sorting. Built for performance.

Preferred version: 1.0.0
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

NewtSortingChests

One key, and every chest in your base is in order. Press F10 and NewtSortingChests reads your chests the way you see them, row by row and shelf by shelf, then lays everything out along them, category after category: all the wood together, all the ore next to it, the metals after that; weapons in their own chest, arrows in theirs, raw food far from both. Nothing is ever lost, the game keeps running while it works, and any chest you want left alone, say your potions, stays exactly as you left it.

Made as a companion to SargamAutoStore: it stores what you carry; NewtSortingChests tidies what was stored. Built for Valheim 1.0, confirmed against the game's own item data.

Press F10. Walk the shelves.

Your rows become the order. The mod looks at where every chest stands, which way it faces and how high it sits, and groups them into rows: the chests along one wall on one shelf are one row. Rows are read the way you would read them standing there: the nearest wall first, its top shelf first, each shelf from left to right. Then the categories are laid along that order, so a category always fills a stretch of neighbouring chests, and the next category starts right after it, in the next chest.

  • One chest per category. Weapons never share a chest with arrows; tools never share one with food; wood never sits between two chests of ore. A category that needs more than one chest simply takes the next one too.
  • Every item in one place. All the copper ore is together, all the fine wood is together, split stacks are merged, and inside a chest the items are ordered by category, name and quality, the fullest stacks first.
  • Related things next to each other. Gear first (weapons, shields, bows, ammunition, armour, utility, trinkets, tools, torches, fishing), then food (raw food, crops, seeds), then materials (wood, ore, metal, cores, stone, hides and scales, monster parts, other materials, tree seeds), then valuables, trophies and keys.
  • Chests do not have to be empty. The sort works with the free slots you have, not with whole empty chests: it moves an item straight to its place when there is room, and when its place is full of things that belong elsewhere, it sends those on first. If a base is too full for one chest per category, it falls back to fresh chests only between gear, ammunition, food and materials, and tells you so in the log.

Keep some chests the way you like them

Everything is sorted by default, meads and cooked food included, each in its own chest next to the raw food. If you would rather keep your potions or your cooked dishes exactly where you put them, two settings do that:

  • ExcludeCategories, for example Meads, FoodCooked: those categories are never moved or reordered.
  • ProtectChestCategories, for example Meads, FoodCooked: a chest holding at least two stacks of those categories, making up at least half of what is in it, is a dedicated chest. Nothing is moved into it, it is not reordered, and anything in it that does not belong there is taken out to its proper place. The log names each one, with its position and what it holds.

Safe, and light

  • Nothing is lost or duplicated. Every move uses the game's own chest-to-chest transfer, which adds an item to its new chest before removing it from the old one, and only whole stacks are moved.
  • The game keeps running. The work is spread across frames with a small time budget per frame. On a base of 170 chests, about 2,000 moves take around 40 seconds while you keep playing.
  • Only your storage. Only chests placed by players count (not graves, carts, ships, cooking pots or dungeon chests), never a chest another player has open, never chests inside a ward you cannot use. In multiplayer the sort takes control of a chest the vanilla way before touching it.

Install and try it

  1. Install BepInExPack Valheim and SargamAutoStore (the mod manager does both for you: NewtSortingChests depends on them).
  2. Install NewtSortingChests.
  3. In your base, stand where you usually look at your chests and press F10. The top-left message tells you how many chests were organised; the log (BepInEx/LogOutput.log) tells you the rows it found and the layout it used.

The first sort of a messy base is the big one. After that, a press now and then puts the day's loot where it belongs.

Controls

Key Action
F10 Organise every chest within range (SortKey, modifiers supported, e.g. LeftControl + F10).

Console: nscdump writes every item in the game with the category it is given to BepInEx/NewtSortingChests-items.txt, if you want to check or report a placement.

All settings

Change them in the mod manager's config editor or in BepInEx/config/com.anattalabs.newtsortingchests.cfg; they apply without restarting.

General

  • Range (30 m, 2–256): how far around you the sort key looks for chests.
  • SortKey (F10): the key that starts the sort.
  • ExcludeCategories (empty): categories left exactly where they are, never moved or reordered. Example: Meads, FoodCooked.
  • ProtectChestCategories (empty): a chest mostly holding these (at least 2 stacks, at least half of its used slots) is a dedicated chest: nothing is moved into it. Only categories that are also excluded count. Example: Meads, FoodCooked.

Layout

  • RowDirection (LeftToRight): which way each row is read, as seen from where you stood when you pressed the key. Flip it if your categories run the wrong way along a row.
  • RowOrder (TopFirst): with chests stacked on shelves, whether the top or the bottom shelf is filled first.

Debug

  • DebugDumps (off): write the item list on load and every chest's position and row on each sort to the BepInEx folder. Useful when reporting a problem.

Category names for the lists: Weapons, Shields, Bows, Ammunition, Armor, Utility, Trinkets, Tools, Torch, Fishing, FoodRaw, FoodCooked, FarmCrops, Seeds, Meads, Wood, Ore, Metal, Cores, StoneMinerals, HidesScales, MonsterParts, Materials, TreeSeeds, Valuables, Trophies, MiscKeys.

Works with your other mods

  • SargamAutoStore is required and is the natural partner: it stores what you carry into the right chests, this mod keeps those chests in order.
  • NewtCraftHub crafting from chests, shared chests and /find work as usual on sorted chests.
  • Chests added by other mods are sorted if the game treats them as player-placed chests.

If something doesn't work

  • F10 does nothing: SargamAutoStore must be installed (the log says SargamAutoStore MISSING otherwise); the key is ignored while a chat, console, sign or menu is open; and no chest in range means no sort (the message says so).
  • A category runs the wrong way along a row: set RowDirection to RightToLeft.
  • An item lands in a category you disagree with: run nscdump, find the item's line in NewtSortingChests-items.txt and report its prefab name and the category shown.
  • Items stayed put: the end message says how many and the log says why: no room anywhere in the plan (your chests are full) or blocked (no free slot to move through). Add an empty chest and press again.

New features and bug fixes

1.0.0: first release

  • One key sorts every chest in range: items grouped by category, one chest per category, laid out row by row the way you see your chests, with each item in one place and split stacks merged.
  • Row detection from where the chests stand, how they face and how high they sit; reading order from where you stood; RowDirection and RowOrder to adjust it.
  • Optional: ExcludeCategories keeps chosen categories where they are, and ProtectChestCategories keeps dedicated chests (for example your potion chest) untouched: nothing moved in, strangers moved out, each named in the log.
  • Categories confirmed against the game's own item data (for example the grappling hook is a tool, tankards are decorations, the gold-forge casts are materials, not food).
  • Safe moves only (the game's own transfer, whole stacks), spread across frames so the game never freezes; a base of 170 chests sorts in under a minute at full frame rate.

Credits

For developers

  • Plugin GUID com.anattalabs.newtsortingchests. The pure parts (categories, row detection, the packing plan) have no game dependency and are unit tested, including a test over the real geometry of a 123-chest base.
  • The engine only ever calls the game's Inventory.MoveItemToThis with whole stacks, after CanAddItem for the full stack, so the game's add-before-remove guarantees hold and no remainder is ever left half-moved.
  • Source and issue reports: contact Anatta Labs.

License

MIT. You may use, modify and share it; keep the copyright notice.

Feedback helps shape the next release

Found a placement you disagree with, or a base layout it reads wrong? Send it to Anatta Labs with your game and mod versions, what you did and your LogOutput.log (with DebugDumps on, the two dump files too); leave private server details out of it.