Skip to content

Regex-based type replacement #1813

@octylFractal

Description

@octylFractal

The Problem

It's hard to change the "type" of a colored block. e.g. from all *_wool to *_concrete. It's also not possible to easily "wax" all copper blocks.

A Solution

Since all of the above problems are based on structural replacement of the type string, a nice generic solution is to allow substitution on the type string itself. For example, s/_wool/_concrete could be our pattern syntax to do the aforementioned wool -> concrete swap. It would be used as //set s/_wool/_concrete.

The copper example is a little more complicated due to the naming of it: s/^(cut_)?copper/waxed_$1copper/, to turn any normal copper block into a waxed variant.

Alternatives

Split out dedicated patterns or commands for this. The problem with this is that we'd need to maintain the exact mapping, and it wouldn't allow other flexible replacements.

Anything Else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions