EngineHub / WorldEdit

🗺️ Minecraft map editor and mod
https://enginehub.org/worldedit/
Other
3.05k stars 826 forks source link

Allow signs to maintain text AND position/direction with //replace or //replacenear #2546

Open QuietWindUponTheMoor opened 4 weeks ago

QuietWindUponTheMoor commented 4 weeks ago

The Problem

I would like to replace a bunch of signs of one type, with another type. In this case, I would like to replace spruce signs with bamboo signs.

Using a state-applying-pattern (^) did not seem to work: //replacenear 200 minecraft:spruce_wall_sign ^minecraft:bamboo_wall_sign (For replacenear), or, for strict replace: //replace minecraft:spruce_wall_sign ^minecraft:bamboo_wall_sign

This is because sign text is NBT metadata and not covered by state-applying-pattern.

A Solution

Add functionality to com.sk89q.worldedit.function.pattern.TypeApplyingPattern to also keep NBT data, or add another pattern that allows for this to be an option when replacing blocks.

Currently, BaseBlock I was told does not have any NBT data so I'd assume this would require some modifications to how the TypeApplyingPattern class operates.

Alternatives

The only other way I can personally think of that make the process I'm trying to accomplish here to be somewhat quicker than just manually re-doing all of the signs, is going through this process, using EssentialsX:

  1. Use /editsign copy
  2. Break the old sign, place the new sign off the desired type [in this case, a bamboo sign]
  3. Use /editsign paste to paste the text back onto the new sign

This is extremely tedious and almost as slow as just doing all of the signs over by hand again.

Anything Else?

No response

me4502 commented 4 weeks ago

The main problem here is that NBT data cannot just be arbitrarily placed on any block. We have no way of knowing what will happen if we put the NBT data from one block onto another, and doing so could cause various major issues if it isn’t happy with it

QuietWindUponTheMoor commented 4 weeks ago

The main problem here is that NBT data cannot just be arbitrarily placed on any block. We have no way of knowing what will happen if we put the NBT data from one block onto another, and doing so could cause various major issues if it isn’t happy with it

Is there not a way to do this for signs only and only maintain text data?