Valheim
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
Downloads
920
Size
56KB
ADDatHost Valheim hosting
30% off

Craft From Container Groups

*this mod was made with AI. I tested everything in game myself and tweaked the design, but the code is done by Ai. This mod was made for me but I figured I'd post it so I can download easier and maybe some people will like it. Please report anything that seems off on the issues page.

Craft, build and feed smelters straight from your chests, but only from the chests you choose.

You put chests, crafting stations and smelters into groups. Things that share a group work together: a forge in the group Forge pulls from chests in Forge, and nothing else. Other people's chests and your decor chests stay untouched. groups will adopt different colors so they can be distinguished.

Made for Valheim 1.0 (BepInEx).


Features

  • Groups instead of "every chest in range". Chests are only used when they share a group with the station, smelter or workbench area you're using.
  • Several groups per object. A chest of wood can serve both Forge and Building.
  • Crafting and upgrading at any station (including "any one of these ingredients" recipes), and building with the hammer, hoe and cultivator.
  • Machines: smelter, blast furnace, charcoal kiln, windmill, spinning wheel, eitr refinery, cooking stations, fermenters, fires/torches/braziers, and shield generators. E with nothing to add takes one from the machine's group; Shift+E fills the slot to capacity, mixing types if needed. Smelter-type machines and shield generators can also be set to Keep filled from chests.
  • A small in-game menu (G) to put things in groups, plus bulk tools for whole storage rooms.
  • Flashing yellow amounts in the crafting and build menus when your chests cover what you're missing.
  • Optional markers and lines that show which chests belong to which group and what pulls from what.
  • Optional ground pickup. Drop a pile next to your storage, and each item goes into a nearby chest that already holds that item, with a little wisp showing where it went.
  • Built to never duplicate or delete items. See Item safety.

Installing

With r2modman or the Thunderstore Mod Manager (easiest)

  1. Open your mod manager and pick your Valheim profile.
  2. Go to Online, search for Craft From Container Groups, and click Download. BepInEx is installed automatically.
  3. Click Start modded.

By hand

  1. Install BepInExPack Valheim if you don't already have it.
  2. Download CraftFromContainerGroups.zip from the Releases page.
  3. Open the zip and copy CraftFromContainerGroups.dll into Valheim/BepInEx/plugins/.
  4. Start the game.

Multiplayer

  • Every player who wants to put things in groups or pull from chests needs the mod. Players without it just see normal chests.
  • The server doesn't need it. Groups are saved on the objects themselves, so everyone sees the same groups.
  • Don't run this together with another "craft from containers" style mod. They change the same parts of the game.

Quick start

  1. Look at your forge and press G. Type Forge and press + New. The forge is now in the group Forge.
  2. Look at a chest with metal and wood and press G. Click Forge so it turns green.
  3. Empty your pockets, open the forge and craft. The materials come out of that chest.

Doing a whole storage room? Look at one chest that's already in the right group, press G, pick 6m under Add nearby to Forge, and press +N on the Containers line.


The G menu

Looking at a chest, crafting station or smelter

Stand within reach of it, as if you were going to press E, and press G.

┌ Forge ─────────────────────────────────┐
│ [Food] [Forge] [Metal]         │ In:   │
│ [Smelting]                     │ Forge │
│ [____________________] [+ New] │ Metal │
│                                         │
│ Add nearby to Forge, Metal: (3m)(6m)(10m)│
│ Containers (12)           [+8]  [-2]    │
│ Crafting stations (2)     [+1]  [-0]    │
│ Smelters & machines (3)   [+3]  [-0]    │
│ [x] Only things I built                 │
└─────────────────────────────────────────┘
  • Click a group to add the object to it or take it out. Green means it's in that group, and the panel on the right lists its groups.
  • + New (or Enter) creates a group and adds the object in one step.
  • Leave 1 of each item in this chest (chests): pulling never takes the chest's last one of anything, so ground pickup still knows what goes there.
  • Pull amount (smelters, kilns, furnaces, refineries, shield generators): type a number and press Pull. The machine pulls that many from its group as it makes room (10 ordered into a smelter at 5/10 = 5 now, 5 more as it smelts), then stops. Ore orders also add just enough fuel. Cancel stops it.
  • Keep filled from chests (smelters, kilns, furnaces, refineries, shield generators): every few seconds the machine's ore and fuel are topped up from its group. Saved on the machine, so everyone sees it. Only the player whose game currently controls the machine feeds it (never two at once), it pauses while your inventory is open, and it needs a free inventory slot because items pass through your inventory like any other pull.
  • Add nearby to ... gives things within 3, 6 or 10 m the same groups (+N) or takes them away (-N). The numbers show how many things each button would change.
  • G again or Esc closes it. While it's open the game ignores its own keys, so typing doesn't open the map or inventory.

