Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
ValheimFarmerNPC
Autonomous goblin farmers for Valheim. Place a homestead, mark your field, assign chests - farmers plant, harvest, and store crops. Multiplayer-safe; server and clients need the mod.
| Date uploaded | a month ago |
| Version | 1.0.17 |
| Download link | Pjanky-ValheimFarmerNPC-1.0.17.zip |
| Downloads | 24 |
| Dependency string | Pjanky-ValheimFarmerNPC-1.0.17 |
This mod requires the following mods to function
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.2333ValheimModding-Jotunn
Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.
Preferred version: 2.27.1README
Valheim Farmer NPC
Autonomous farming NPCs for Valheim. Place a Farmer Homestead, mark your cultivated field with Boundary Posts, assign chests, and let goblin farmers plant, harvest, and store crops while you stay nearby.
| Version | 1.0.17 |
| Author | Pjanky |
| Thunderstore | Pjanky-ValheimFarmerNPC |
| License | MIT |
| Requires | BepInExPack Valheim + Jötunn |
| Install on | Dedicated server and all clients (same version) |
How it works
- The Homestead piece stores all persistent farm data (crop slots, chests, pause state, crop settings) on its network object (ZDO).
- Farmer NPCs are temporary workers that exist while a player keeps the farm zone loaded. They are not permanent world creatures.
- AI runs on the peer that owns the farmer’s network view (
IsOwner()), which keeps multiplayer safe without forcing dedicated-server ownership of every NPC. - If you leave the area and farmers disappear, that is expected. Homestead data and the field remain. Come back, open the Homestead, and use Add Farmer / unpause again.
Talking to a farmer toggles pause/resume for that homestead’s work.
Installation
With r2modman / Thunderstore Mod Manager
- Install BepInExPack Valheim and Jötunn.
- Install Valheim Farmer NPC (
Pjanky-ValheimFarmerNPC). - Use the same profile/mod list on the dedicated server and every client.
Manual
- Install BepInEx for Valheim and Jötunn.
- Copy
ValheimFarmerNPC.dllintoBepInEx/plugins/ValheimFarmerNPC/(server and clients). - Launch once so the config file is created under
BepInEx/config/.
Custom hammer pieces: Farmer Homestead, Farm Boundary Post.
Complete setup walkthrough
Default config only allows admins to place Homestead/Boundary pieces and open the Homestead panel. Set AdminOnlyPlacement / AdminOnlyAccess to false if you want any player to manage farms.
1. Cultivate and plant the initial field (required)
Till the soil and plant every plot you want farmers to work. Scan Field discovers slots from existing crops (saplings and mature plants) inside the boundary — it does not invent slots from bare cultivated ground. After that, farmers harvest and replant those remembered slots.
2. Place the Farmer Homestead
- Open the hammer and find Farmer Homestead.
- Place it near your farm (facing the field is fine; exact facing is not critical).
- Interact with the Homestead to open the Farmer Homestead panel.
Status at the top shows pause state, farmer count, crop slot count, chest count, and whether a boundary is set.
3. Place Boundary Posts
- Place two Farm Boundary Posts at opposite corners of the rectangle that should cover your farm.
- The posts define an axis-aligned box on the ground (XZ). Keep each half-width within
MaxFarmRadius(default 64 m), or scanning will fail.
Tip: Place posts just outside the cultivated plots so every plantable tile is inside the box.
4. Assign Boundary Posts
On the Homestead panel → Field section:
- Click Assign Boundary Posts.
- The mod finds nearby boundary posts and binds them to this homestead.
- Status should show
Boundary: set.
If assignment fails, move closer, ensure both posts exist, and try again.
5. Scan the field
- Click Scan Field.
- The homestead inventories every crop inside the boundary and remembers those positions as farm slots.
- Status Crops count should match the plants you laid out (above zero).
Use Clear Field only when you want to wipe the homestead’s remembered slot list (for a full rescan after big layout changes). It does not destroy plants in the world by itself—re-scan after clearing if you still want farmers to work that field.
6. Assign chests (storage)
Farmers need containers for seeds/harvests.
- Place normal Valheim chests (or compatible containers) near the homestead.
- Click Add chest — assigns the nearest free chest within
ChestAssignRange(default 20 m). - Repeat Add chest until you have enough storage.
- Clear chests unassigns all chests from this homestead (items in the chests are not deleted).
- Chest inventory opens a page listing aggregated contents of assigned chests.
7. Configure crop settings
Open Crop settings.
- The page shows the homestead’s biome (top right).
- Only crops that can grow in that biome appear.
- Unavailable crops are zeroed for planting automatically.
Weights (left column)
Relative planting ratios. Higher weight → planted more often when filling empty slots. Set a crop to 0 to skip planting it (harvest of existing plants can still happen).
Reserves (right column)
Minimum stock kept in the farmer’s bag. For Carrot/Turnip/Onion this is seeds; for Barley, Flax, Jotun Puffs, and Magecap it is the crop item itself (planted like vanilla). When stock falls below the reserve, farmers prioritize growing seed-crops (or restocking) until the reserve recovers.
Click Back when done.
Biome → plantable crops
| Biome | Crops shown / plantable |
|---|---|
| Meadows, Black Forest, Ocean | Carrot, Turnip, Onion |
| Swamp | Turnip |
| Plains | Carrot, Turnip, Onion, Barley, Flax |
| Mistlands | Jotun Puffs, Magecap |
| Mountains, Deep North, Ashlands | None |
Homestead position decides the biome. Fields that straddle biome borders may need the homestead on the side you intend to farm.
8. Add farmers and start work
- Stay near the homestead so the zone stays loaded. Placing a Homestead already spawns one farmer.
- Use Add Farmer for more workers, or if the worker went missing after you left the area.
- Ensure status is Working (not Paused). Use Toggle Pause if needed.
- Farmers will harvest mature crops, plant empty slots according to weights/reserves, fetch materials from chests, and deposit overflow.
Remove Farmer despawns one farmer at this homestead (useful if you added too many). Global cap: MaxFarmers (default 16 across the whole world).
Deposit all forces farmers to empty carried goods into assigned chests when possible.
9. Day-to-day use
- Keep a player near the farm while you want work done.
- Interact with the Homestead anytime to check status, inventories, or crop settings.
- Talk to a farmer to pause/resume.
- After long absences: open Homestead → Add Farmer if none are present → ensure not paused → optionally Scan Field if you changed the field by hand.
Homestead UI pages
Main — Farmer Homestead
Overview and all primary actions.
| Control | Purpose |
|---|---|
| Status text | Paused/Working, farmer count, crop slots, chests, boundary set/missing |
| Toggle Pause | Pause or resume farming for this homestead |
| Add Farmer | Spawn another farmer, or recover one missing after leaving the area |
| Remove Farmer | Remove one farmer from this homestead |
| Deposit all | Push carried items into assigned chests |
| Farmer inventory | Open live bags page |
| Scan Field | Discover/update crop slots inside the boundary |
| Clear Field | Clear remembered slot data (re-scan afterward) |
| Assign Boundary Posts | Bind the two nearby boundary posts |
| Add chest | Assign nearest free chest in range |
| Clear chests | Unassign all chests from this homestead |
| Chest inventory | Browse assigned chest contents |
| Crop settings | Weights, reserves, biome-filtered crops |
| Close | Close the panel |
Crop settings
Two columns for biome-legal food crops only.
| Section | Purpose |
|---|---|
| Biome label | Which biome rules apply at the homestead |
| Weights | Planting ratios (0 = do not plant) |
| Reserves | Minimum seed/crop stock farmers try to keep |
| Back | Return to main |
Empty biomes show a message that no crops grow there.
Farmer inventory
Live view of items in farmer bags near this homestead (aggregated).
| Control | Purpose |
|---|---|
| Status | Farmer count and item-type count |
| List | Icons + stacks |
| Total items | Sum of stacks (footer) |
| Refresh | Reload from current farmers |
| Back | Return to main |
Chest inventory
Aggregated contents of all chests assigned to this homestead.
| Control | Purpose |
|---|---|
| Status | Chest count and item-type count |
| List | Icons + stacks |
| Total items | Sum of stacks (footer) |
| Refresh | Reload from assigned chests |
| Back | Return to main |
Configuration
After first launch, edit:
BepInEx/config/com.farmerjohn.valheimfarmernpc.cfg
On dedicated servers, treat these as server-authoritative for gameplay limits. Restart (or reconnect) after changes as needed.
General
| Setting | Default | Description |
|---|---|---|
| AdminOnlyPlacement | true |
Only server admins may place or remove Farmer Homestead and Boundary Post pieces. |
| AdminOnlyAccess | true |
Only admins can open the homestead panel and change settings. Set false to let any player manage farms. |
| MaxFarmers | 16 |
Hard cap on active farmer NPCs across the whole world/server. |
Farming
| Setting | Default | Description |
|---|---|---|
| MaxFarmRadius | 64 |
Max half-width (meters) of the farm boundary on X or Z. Larger fields fail to scan. |
| DefaultLayoutMode | Weighted |
Planting mode for new homesteads: Weighted uses Crop settings ratios; Fixed replants each slot’s original crop when possible. Changing weights in the UI switches that homestead to Weighted. |
| ScanInterval | 2 |
Seconds between background field refreshes while farmers work (growth / empty-slot detection). |
| ChestAssignRange | 20 |
Max distance (meters) from the homestead when using Add chest. |
Inventory
| Setting | Default | Description |
|---|---|---|
| InventoryCapacity | 20 |
Max distinct item stacks a farmer can carry (not total item count). |
Networking
| Setting | Default | Description |
|---|---|---|
| ReservationTimeout | 30 |
Seconds a harvest/plant slot reservation lasts before another farmer may take it (multiplayer). |
AI
| Setting | Default | Description |
|---|---|---|
| EnableFarmerSounds | true |
Fuling/goblin vocal sounds. Set false to mute farmers. |
| ThinkInterval | 0.5 |
Seconds between AI decision ticks. Lower = more responsive, more CPU. |
| MoveSpeed | 2.5 |
Walking speed when moving between tasks. |
| WorkRange | 2 |
Distance (meters) to harvest, plant, or use a chest. |
Debug / UI
| Setting | Default | Description |
|---|---|---|
| DebugLogging | false |
Verbose AI logs. Can hurt FPS with the console open; leave off for normal play. |
| LogFeedbackToChat | true |
Also write homestead feedback (scan, boundary, chests, farmers, …) to chat. Center-screen messages always show. |
Per-homestead crop weights and reserves are not in this file — they are stored on each Homestead and edited in Crop settings.
Multiplayer notes
- Install the same mod version on server and clients (
EveryoneMustHaveMod). - Homestead data persists in the world save via the piece ZDO.
- Multiple farmers on one homestead share the field; reservations avoid two NPCs claiming the same plant/slot.
- Farmers only work while someone keeps the zone loaded.
Troubleshooting
| Issue | What to try |
|---|---|
| Cannot place Homestead / posts | You are not admin and AdminOnlyPlacement is true. |
| Cannot open panel | AdminOnlyAccess is true and you are not admin. |
| Boundary missing / scan fails | Assign two posts; ensure field size ≤ MaxFarmRadius; posts must form a real rectangle. |
| No crops in Crop settings | Homestead biome has no farmable crops (e.g. Mountains), or scan never ran. |
| Farmers idle | Paused; no empty/mature work; no seeds/materials in bags/chests; zone unloaded. |
| Farmers vanished | Normal when you left the area — Add Farmer again while nearby. |
| Chests not assigned | Move chests closer than ChestAssignRange; use Add chest again. |
Development
Repository: github.com/nico8034/FarmerNPC
# Local Debug build → r2modman Default profile plugins
powershell -ExecutionPolicy Bypass -File ValheimFarmerNPC/scripts/deploy-local.ps1
# Thunderstore zip → ValheimFarmerNPC/dist/
# (bump Plugin.PluginVersion first; update Package/CHANGELOG.md)
powershell -ExecutionPolicy Bypass -File ValheimFarmerNPC/scripts/package-thunderstore.ps1
Also copy Environment.props.example → Environment.props and set VALHEIM_INSTALL for IDE/Jötunn post-build deploy.
Version source of truth: Plugin.PluginVersion in Plugin.cs (semantic versioning: Major.Minor.Patch).
License
Licensed under the MIT License. Valheim is © Iron Gate AB — this mod requires a legitimate copy of the game.
CHANGELOG
Changelog
1.1.1
- Chest assignment uses full 3D position matching so vertically stacked chests can each be added.
1.1.0
Seeds & crops rework plus a reliability fix. Everyone on a server should update to this version.
- Seeds and vegetables can now be balanced independently. Each vegetable (Carrot, Turnip, Onion) has its own row in Crop settings, and so does its seed crop ("Carrot seeds", "Turnip seeds", "Onion seeds"). Give seeds a higher weight than food if you want a steady seed supply (great for feeding chickens), or the other way around for more food on the table.
- Reserves now mean "keep at least this many of what the row makes." A Carrot reserve keeps that many carrots; a "Carrot seeds" reserve keeps that many carrot seeds — so you can stockpile exactly what you care about.
- Farmers automatically keep the cycle going. Even if you set a vegetable's weight to 0, they'll still grow just enough of it to feed seed production, so a "seeds only" setup never runs itself dry.
- Crop settings now lists all vegetables first and their seed crops after, and the page scrolls if a biome has more crops than fit.
- Your existing settings carry over automatically: any "keep N seeds" amount you had set moves onto the matching seed row on first load.
- Fixed farmers gradually leaving plots unworked over time — a fully grown crop could sit on the field forever while empty plots were never replanted (most visible with multiple farmers that occasionally block each other). Abandoned plots are now automatically reclaimed, and a farmer that re-plans always releases its previous claim.
1.0.18
- Revamped the mod page: a clearer intro, a short quick-start, and in-game screenshots of the farmers and each Homestead menu, so it's easier to see what the mod does and how to get going. No gameplay changes from 1.0.17.
1.0.17
- Field progress on dedicated servers is now reliable when you are not the player who "owns" the farm's area. Previously, if another player was controlling the zone, a farmer's harvest/plant progress could fail to save. Farmers now hand that progress to the server, which is the single source of truth for the farm, so what gets harvested and planted always sticks — including when two players share the same farm.
- No change for solo or single-player-hosted games; those already worked and keep using the fast direct save.
1.0.16
- Fixes several problems on dedicated servers introduced in 1.0.15: farmers walking back and forth without working, the field scan not sticking, and only some seeds showing up. Local/solo worlds were unaffected.
- The farm-plot coordination added in 1.0.15 no longer writes to shared farm data on servers (that write was fighting with the server and wiping scan results). Farmers still avoid working the same plot, and the game itself still prevents lost or duplicated crops between players.
- The "save crops on world save" safety net no longer disturbs who controls each farmer on a server, so farmers keep working normally through autosaves.
1.0.15
- On shared servers, two players standing at the same farm no longer send their farmers to fight over the same plot. Farmers now coordinate which plots are claimed with everyone nearby, so they spread out and stop double-planting the same spot.
- Extra safety net against losing crops: every farmer's harvest is now saved to disk whenever the game saves the world (autosave or on exit), closing a small window where a crash could have dropped recent pickups.
- More reliable crediting of harvested crops (carrots, onions, etc.), so odd naming quirks can't cause a just-harvested crop to be miscounted.
- General tidy-up and performance polish under the hood (fewer expensive world scans, updated to current engine APIs, lighter post-harvest pickup checks). No change to how you use the mod.
1.0.14
- Crops no longer go missing when farmers disappear. Harvested crops used to be lost when you left the area, logged out, or when farmers unloaded on a server — especially with more than one farmer. Each farmer now safely keeps its own harvest, so crops survive leaving and coming back.
- Fixed crops occasionally being duplicated right after harvesting (mostly on servers or laggy connections).
- Removing a farmer no longer loses whatever it was carrying — its crops are handed to a remaining farmer first.
- Planting no longer wastes a seed if the plant fails to appear; the seed (or crop) is returned to the farmer.
- Smoother performance while farmers scoop up harvested crops.
- Automatic upgrade for existing farms: the first time you load in after updating, any crops your farmers were still holding are moved into your assigned chests (or kept on a farmer if the chests are full). No action needed.
1.0.13
- Fixed farmers shuttling between field and homestead while harvest/plant work remained (slot refresh no longer mis-marks mature crops as empty or moves slot anchors)
- Plantable-slot checks cover more of the field so a few blocked near plots don't skip the rest
1.0.12
- Sidestep only when crowded by another farmer and not making progress (no more random sidesteps while working)
1.0.11
- Packed chests next to the homestead can all be assigned (match radius was merging neighbors as duplicates)
1.0.10
- Chest assign uses full Container scan again (OverlapSphere was picking a distant chest and skipping nearby ones)
1.0.9
- Dedicated: chest assigns persist on the client-owned homestead ZDO (can assign multiple chests again)
- Only assign real farm chests (
piece_chest*) / carts — ignore dungeon containers - Server homestead saves claim ZDO ownership so fj_chests/slots replicate
1.0.8
- Dedicated field scan runs on the zone client (Physics) and syncs slots to the server
- Restored AABB full-ZDO fallback when iterative prefab lookup misses crops
1.0.7
- Dedicated server field scan finds crops again (ZDO lookup uses Pickable_* world prefabs)
- Dedicated unpause no longer falsely reports "no farmer" on the server
- Farmers rematerialize with FarmerNpc after zone reload; no longer spawn as vanilla Goblin fallback
1.0.6
- Stuck farmers briefly sidestep left/right to clear collisions before failing a task
1.0.5
- Fixed deposit/reserve restock loop (stale bag totals + only restock when still short)
- Chest resolve: OverlapSphere with FindObjectsOfType fallback so assigned chests are not missed
1.0.4
- Newly added farmers start working immediately (no pause/unpause needed)
- Preserve working state across Add Farmer reload; kick AI evaluate on spawn/unpause
1.0.3
- Homestead placement reliably spawns the starter farmer (retries until ready; ignores distant neighbors)
- Unpausing with no farmer nearby shows an on-screen message to use Add Farmer
1.0.2
Performance and AI cleanup.
1.0.1
- Homestead placement spawns one starter farmer; fixed Add/Remove farmer count messages
1.0.0
First public Thunderstore release.