WorldEdit

WorldEdit

42M Downloads

Use a scorebaord for pos1 and pos2, so that datapacks can interact with WE.

mk-pmb opened this issue ยท 4 comments

commented

The Problem

I want a visual preview of my selected area, but WorldEdit CUI isn't updated to MC 1.21 yet. (Edit: It seems it is in fact updated and there was just a huge miscommunication.)

A Solution

The BearEdit datapack has a working selection preview, but lacks many features of WorldEdit. If WorldEdit and datapacks could work together, we could have the best of both. Ideally, the interaction should go both ways: Setting pos{1/2} updates the scoreboard, and updating the scoreboard sets pos{1/2}.

There should probably also be some kind of flag for whether the selection is a rectangular cuboid. For me, that is usually the case; however, datapacks should be encouraged to double-check this if they expect it.

If a datapack tries to set pos2 via scoreboard in a situation where //pos2 <x>,<y>,<z> would fail, the scoreboard command shall fail. From the scoreboard command's possible error reasons listed in MC Wiki, the best fit seems to be "the objective isn't writable".

Allowing datapacks to extend WorldEdit would be useful even after CUI is updated, as it lowers the burden of entry for cool new ideas on how to improve WorldEdit. (I have a few ideas already.)

Alternatives

No response

Anything Else?

No response

commented

No, I don't think we want to maintain something pretty janky like this. We'd need to create some sort of API guarantee and Mojang would likely break that pretty often anyways.

Additionally, there is no single "pos2", as other selection types can have a list of them. So this wouldn't be a full proper solution anyways, as there is no way AFAIK to store an array of things in a scoreboard. And updating a selection off a scoreboard would be even more complicated.

If Mojang were to add a proper variable system or something so we could expose these in a better manner, we might consider it, but this is not it.

commented

Could we maybe have a configurable mini script template with commands that WorldEdit runs each time pos1/2 are set for a rectangular cuboid selection? Then users could use that to notify datapacks in whatever way (e.g. issuing 6 "/scorboard set" commands and one "/function" command) and it would be the user's responsibility to maintain the mini script template they have configured.

Edit: I'll try if I can add this myself.

commented

Running a whole command every time a selection changes would also be very costly. At best I think we would consider exposing events of some kind for selection changes, and someone could add a mod/plugin which maps that to command calls or whatever.

commented

That would probably be a step in the right direction. ๐Ÿ‘