Looking at nothing

Press G while not looking at anything:

  • Show group markers: a small, dim ball above each grouped object, one per group, in that group's color.
  • Show what pulls from what: thin lines from chests to the stations and smelters that use them.
  • Chests pick up matching items nearby: turns ground pickup on or off.
  • New chests I build go in: groups that every chest you build joins automatically. Add my N loaded chests to it catches up the chests you already have nearby.
  • Manage groups: rename or delete a group. Everything near you changes right away. The game only lets the mod change things that are loaded, so the rest of your base is updated the next time you're near it. Other players keep their own group list, so tell them about the new name.

Markers and lines are only on your screen and are kept light (only things within 30 m, updated twice a second).


How groups work

You're using... It pulls from...
A crafting station (workbench, forge, cauldron, ...) Chests that share a group with that station
The hammer, hoe or cultivator Chests that share a group with the workbench/station whose build area you're in
Crafting from your inventory (torches etc.) Chests that share a group with stations around you
A smelter, kiln, cooking station, fermenter, fire, shield generator... (E with nothing to add, Shift+E to fill) Chests that share a group with that machine
  • Chests with no group are never used.
  • Stations and machines with no group don't pull from anything.
  • Private chests that aren't yours, chests someone has open, and chests inside a ward you can't use are always skipped.
  • Chests must be within 20 m (setting: Range).

Ground pickup (optional)

Off until you turn it on (G at nothing, or the config).

  • Every few seconds, items on the ground within 10 m of a grouped chest go into that chest, if it already holds at least one of that item.
  • Items you drop yourself are included. That's the point: drop a pile next to your storage and let it sort itself.
  • Only stackable items by default (wood, ore, food, trophies...). Weapons, tools and armor you set down stay on the ground.
  • A small wisp drifts from each item to the chest it went into, and you hear the chest close sound once per batch.

Item safety

Not duplicating or deleting items is the top priority. Here's how the mod avoids it:

  • Items go into your inventory first. Right before a craft, build or smelter feed, the mod moves exactly what you're missing into your inventory. The game's own code then pays for it like normal. If anything fails, the items are simply in your inventory.
  • Unused items go back. If the craft, placement or smelter feed doesn't happen (no room, bad build spot, smelter full), the items return to the chest they came from.
  • Chests are asked for, never grabbed. Valheim only saves changes made by whoever currently "owns" a chest. The mod asks for ownership the same way the game does when you open a chest. The owner sends the newest contents first and refuses if the chest is open.
  • Check first, then move. If your chests can't cover the whole cost, nothing moves. If a move fails halfway, everything already moved is put back.
  • It counts what actually arrived. The game's "add item" can add part of a stack and still say it failed, so the mod counts the real result every time.
  • Nothing silently vanishes. If an item can't go back into its chest, it stays in your inventory, or as a last resort it's dropped at your feet.
  • Open chests are never touched. If what you need is only in a chest someone has open, you're told who ("player is using that chest") and nothing moves.
  • Display numbers can be a moment old; moves never are. The counts in the menus are refreshed a few times a second, but every actual move re-scans and re-reads the chests first.
  • Everything is logged to BepInEx/LogOutput.log as [Transfer] and [Ground] lines.

