Ghoulboy78 / Scarpet-edit

A useful tool for developing decorative builds etc in scarpet.
Creative Commons Zero v1.0 Universal
22 stars 4 forks source link

Should SE try to restore blocks broken while selecting a position? #79

Open altrisi opened 3 years ago

altrisi commented 3 years ago

Currently, when you have a wand different than a sword, or are not in creative mode, you can (unwillingly) break blocks while selecting an area. That behaviour is prevented in WorldEdit, although it's easier in there than here.

As a Scarpet app, currently we can't really "cancel" the break event programmatically, as much we can try to place the exact block that was broken, although any side effects, such as other blocks breaking due to lack of support or updates being sent, would not be restored.

In order to do this properly, it would require the implementation of something like gnembon/fabric-carpet#455, where the app could just state that the event has been "cancelled" (fail?/consumed?/not sure if I got that correctly or it would be another request), and nothing would be triggered from there.

Would it be ok to implement the workaround, should we wait until the language allows us to properly cancel the propagation too, or should we keep it as is?

altrisi commented 3 years ago

Actually, an even better* workaround could be disabling Carpet's interactionUpdates rule when the event is fired, then turning it back on at the end of the tick (supposing the event is launched right at the starts, which I think is the case? not checked).

However, that could break horribly, mostly in multiplayer, if other players break things in the same tick where the wand is used, or if the player breaks more than a block a tick, although I think that's not possible without autoclickers? (and would probably use the wand anyway, I guess?).

Firigion commented 3 years ago

I agree we should hackfix this until the scarpet language suppports cancelling events (if). I also think that doing it through interactionUpdates is risky, I'd just replace the broken block (if any), and let it be an imperfect solution for stuff like blocks with no support breaking and such.