WorldEdit

WorldEdit

42M Downloads

Using mask with multiple block tags doesn't work

oskarkk opened this issue ยท 13 comments

commented

Versions
WorldEdit version: Bukkit-Official(7.1.0;8e55131)
Platform version: git-Spigot-ae72bf4-183139d (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) (newest)

Describe the bug
Matching more than one block category doesn't work and is treated as multiple command arguments.

While trying to find a way around this trying everything I came up with, I also stumbled upon the second error which printed a long java error.

To Reproduce
Just do something like //copy -m "##fences,##logs". It will give "too many arguments" error.

For the second error I found I tried: //move 3 east -m "##fences" -m "##logs", but it will give the same result even without tags, e.g. //copy -m dirt -m grass
Error:

[23:24:33 ERROR] An unexpected error while handling a WorldEdit command
java.lang.IllegalArgumentException: Multiple entries with same key: ArgAcceptingCommandFlag{description=TextComponentImpl{content=Set the include mask, non-matching blocks become air, children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, name=m, argumentName=TranslatableComponentImpl{key=mask, args=[], children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, types=[Key{type=com.sk89q.worldedit.function.mask.Mask, annotationWrapper=NullAnnotationWrapper}], defaults=[]}=CommandValueImpl{manager=org.enginehub.piston.impl.CommandManagerImpl@577deb, commandContextSupplier=org.enginehub.piston.impl.CommandParser$$Lambda$4051/414638444@1da2f0c6, partContext=ArgAcceptingCommandFlag{description=TextComponentImpl{content=Set the include mask, (...)

Expected behavior

Maybe this is more of a feature request, but I think that combining block categories seamlessly would be an expected behavior, as negating a block category just works. Intersection of block tags works too (//copy -m "##logs ##fences"). If it isn't an expected behavior, WE shouldn't treat it as two arguments and it should print some nice error message that joining two block categories cannot be done.

For the second part (//copy -m dirt -m grass), it should just print "too many arguments".

commented

I need to run //replace !#solid,##leaves,##logs on a very large selection, it exceeds the character limit if I list every block in the game. Are there any Minecraft mods, similar to Worldedit, that support this kind of operation?

commented

For your specific case, you could just use "!#solid !##leaves !##logs. Doing the inverse is much more difficult, as it would require defining your own tag.

commented

Sorry, I think my original comment wasn't very clear. I want the mask to include all non-solid blocks and leaves/logs (union between non-solid, leaves, and logs). Can you please explain how I can define my own tag?

commented

It's outside the scope of WorldEdit, try https://minecraft.wiki/w/Tutorials/Creating_a_data_pack.

commented

Thanks for your help!

commented

Screenshot_20200411_174630
in dev build now

commented

Screenshot_20200411_184052
screenshot 2, electric boogaloo

commented

not a bug so much as a shortcoming of the mask parser.
as far as re-using the mask flag, that's an entirely separate issue. should probably make the message nicer though.

commented

##fences,##logs is an invalid mask, so although the error isn't clear it makes sense that it is rejected. Specialized error messages are a feature request, though I'm not sure how well it matches with the current design of argument parsing.

Supporting ##fences,##logs is part of a bigger mask/pattern refactor that has been on the backlog for a while. We're not really sure how we want to handle mixing arbitrary masks yet.

Two -m is unsupported, should probably make a more graceful error message though.

commented

Okay. There is also a side-effect of treating that invalid mask as two arguments: in a command like //move 3 east -m "##fences,##logs" it treats ##logs as a "replace" argument, which is quite unexpected and should be fixed.

commented

So if I want to make a brush that turns trees into air, how do I do it?

I'd like to be able to do:

/br set sphere 5 air
/mask ##logs##leaves

But this doesn't work. So how is it supposed to be done?

commented

it's not, as mentioned in the preceding comments.

commented

I assume you missed this line from my comment:

Supporting ##fences,##logs is part of a bigger mask/pattern refactor that has been on the backlog for a while. We're not really sure how we want to handle mixing arbitrary masks yet.

This is still on the backlog.