One thing no mod can prevent: Valheim saves your character on your PC and the world on the server. If your connection drops right after any chest transfer, including one you do by hand, the two can disagree. This mod uses the same steps as a normal chest transfer, so it's never riskier than doing it by hand.


Settings

Change them in game with ConfigurationManager (F1), in r2modman's Config editor, or in BepInEx/config/craftfromcontainergroups.cfg. Most take effect immediately.

Section Setting Default What it does
1 - General Enabled on Master switch
MenuKey G Opens the group menu
Range 20 m How far chests can be for crafting, building and smelters
2 - Groups DefaultGroupsForNewChests (empty) Groups that chests you build join automatically
BulkOnlyMyChests on "Add nearby" only changes things you built
3 - Features PullForCrafting / PullForBuilding / PullForSmelters on Turn each kind of pulling on or off (PullForSmelters covers all machines)
4 - Menu UiScale 0 (auto) Menu size; try 1 to 2
ButtonsPerRow 3 Group buttons per row
5 - Display FlashColor / UnflashColor yellow / white Colors of the flashing amounts
ShowAvailableAmount on Show amounts as available/needed
ShowMarkers / ShowLinks off Markers and lines (also in the G menu)
VisualRange 30 m How far markers, lines and wisps are shown
MarkerBrightness 0.55 How bright markers, lines and wisps are
6 - Safety LogTransfers on Write every move to the log
7 - Ground pickup Enabled off Ground pickup on or off (also in the G menu)
PickupRadius 10 m How far from a chest items are picked up
CheckEverySeconds 1 How often it looks
OnlyChestsInAGroup on Only grouped chests pick things up
OnlyChestsIBuilt off Only chests you built pick things up
IncludePlayerDropped on Include items players dropped
StackablesOnly on Leave weapons, tools and armor alone
ShowWisp / PlaySound on The wisp and the chest sound

Troubleshooting

Nothing is pulled from my chest. Check that the chest and the station share a group: G on each, and look at the In: panel. For building, the workbench you're standing near needs the group. Also check the chest is within 20 m.

"Getting chest access, try again" Another player's game currently controls that chest (usually whoever is standing closest). The mod has asked for it; try again after a second.

"player is using that chest" What you need is only in a chest someone has open. The mod never touches an open chest; try again when they close it.

Ground pickup doesn't take something. The chest needs at least one of that item already, and has to be in a group. The log has a [Ground] line explaining what was skipped and why.

Where's the log? BepInEx/LogOutput.log in your game or r2modman profile folder. In r2modman: Settings → Browse profile folder → BepInEx.

Testing a new version? See TESTING.md for a two-player and bad-connection checklist.

Found a bug? Open an issue and attach your LogOutput.log.


Building from source

You need the .NET SDK (8 or newer), Valheim, and BepInEx in an r2modman profile.

git clone https://github.com/KorThunder4/CraftFromContainerGroups
cd CraftFromContainerGroups
dotnet build -c Release

By default the build looks for Valheim in the standard Steam folder and for BepInEx in the r2modman profile called Default. If yours are elsewhere, create a file named LocalSettings.props next to the .csproj. Git ignores it, so it stays on your PC:

<Project>
  <PropertyGroup>
    <ValheimDir>D:\SteamLibrary\steamapps\common\Valheim</ValheimDir>
    <Profile>MyProfile</Profile>
  </PropertyGroup>
</Project>

Every build:

  • creates CraftFromContainerGroups.zip, a ready-to-upload Thunderstore/r2modman package,
  • copies the DLL into your profile's BepInEx/plugins/KorThunder-CraftFromContainerGroups/ so you can test straight away (close Valheim first). Add -p:Deploy=false to skip this step.

Credits

  • Inspired by aedenthorn's Craft From Containers (public domain), including the idea of flashing requirement amounts.
  • Written with Claude (Anthropic).

License

MIT

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.