# Use a WorldEdit mask to replace one block type without touching its neighbours

A broad replace can damage decoration that shares a similar colour or shape. A mask lets you constrain a change to identified source blocks. Start with an exact block type and a small selection rather than combining several filters during the first test.

## Work through the change

1. Pick a short wall containing the block you want to replace and at least one neighbouring material you intend to keep. Record the selection corners and current block counts.
2. Read the mask syntax for your WorldEdit release. Use a simple material filter first; block state, negation and combined expressions need their own controlled checks.
3. Apply the replacement once within the small region. Stay in the same world and do not enlarge the selection until you have inspected both sides of the wall.
4. Compare the source count, replacement count and untouched neighbour count. If a session-wide mask was set, clear or record it before issuing an unrelated editing command.

## Check the result

Only the selected source material should change. A zero-change report may indicate a mismatched block state or an older global mask, rather than a permission failure. Inspect actual block names instead of guessing from their appearance in a resource pack.

Write the exact source material identifier beside the tested selection. Two blocks that share a texture may have different identities, and one block can have several states. Change only one filter at a time so a zero-result operation has a useful diagnostic meaning.

## Recover or stop safely

Undo the most recent edit and confirm the original materials return. Restore the previous mask state if you changed a session-wide setting. For a larger job, keep the small tested command in your change notes rather than expanding it from memory.

## Related guidance and maintainer reference

For the broader setup, read [Use WorldEdit selections, limits and undo safely](https://help.cloudexa-hosting.com/books/game-hosting/page/use-worldedit-selections-limits-and-undo-safely). Check the installed plugin version before applying syntax from the [official WorldEdit documentation](https://worldedit.enginehub.org/en/latest/usage/general/masks/).