PieceReplacer

v1.1.12·Updated 2026-09-25

Replace compatible Valheim building pieces in place, including connected walls and floors, with safe material and placement validation.

About this mod Author’s original text

PieceReplacer v1.1.9

Quality-of-life replacement modes for Valheim's Hammer.

Single replacement

  • Equip the Hammer.
  • Select the build piece you want to use as the replacement.
  • Aim at an existing compatible build piece.
  • Hold Left Alt and place normally.

The replacement is locked to the old structural slot while rotation stays under normal Valheim player control. Equivalent material prefabs are aligned by their snap-point geometry rather than assuming identical prefab pivots, and the exact visible preview transform is used for the final piece.

Connected surface replacement

v1.1 adds a batch mode for connected planar surfaces such as floors and walls.

  • Select the replacement piece with the Hammer.
  • Aim at one piece of the surface.
  • Hold Left Alt + Left Shift.
  • Review the batch information shown near the bottom of the screen.
  • Left-click to replace the complete connected surface.

A batch only follows pieces that:

  • use the same source prefab as the aimed piece,
  • lie on the same geometric plane,
  • and share an actual snap-point edge with the next piece.

This means a wall around a 90-degree corner is treated as a separate surface and floor tiles that only touch diagonally at one corner are not merged.

The seed preview controls the rotation delta for the complete batch. For example, flipping the preview wall by 180 degrees flips every wall in that selected surface by 180 degrees relative to its previous orientation.

Batch material preview and validation

While Left Alt + Left Shift is held, PieceReplacer displays:

  • number of pieces in the connected surface,
  • source and replacement piece,
  • total material requirement for the complete batch,
  • how much of each material is currently available,
  • missing amounts when the batch cannot be afforded.

The replacement is blocked unless the player has enough material for the entire batch before it starts. Old pieces are refunded only after the new batch has been placed, so refunds are not used to finance a partially completed replacement.

Removal permissions and required crafting-station range are checked for every piece before committing the batch.

Compatibility

Two pieces can replace each other when they are covered by an explicit safe group or when the automatic structural compatibility check accepts them.

Automatic checks use:

  • Piece category,
  • Valheim Hammer usage tags,
  • functional components,
  • local snap-point geometry.

Vanilla beam/pole families additionally have explicit safe compatibility for horizontal 1/2/4 m pieces, 26°/45°/67° angled beams, and vertical 1/2/4 m poles. This avoids false negatives caused by material variants with different local snap layouts.

Safety defaults

AllowBoundsFallback = false by default. Pieces without enough snap points are therefore not automatically matched solely because their visual size happens to be similar.

Connected-surface replacement has a default maximum of 250 pieces. If a surface exceeds that limit the operation is blocked rather than silently replacing only part of it.

Build.\build.ps1

Build and install:.\build.ps1 -Install

Config

Generated at:

BepInEx/config/uk.ainzworth.valheim.piecereplacer.cfg

Important settings:

[General]

ModifierKey = LeftAlt

BatchModifierKey = LeftShift

[Compatibility]

AutoCompatibility = true

RequireSameCategory = true

RequireSameUsageTags = true

SnapPointTolerance = 0.035

AllowBoundsFallback = false

BoundsTolerance = 0.075

[Batch Replacement]

Enabled = true

MaxPieces = 250

ConnectionTolerance = 0.08

PlaneTolerance = 0.12

ShowHud = true

For diagnostics, set DebugLogging = true.

v1.1.1 wall compatibility fix

Straight wall size families now have explicit Vanilla compatibility overrides for:

  • full 2x2 walls
  • half 1x2 walls
  • quarter 1x1 walls

This fixes material replacement cases where equivalent wall variants use different prefab-local snap geometry. Full, half and quarter walls remain separate groups so differently sized walls cannot replace each other.

v1.1.

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.

Dependencies

Install these first, or the mod will not work:

denikson-BepInExPack_Valheim

File & checksum

Filename
PieceReplacer-1.1.12.zip
File size
39.4 KiB