You are viewing a potentially older version of this package. View all versions.
KorThunder-CraftFromContainerGroups-0.9.0 icon

CraftFromContainerGroups

Craft, build and feed smelters from chests you put in groups. Multi-group chests, bulk tagging, markers, optional ground pickup. Item-safe.

Date uploaded a month ago
Version 0.9.0
Download link KorThunder-CraftFromContainerGroups-0.9.0.zip
Downloads 74
Dependency string KorThunder-CraftFromContainerGroups-0.9.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2351 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.2351

README

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, and fires/torches/braziers. E with nothing to add takes one from the machine's group; Shift+E fills it.
  • 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 & processors (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.
  • 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.

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... (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 ("Ree 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/korvo.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.

"Ree 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 by KorThunder with Claude (Anthropic).

License

MIT

CHANGELOG

Changelog

0.12.0

New

  • Pick what Pull amount pulls. On machines that take more than one kind of item (like the smelter, blast furnace and ballista, and modded machines or recipes that add more):
    • Up to three item icons follow Pull: what its chests have in range, with how many, most first. Click one to pull only that; click it again to pull anything, like before.
    • The arrow button opens every item the machine takes in a panel beside the menu, with how many its chests have. Items they don't have are faded.
    • The pick is saved on the machine, so it's still picked next time, and whoever's game runs the order pulls the same thing (with this version).
    • While an order runs, the row shows what it's pulling: "Pulling 20 more Copper Ore". The machine's hover text says it too.
    • A ballista loaded with a different ammo waits until it's empty before an order for the picked ammo starts.
    • Machines that take only one kind of item (in the base game: windmill, spinning wheel, charcoal kiln, eitr refinery) show no icons.
    • Keep filled, E and Shift+E still take anything. The charcoal kiln still never takes Fine Wood or Core Wood from chests.

0.11.0

New

  • Groups are saved with your character, not in the settings file. Switching mod profiles, or installing a modpack update that replaces the settings, keeps your groups as long as you play the same character. This covers your groups (private and public), groups shared with you and who you shared with, default groups for new chests, and renames still waiting to reach far-away chests. Settings like Range and keys stay in the settings file.

    • Updating: the first character you load without groups of its own takes the groups from the settings file. They're removed from the settings file once the game saves that character, so other characters start fresh.
    • Each character has its own groups: another of your characters doesn't see your private groups unless they're shared with it.
    • Groups are written to the character file when the game saves it (logging out, sleeping, autosave), like your inventory.
    • A copy of each character's groups is kept in BepInEx/config/CraftFromContainerGroups/. When a character loads with older groups than the copy, or none (after restoring a character backup from before the update, for example), the copy puts them back.
  • New look for the G menu, in the game's dark wood and gold, with the game's font for headings when it's available.

    • Each group is a rounded button in its marker color; filled with a check mark means it's in that group. The separate "In:" list is gone.
    • On/off options are switches with a one-line explanation, grouped under This chest, Fill from chests and Cooking. Pullable from PlanBuild moved under This chest.
    • Add nearby is a compact table; group buttons wrap to fit, so the ButtonsPerRow setting is gone.
    • Looking at nothing: groups for new chests are clicked like any other group buttons, and Manage groups is always shown.
    • Hide a group shared with you, or another player's public group, under Manage groups. It stays in that list but no longer shows as a button, except on things already in it. Nothing else changes: it isn't deleted and keeps working.
    • A close button in the corner; G and Esc still close it.
    • Sized from the game's own menus: follows screen resolution and the game's GUI scale setting. A menu too tall for the screen shrinks to fit instead of running off the bottom.

Fixes

  • A chest or drawer could stay "in use" forever on a server. The game only clears a chest's "open" mark on the PC controlling it at that moment, so a chest that changed hands while open stayed marked. Now a chest only counts as open when it's open in your own inventory screen, or when the game controlling it just said no.
  • Item drawers another player or the server controls (RossItemDrawers) showed "Getting chest access" forever. Drawers don't answer the game's request to open them, so the mod now takes control of a drawer the way the drawers mod asks other mods to, then waits until control has settled (about a second). Press again a moment later.
  • A game controlling a chest no longer refuses other players because of a leftover "open" mark on that chest. This helps when the player controlling the chest also runs this mod.
  • The G key didn't close the menu after typing in Pull amount (it only works as a letter while typing a group name). Now it always closes the menu unless a name box is being typed in.
  • The charcoal kiln never takes Fine Wood or Core Wood from chests (E, Shift+E, Keep filled, Pull amount), only regular Wood. Both are for building; they can still be put in by hand.

Other

  • When E or Shift+E on a machine finds nothing to pull, the log says why for each item it takes: the nearest chest in its groups and how far (against Range), or which groups the nearest chest with it is in.
  • The [Ground] log line names the items no chest would take, and which chests were left out and why (built by someone else, in no group, open, cart or ship in use).

0.10.1

New

  • Carts and ships pick up items from the ground, like chests: put them in a group, and they take items they already hold at least one of. Custom carts and ships that use the normal storage work too.
    • A ship picks up while you're sailing it, or while nobody is aboard. With someone else aboard, it's left alone.
    • A cart picks up while you pull it, or while nobody is pulling it.
  • Mod compatibility section at the bottom of the settings, for options that only matter alongside other mods. Everything in it is off by default.
    • KeepChestAmountsVisible: for mods that change the crafting or build panels (ZenUI, for example). Turn it on if the flashing yellow chest amounts don't show when a recipe or piece is selected.
    • EpicLootEnchantingTable (on): Epic Loot's enchanting table can be put in groups with G. While its window is open, chests sharing a group with it pay for its materials: enchanting, augmenting, converting, disenchanting, runes and table upgrades. Your inventory is used first. Only materials: items stored in chests can't be sacrificed or changed at the table. Does nothing without Epic Loot.
    • PlanBuildPlans (on): PlanBuild's plan pieces can take materials from chests switched to Pullable from PlanBuild (new switch on the right of a chest's G menu). Only those chests are used, and only when they share a group with the workbench you're near. Hold E pulls up to what that one piece still needs; E pulls one item when you carry none of its materials. Whatever the plan doesn't take goes back. Does nothing without PlanBuild.

Fixes

  • Carts and ships you built count as yours for Only chests I built, Only things I built and private groups.
  • Pulling for crafting or building never asks for a cart someone else is pulling or a ship someone else is aboard, so it can't take the cart or ship away from them.
  • Works alongside backpack and storage mods. When your inventory, or storage another mod adds (an equipped backpack, for example), already covers a craft or a build, chests aren't touched and that mod pays the way it normally does. Building near a grouped workbench is no longer refused when the materials are in that storage.

Faster

  • Dropping an item, moving one or crafting no longer redraws the crafting list a second time right after the game redraws it. With many recipes (big content mods), each redraw was a noticeable hitch.
  • With no grouped chests in range, changes to your inventory never redraw the crafting list.
  • Chest scans skip out-of-range and ungrouped storage before looking inside it.
  • Working out which chests to get ready while a menu is open goes through every recipe only when your inventory or station changes.
  • Ground pickup only looks through chests when an item on the ground could actually be stored.

0.10.0

New

  • Private groups. New groups are private: other players with the mod don't see them, can't use them, and can't put things in them or take things out.

  • Share a group: look at a player and press G. "Add to groups" shows your groups as buttons; click one to share it with that player (it turns green), click again to stop. Players you share with can use the group and add or remove things they built. Only you can rename, delete or share it.

    • Not tested with two players yet. Two-player testing is planned for the next few updates.
  • Renaming a private group is instant everywhere (things store the group's id, not its name).

  • Groups from before are public. Make my public groups private under Manage groups converts them.

  • Audit log (log only, LogOtherPlayers in the Logs section). [Audit] lines for what other players' games do near you:

    • your chests (grouped, or built by you) changing while another game controls them: what came and went, whose game, and how far away that player was;
    • smelter-type machines and shield generators: ore queued and fuel added by another game, with a warning when the ore isn't something that machine accepts in a normal game;
    • cooking stations and ovens: food put on or taken off while another game controls them;
    • network messages your game doesn't understand: who sent them and to what (a mod on the sender's game).
  • Logs section at the bottom of the settings: LogTransfers, LogOtherPlayers, and KeepLogBetweenSessions (on by default), which keeps LogOutput.log when the game restarts instead of starting a new one, so a problem from earlier can still be looked up or sent with a bug report. It sets BepInEx's own AppendLog setting and works from the next launch; the file keeps growing while it's on. Each session starts with a line showing the date and time.

  • Ballistas: put them in a group and E loads a bolt from the group's chests, Shift+E fills them, and Keep filled / Pull amount work too. A ballista holds one kind of ammo at a time, so a fill only takes the kind already loaded (or, if empty, the first kind your chests have).

  • Drop food when done (cooking stations and ovens, in their G menu): finished food is pushed out the front the moment it's cooked, so it never burns. With ground pickup on, it goes straight into a chest that holds that food.

Fixes

  • Changing groups (or Keep filled, Pull amount, Leave 1) on something another player's game controls didn't stick when that player doesn't have this mod. It now takes effect for you right away, the menu shows "Saves when <player> leaves", and it's saved on the object as soon as your game controls it.
  • Shift+E on fires and torches stopped one short when your game controlled the fire.
  • Changing a thing's groups never removes other players' private groups from it.
  • Audit lines say "your game" instead of "You's game".
  • Menus update live. While the crafting menu or a build menu (hammer, hoe, cultivator...) is open, what you can make updates as you move: walk out of range of the wood chest and wood things grey out, walk back and they light up again. Same when you run out of an item, when chests change, or when you leave a grouped workbench's area. No more closing and reopening.

Faster

  • Ground pickup works out once per check which chests hold which items, instead of searching every chest for every item on the ground.
  • Chest checks and ground pickup do less work every frame.
  • The audit log only watches your own chests.
  • With the crafting menu or a build tool out, the mod only asks for control of chests that hold something you're actually missing, instead of every grouped chest in range. Other players keep their chests longer.

Other

  • Settings: LogTransfers moved from "6 - Safety" to "7 - Logs", and Ground pickup is now "6 - Ground pickup". Your values carry over.
  • Groups set with 0.9.0 or older that were never re-saved since are no longer read. Those things just show no group (items are not affected); add them to their group again. The pre-0.9.1 settings file is no longer copied over.

0.9.5

  • Leave 1 of each item (per chest, in the chest's G menu): crafting, building and machines never take a chest's last one of anything, so ground pickup still knows what belongs there.
  • Pull amount (smelters, kilns, furnaces, refineries, frost kiln, shield generator): type a number and press Pull. It pulls that many from the group over time, as the machine makes room, then stops. Ore orders also add just enough fuel to smelt them. The hover text shows how many are still to come; Cancel stops it.
  • Audit log (with LogTransfers on): for smelter-type machines your game controls, [Audit] lines record every ore added and whose game added it, every item finished, and whenever control of a machine passes to another player. Useful for finding out what another mod is doing to your machines.

0.9.4

  • Rename and delete groups: G while looking at nothing, then Manage groups. Things near you change right away; things elsewhere in your base change the next time you're near them.

0.9.3

  • Shield generators can be put in groups. E with nothing to add takes bones from the group; Shift+E fills it.
  • The G menu's "Smelters & processors" line is now "Smelters & machines" and includes shield generators.
  • Shift+E now fills the slot to its capacity from chests, mixing types (copper, then tin, then iron scrap...) instead of stopping when the first type runs out. It no longer stops one short.
  • New Keep filled from chests checkbox in the G menu for smelters, kilns, furnaces, refineries, windmills, spinning wheels and shield generators. Every few seconds the machine is topped up from its group (ore and fuel). Only one player's game feeds a machine, and it pauses while your inventory is open.

0.9.2

  • Fixed: recipes you can craft from chests no longer show greyed out after crafting something.
  • Fixed: Shift+E on smelters and kilns now fills them instead of adding one.
  • Grouped machines show a "Shift + E Fill from chests" hint when you look at them.

0.9.1

  • New internal plugin ID; the settings file is now craftfromcontainergroups.cfg. Your old settings are copied over automatically, and existing group assignments are kept.
  • Players need the same version to set groups on objects another player controls.

0.9.0

  • More machines: cooking stations, fermenters, and fires/torches/braziers pull from their group. The G menu's bulk tools have new "Cooking & brewing" and "Fires & lights" lines.
  • Shift+E fills smelters, kilns, cooking stations and fires to capacity from their group. Whatever doesn't fit goes back to the chests.
  • "Any one of these ingredients" recipes now pull from chests too.
  • "player is using that chest": when what you need is only in a chest someone has open, you're told who.
  • Faster in big bases: menu counts are cached for a fraction of a second; actual moves always re-check the chests first.
  • Machines you're looking at get their chests ready in the background, so the first E usually works straight away.

0.8.0

  • Ground pickup shows where items went: a small wisp drifts to the chest, and the chest close sound plays once per batch.
  • Items players drop are now picked up too (IncludePlayerDropped).
  • Ground pickup has its own radius (PickupRadius, default 10 m). By default it uses any chest in a group, whoever built it.
  • Adding items to chests and inventories now counts what actually arrived, since the game can add part of a stack and still report a failure.

0.7.0

  • Optional ground pickup: chests pick up nearby items they already hold.

0.6.0

  • Bulk tagging: give nearby containers, crafting stations or smelters the same groups (3/6/10 m).
  • Default groups for chests you build, plus a button to catch up existing chests.
  • Game keys are ignored while the G menu is open.
  • Finds machines whose parts sit on separate pieces of the model.

0.5.0

  • Group markers and "what pulls from what" lines (only on your screen).
  • The G menu shows an object's groups on the side; hover text removed.
  • Pulled items go back to their chest if the craft, placement or smelter feed doesn't happen.

0.4.0

  • Objects can be in several groups; things that share a group work together.
  • Simpler, smaller G menu.

0.3.0

  • Rebuilt pulling for item safety: items move into your inventory before the game's own code runs, chest ownership is requested the vanilla way, and every move is checked, logged and undone on failure.
  • Flashing yellow requirement amounts with available/needed.

0.2.0

  • First version.