WorldEdit icon indicating copy to clipboard operation
WorldEdit copied to clipboard

Fix left click on air being ignored and right click on block being handled twice

Open Yeregorix opened this issue 1 year ago • 0 comments

Left click on air

Bukkit: Left click on air was already detected properly. Sponge: Added a listener for InteractItemEvent.Primary. Forge and Fabric: The click is detected using the swing arm packet. Sponge and Spigot are using this same technique. Sponge and Spigot are doing raytracing to ensure it's a click on air and not on a block but in our case we don't need to do raytracing, just deduplication.

There was a workaround on Forge where the mod if installed on the client would notify the server about the click. This workaround is no longer needed and has been removed.

Right click on block

The right click on a block was handled twice because a RightClickBlock event is always followed by a RightClickAir event on all platforms. To fix this, Event handlers store the tick number during which the last interaction occured and ignore air interactions that are too close (tick delta <= 1).

This mechanism is active for both left and righ clicks.

Yeregorix avatar Jul 23 '22 21:07 Yeregorix