You are viewing a potentially older version of this package. View all versions.
DrakosDJ-PrefabHammer-1.1.7 icon

PrefabHammer

An advanced tool to save, name, manage, and build custom multi-piece structures in Valheim using manual green pulsating highlights or radius selections.

Date uploaded 3 weeks ago
Version 1.1.7
Download link DrakosDJ-PrefabHammer-1.1.7.zip
Downloads 103
Dependency string DrakosDJ-PrefabHammer-1.1.7

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

Prefab Hammer

Prefab Hammer is an advanced construction utility for Valheim. It allows players to capture custom build combinations (prefabs/blueprints) directly from their existing structures, name them, manage them in a catalog, and build them using standard resource calculations.

Features

  • Manual and Area Capturing: Select pieces individually using precise green outlines, or fall back to a radius area save.
  • In-Game Blueprint Trading: Swap saved custom structures directly with nearby players over the network.
  • Inline Catalog Renaming: Organize and rename your custom prefabs dynamically within the Library Catalog.
  • Stability Support Calculations: Custom designs automatically calculate structural integrity upon placement.
  • Undo History: Revert mistakes cleanly, automatically refunding construction materials at their original spots.
  • Zero Alt-Tab Lag: Captures and places large structures in small background batches across frames to prevent freezes.
  • Seamless MovingDay Compatibility: Shares the exact same selection pool in memory if the MovingDay mod is active.

Usage Guide

1. Capturing and Saving a Blueprint

  • Manual Selection: Equip the Hammer, look at any building piece, and press J to add it to your selection. Selected pieces highlight with a pulsating green overlay.
  • Clearing Selection: Press Shift + J or Ctrl + J (or press J while aiming at empty air) to clear the active selection.
  • Saving: Press K to open the Save Dialog. Enter a name for your custom prefab and click Save Combo.
  • Area/Radius Fallback: If you open the Save Dialog (press K) without selecting any pieces first, the mod automatically captures all pieces within a radius of the targeted crosshair.

2. Managing the Library Catalog

  • Opening the Catalog: Press Delete or Shift + K to open the Prefab Manager directly to the Library Catalog tab.
  • Renaming a Blueprint: In the Library Catalog list, click Rename next to any blueprint. Type the new name and click Save to update the template file and menu instantly.
  • Deleting a Blueprint: Click Delete next to any blueprint, and click Confirm? to permanently delete the blueprint.

3. Building and Undoing Placements

  • Placing a Blueprint: Open your hammer build menu, navigate to the Prefab tab, select your saved blueprint, and build it like a normal piece.
  • Batched Construction: Large blueprints build automatically over multiple frames to prevent game freezing. A progress message (e.g. Placing MyBase... 45/120) will show on screen.
  • Undoing a Placement: If you make a mistake, press Shift + U to open the Undo History tab. Click Undo next to the placement you want to revert. All pieces will be removed, and building materials will drop at the original piece locations.

4. In-Game Blueprint Trading

  • Initiating a Trade:
    • Open the Prefab Manager (press K or Shift + K) and select the Trade Window tab.
    • You will see a list of nearby players (within 10 meters) who have the mod active.
    • Click Invite to Trade next to their name. (A 30-second cooldown applies to prevent spam).
    • An interactive invitation popup will open on the other player's screen. If they are in combat or dead, the invite is auto-declined.
  • Exchanging Blueprints:
    • Once the invite is accepted, the trade screen opens for both players.
    • Click Add + in the My Offer column to select blueprints from your library.
    • Blueprints that the other player already owns are highlighted in yellow as [Already Owned] and cannot be added.
    • Click Lock Offer when satisfied with your offer. Note: Any modifications to offers after locking will force both locks to open for safety.
    • After both players have locked, click Accept Trade to transfer the files. Payloads are compressed using Gzip and securely transferred.
  • Safety Interrupts:
    • The trade instantly cancels and closes the GUI if either player enters combat, dies, moves out of the 10m range, or disconnects.

Compatibility with MovingDay

If you also have the MovingDay mod installed, they will automatically work together:

  • Shared Selection: They share the exact same selection pool in memory. Highlighting a structure with PrefabHammer's select keys will immediately make it targetable by MovingDay's move keys, and vice versa.
  • Coordinated Highlights: Selecting pieces in one mod keeps them visually highlighted, and clearing the selection in either mod cleans up both mods' highlight overlays.

Keybinds (Configurable)

  • J: Toggle manual piece selection (must hold Hammer).
  • Shift + J or Ctrl + J: Clear the current selection.
  • K: Open save panel / Prefab Manager.
  • Delete or Shift + K: Open Library Catalog directly.
  • Shift + U: Open Undo History tab.

Chat Commands

  • /prefabsave [name] [radius]: Save the hovered structure (or current selection) as a new blueprint.
  • /prefablist or /prefablibrary: Open the Prefab Manager to the Library tab.
  • /prefabreload: Reload custom blueprints from disk.
  • /prefabdelete [name]: Delete a saved blueprint by name.
  • /prefabinspectorigin [radius]: Inspect and categorize all entities near world origin (0, 0, 0) with their exact distances in meters.
  • /prefabcleanorigin [radius]: Clean up orphaned dummy containers, loose item drops, or standard building pieces near world origin (0, 0, 0). Note: Also sweeps up standard building pieces within 5m of the altar.

Installation

Prefab Hammer requires BepInEx to run.

  1. Install BepInExPack Valheim.
  2. Place PrefabHammer.dll into the BepInEx/plugins/ directory (or download directly via r2modman).

Configuration

You can customize the mod's behavior by editing BepInEx/config/com.prefabhammer.cfg (or using the in-game Configuration Manager / r2modman's Config Editor).

General

  • Enabled: Enable or disable the mod on the fly (default: true).
  • BuildCategory: The build menu category tab where your custom prefabs are loaded (default: Prefab). Can be set to vanilla tabs like Misc, Crafting, Building, or Furniture.
  • DefaultRadius: Capture radius in meters for the fallback area save (default: 5.0).

Keybinds

All hotkeys use BepInEx's native click-to-bind system. In the in-game configuration manager, click the keybind button and press the key combination you want — no need to type key names.

  • SaveHotkey: Open the save panel (default: K).
  • SelectHotkey: Toggle piece selection (default: J).
  • ManagerHotkey: Open the Prefab Manager to the Library tab (default: Left Shift + K).
  • UndoHotkey: Open the Prefab Manager to the Undo History tab (default: Left Shift + U).

Performance

  • PlacementBatchSize: Number of pieces placed per frame during batched building (default: 10). Lower values reduce stuttering on slower hardware.
  • MaxUndoHistory: How many recent placements are kept in the undo history (default: 5).

Upgrading from v1.0.7 or earlier: Delete your old com.prefabhammer.cfg file to let BepInEx regenerate it with the new keybind format. The old string-based key entries are not compatible.

Discord

Join our Discord Server for discussion, suggestions, and bug reports!

CHANGELOG

Changelog

v1.2.0

Updated to comply with the Valheim v1.0 (1.0.7) update.

  • Valheim 1.0 (1.0.7) Compatibility:
    • Full compatibility with the new build menu system, combat checks, and native piece rotation controls.
    • Seamless co-existence with other popular building and category mods.
  • New Build Menu Integration:
    • Added a dedicated Prefabs tab directly to the hammer build menu for quick and easy access to all your saved blueprints.
    • Saved prefabs also naturally appear in relevant categories across the menu (such as Walls, Roofs, Furniture, and Material tabs) alongside regular pieces.
    • Fully supports live search and piece filtering in the build menu.
  • Blueprint Progression & Unlocking:
    • Saved and imported blueprints unlock naturally on your hammer as you discover the crafting recipes for their required building pieces.
    • When you learn the recipe for the last required piece in a blueprint, the game notifies you with the standard "New Piece" discovery banner.
    • In Free Build / creative mode, all blueprints remain immediately accessible and ready to build without restrictions.
  • Ghost Preview & Visual Polish:
    • Cleaned up ghost placement previews so prefabs no longer appear covered in snow or weather wear when aiming in non-snowy biomes.
    • Placed prefabs naturally collect snow and weather effects as intended once built in snowy or exposed environments.
    • Fixed ghost placement alignment, snapping, and component preview rendering.
  • Stability & Performance:
    • Resolved piece selection issues where choosing a custom blueprint could occasionally fail to activate or select an incorrect piece.
    • Streamlined piece loading to prevent world load freezes, crashes, or missing pieces when switching characters.
    • Improved multi-piece undo responsiveness and refunded piece management.

v1.1.9

  • Chest Crafting Mod Integration (True Component Loadout):
    • Requirement badges now automatically detect and reflect combined resource totals ([Player Inventory + Nearby Chests]) provided by active container mods such as ValheimPlus (CraftFromChest), CraftFromContainers, AzuCraftyBoxes, and similar container-crafting utilities.
    • Cleanly falls back to personal bag inventory if no container-crafting mod is installed.
  • Enhanced Badge Display Format (<needed> / <have>):
    • Formatted requirement counts to display as <needed> / <have> across all badges.
    • Full-line color coding: displays in solid Green (#55ff55) when requirements are satisfied (or in Free Build), and solid Red (#ff4444) when ingredients are still needed.
    • Enabled dynamic TextMeshPro auto-sizing and adjusted badge dimensions (104x46px) to prevent large resource quantities (e.g. 15000 / 20000) from wrapping or clipping.
    • Crafting stations render with clear <color=#55ff55>Ready</color> or <color=#ff4444>Missing</color> indicators.
  • Unified Free-Build Deconstruction Protection:
    • Blueprints placed while Free Build (NoCostCheat or server NoBuildCost) is active are automatically tagged with a persistent network identifier (PH_FreeBuild).
    • Completely prevents free-built blueprint parts from dropping raw materials when deconstructed, seamlessly covering PrefabHammer Undo (Shift + U), manual hammer demolition (middle-click), and damage collapse—even across game restarts and server save/reloads.

v1.1.8

  • Visual Multi-Row Requirement Grid:
    • Replaced the unreadable small-text requirement description dump with a dynamic, visual requirement grid displaying all required materials for blueprints and complex prefabs.
    • Automatically expands HUD requirement slots beyond the native 4-slot limit (supporting 60+ materials) without truncating resources or crashing.
  • Enlarged Icons & Item Names:
    • Each requirement item is displayed as a clean mini-card badge (96x46px) featuring an enlarged icon (38x38px), localized item name, and bold color-coded quantity badge (white/red for owned vs required counts).
    • Crafting station requirements are neatly displayed at the end of the grid with status indicators (Ready in green or Missing in red).
  • Interactive Drag & Custom Positioning:
    • Hold Shift (or your configured drag modifier key) and Left-Click Drag over the requirements display to freely move it anywhere on your screen. The new position is automatically saved to the configuration file.
    • Added UI.RequirementsPositionX and UI.RequirementsPositionY configuration settings for precise coordinate adjustments.
    • Added Keybinds.RequirementsDragKey setting to customize the drag modifier key (supports LeftShift, LeftControl, LeftAlt, None, etc.).
  • Unobtrusive & Non-Blocking Design:
    • Positioned cleanly below the selected prefab title/icon header with a solid, high-contrast dark background (rgba(20, 20, 28, 0.95)) to eliminate visual bleed-through.
    • Set raycastTarget = false so mouse clicks and placement raycasts pass seamlessly through to the game world without UI click-blocking.

v1.1.7

  • In-Game Blueprint Trading: Added a secure client-to-client trading window allowing players to share custom blueprints directly in-game.
    • Proximity & Verification: Automatically checks for nearby players (within 10m) with the mod active.
    • Spam Prevention: Implemented a 30-second trade invite cooldown.
    • Combat & Death Safety: Auto-declines or cancels trades instantly if either player dies or enters combat.
    • Double-Lock Protection: To prevent ninja-swapping, any changes to an offer unlock both players' trade locks. Both players must lock their offers and click Accept to transfer files.
    • GZip Compression: Network payloads are compressed with GZip before transfer over routed RPCs.
    • Duplicate Hash Verification: Deterministic SHA-256 fingerprinting analyzes blueprints; duplicates already owned by the receiver are disabled in the trade catalog list.
  • Inline Blueprint Renaming: Added the ability to rename stored blueprints directly in the Library Catalog tab. Checks for invalid characters and existing files before rewriting internal JSON metadata and reloading.

v1.1.6

  • Origin Cleanup Enhancement: Updated the /prefabcleanorigin command to also sweep up standard building pieces (like walls, pillars, or floors) if they are sitting within 5 meters of the exact center of the start altar. Note that this will also remove any player-built convenience items (like portals or campfires) if placed directly on the altar.

v1.1.5

  • Reliable Prefab Placement: Fixed a timing issue that could cause blueprint placement to silently fail or spill building resources on the ground. Placed structures now reliably build all their sub-pieces at your targeted crosshair every single time.
  • Complete Undo Cleanup: Fixed an issue where undoing a structure placement left behind hidden background data, ensuring that undoing a placement cleanly removes all pieces from the game world without leaving behind stray objects or causing lag at the start altar.

v1.1.4

  • Versioning issue.

v1.1.3

  • Performance & World Origin Lag Fix: Fixed an issue where repeatedly placing and undoing prefabs caused hidden object data to build up at the Summoning Stones (world origin), resulting in severe stuttering, lag spikes, and long loading screen freezes when entering the area.
  • Clean Structure Undo: Undoing a placed structure now cleanly removes all sub-pieces from both your screen and the world database without leaving behind phantom objects or accidental resource drops.
  • Off-World Template Storage: Blueprint templates are now safely stored off-world out of sight so master templates no longer clutter the start altar or affect game performance.
  • Origin Cleanup & Inspector Commands: Added chat commands /prefabinspectorigin (to inspect objects near the start altar) and /prefabcleanorigin (to clean up old stray items or leftover objects at the altar in existing world saves).

v1.1.2

  • Hammer Menu Compatibility & Layout Conflict Fix: Fixed a UI layout conflict with other mods that modify the build menu (such as Jotunn and HammerTime). PrefabHammer will now automatically detect if another mod has configured the category tabs using a GridLayoutGroup (used for wrapping custom tabs) and gracefully yield layout management to it. This prevents the original category tabs from collapsing into narrow vertical lines and ensures seamless integration with all custom build categories.
  • Enable/Disable Configuration Toggle: Added a General.Enabled configuration setting. This allows players to fully disable or enable the mod's features, input listeners, selection outlines, and custom "Prefab" build category tab on the fly in-game without needing to restart the game.

v1.1.1

  • MovingDay Selection Synchronization: Fixed an issue where manually selecting/deselecting pieces in PrefabHammer was not synchronized with MovingDay's internal ZDOID list, causing selections to be silently lost, deselections to fail, and running totals to display incorrectly. Selection/deselection actions are now fully reciprocal and synchronized across both mods.
  • Clear Selection Hotkey: Added support to clear the active selection across both mods. Pressing the select key (J by default) while holding Shift or Control, or pressing it while targeting empty space, will instantly clear the selection.
  • Save GUI Focus Input Block: Fixed a bug where entering a name in the Save prefab dialog hijacked keystrokes and triggered selection actions in MovingDay if the name contained hotkey characters. MovingDay now checks input eligibility and blocks inputs while typing in the UI.

v1.1.0

  • Build Menu Height Adjustments: Fixed an issue where adding a second row of category tabs pushed the bottom row of build options off the bottom of the screen. The selection menu and its background frames now dynamically expand in height by 35px when the custom tabs are active, and restore when they are inactive.
  • Container Item Dropping on Undo: Placed structures containing chest or other container components now drop their stored items into newly spawned wooden cargo crates (CargoCrate objects) upon performing an Undo operation, preventing any items from being lost.

v1.0.9

  • Fixed Offline/Singleplayer Spawner Execution: Fixed an issue in the origin-spawning protection where players with a creator ID of 0 (common in offline play and local test characters) would trigger early-return exits. This caused placed prefabs to render overlapping parent visual meshes (creating a "damaged" texture look due to z-fighting) and bypassed Undo list registration.
  • Native Valheim Placement Hook: Reimplemented the spawner check using Valheim's native IPlaced interface, ensuring that only legitimate player placements trigger the blueprint spawning routine while completely bypassing problematic player ID/name checks.

v1.0.8

  • Fixed Origin Spawning Bug: Fixed a critical issue where cloning the custom prefab for icons, menu renders, or asset loads caused the spawner script to execute incorrectly, instantiating the entire blueprint at the world origin (0, 0, 0). Added active local player and non-zero creator ID checks to ensure spawning only happens on real player placements.
  • MovingDay Compatibility: Added seamless selection synchronization with the MovingDay mod. If both mods are installed, they will automatically share the exact same selected pieces list. Highlighting pieces in one mod allows you to use the other mod's functions (e.g. moving a PrefabHammer selection, or saving a MovingDay selection as a prefab). Both mods will correctly clean up highlight overlays when selections are cleared or deselected.
  • Click-to-Bind Keybinds: All hotkeys now use BepInEx's native keybind system. In the in-game configuration manager, click a keybind button and press the desired key combination to set it — no more typing key names manually.
  • Dedicated Manager Hotkey: Opening the Library tab now has its own configurable keybind (ManagerHotkey, default: Left Shift + K) separate from the save key.
  • Modifier Keys Per Binding: Each hotkey can now have its own modifier key combination instead of sharing a single global modifier. Set any combo (e.g., Ctrl+J, Alt+U) per binding.
  • Keybinds Config Section: All hotkey settings are now grouped under a dedicated [Keybinds] section in the config file for easier organization.
  • ⚠️ Existing Configuration: If you are upgrading from v1.0.7 or earlier, your existing keybind settings (SaveHotkey, SelectHotkey, UndoHotkey, ModifierKey) will no longer work because they used the old string-based format (e.g. K, LeftShift). To fix this, delete your BepInEx/config/com.prefabhammer.cfg file and relaunch the game — BepInEx will regenerate it with the new keybind entries and defaults.

v1.0.7

  • Batched Placement: Large blueprints are now built in small batches across multiple frames, eliminating freezes when placing structures with hundreds of pieces. A progress message displays during placement (e.g. "Placing MyBase... 30/120").
  • Undo Placement (Shift+U): Undo recently placed blueprints. Opens the manager directly to the Undo History tab where you can select a placement to remove. Materials are refunded by dropping them at the original piece locations.
  • Structural Integrity: Placed structures now correctly calculate structural integrity after construction completes. Hover pieces with the hammer to see stability colors as expected.
  • Improved GUI: Restyled the manager window to match Valheim's wooden/medieval aesthetic with gold text and recessed dark panel backgrounds for scrollable lists.
  • New Configuration Options (found in com.prefabhammer.cfg):
    • PlacementBatchSize (default: 10) — Number of pieces placed per frame. Lower values reduce stuttering on slower hardware.
    • MaxUndoHistory (default: 5) — How many recent placements are kept in the undo history.

v1.0.6

  • Fixed IndexOutOfRangeException in Hud.SetupPieceInfo when selecting custom prefabs for placement.
  • Appended a complete total cost requirement list (with player inventory counts color-coded) to the piece description panel in the HUD when a custom prefab's requirements exceed the available display slots.

v1.0.5

  • Removed excessive log spamming.

v1.0.4

  • Fixed issues with the new Prefab tab not appearing correctly and some weird interactions with other mods that added new tabs to the build hammer menu.

v1.0.3

  • Added Dedicated Build Tab ("Prefab"): All your custom saved structures will now be loaded under the category tab defined in the configuration (defaults to the new dedicated "Prefab" tab).
  • Update Notice: If you are updating from a prior version, your existing configuration file may still point to "Misc". If you wish to use the new dedicated tab to store and organize your designs, please change the BuildCategory setting in your configuration file (com.prefabhammer.cfg) to "Prefab".
  • PieceTable Sizing: Implemented runtime memory array expansion for PieceTable to handle the new category index safely without crashes.
  • Improved UI Integration: Integrated with the vanilla category navigation so players can cycle to and click the new "Prefab" tab naturally.

v1.0.2

  • Fixed Saving & Persistence: Refactored the spawner instantiation path to use standard Unity instantiation. Placed custom prefabs now naturally register their ZDOs as persistent, meaning they save and load correctly when logging out and back in.
  • Fixed Build Sound & Particle Effects: Added code to copy the placement effects (m_placeEffect) from the first sub-piece to the custom composite piece. placing a custom prefab now plays the hammer hits and wood/stone dust particles.
  • Fixed Mod Icon Validation: Converted the mod icon to a true 256x256 PNG format, resolving the Thunderstore validation error.
  • Naming Migration: Completed full name migration from ModularHammer to PrefabHammer internally and externally.

v1.0.0

  • Initial release of PrefabHammer.
  • Support saving, naming, and building custom multi-piece structures in Valheim.
  • Pulsating direct-cloned green selection outlines conforming to piece shape.
  • Library dashboard to manage and delete custom prefabs with instant Valheim build menu refresh.