FastAsyncWorldEdit

FastAsyncWorldEdit

152k Downloads

Not working with Cannons

LcyDev opened this issue · 9 comments

commented

Server Implementation

Purpur

Server Version

1.16.5

Describe the bug

When using Cannons, it completely breaks when loading cannon designs.
This breaks Fawe too, and this causes worldguard to misbehave, having lag protecting, errors with flags, etc.
Specially breaking protection against lecterns, empty item frames and paintings.
It did work fine in 1.13, so it could work in 1.16 too.

To Reproduce

  1. Download FAWE, any version above 1.13
  2. Download WorldGuard 1.16
  3. Download Cannons 1.16
  4. Start the server and the issue is BUSTED in the logging.
  5. Cannons, FAWE and WorldGuard are now misbehaving.

Expected behaviour

Work just fine, like worldedit.

Screenshots / Videos

No response

Error log (if applicable)

https://paste.gg/p/anonymous/38abe37f8e42462b9bbcc0629b15a703

Fawe Debugpaste

https://athion.net/ISPaster/paste/view/8aa8a777b7174e3997502661b717ce3f

Fawe Version

1.17-391;4272f96

Checklist

Anything else?

No response

commented

For reference, please link the issue you've risen at "Cannons" issue tracker.

commented

The main issue here is that the saving-to-clipboard code in Cannons is incredibly poorly implemented. The only reason it "works" with WorldEdit is because WE checks that the clipboard's region contains the block location attempting to be added, and will not save the block to the clipboard if it's outside the clipboard region. Cannons is loading a schematic from disk into a clipboard and not checking the regions match between the stored schematic and the region it's attempting to save, at all.

Implementing a "fix" or check into FAWE would slow down clipboard writing, when the actual issue is because of incorrect usage of clipboards.

commented

Will this be fixed or do I have to do it on my own?

commented

Cannons does not write to the schematic, it only loads designs from the clipboard. However, the error might occur during translation of the clipboard using the Worldedit Transform method.
https://github.com/DerPavlov/Cannons/blob/0b14460eaa313240b03c005dcec1c3a8c1ebd901/src/main/java/at/pavlov/cannons/cannon/DesignStorage.java#L399

I assume that Worldedit handles the new schematic dimensions, I have no clue how FAWE handles this operation internally.
The part can be modified if needed, but I would require an example.

AffineTransform transform = new AffineTransform().translate(cc.getMinimumPoint().multiply(-1));
BlockTransformExtent extent = new BlockTransformExtent(cc, transform);
ForwardExtentCopy copy = new ForwardExtentCopy(extent, cc.getRegion(), cc.getOrigin(), cc, BlockVector3.ZERO);
copy.setTransform(transform);
try {
      Operations.complete(copy);
} catch (WorldEditException e) {
       e.printStackTrace();
}
GitHub
Fire block based Cannons in Minecraft. Contribute to DerPavlov/Cannons development by creating an account on GitHub.
commented

that's writing to the clipboard... https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/main/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java#L116

You're copying from the clipboard with a transformed location and then just writing straight back to the clipboard. As stated WE does not "handle the new dimensions" it simply returns false as the block is outside the clipboard dimensions and thus is not written. It fails silently.

commented

I changed the code and FAWE seems to be happy with it. Thanks to SebasSV for pointing this out
https://www.spigotmc.org/threads/rotate-clipboard-in-worldedit-api-7-0-1-13-2.407940/

ClipboardHolder clipboardHolder = new ClipboardHolder(cc);
clipboardHolder.setTransform(new AffineTransform().translate(cc.getMinimumPoint().multiply(-1)));
cc = clipboardHolder.getClipboard();
commented

Thank you all!
I'm going to test it.

UPDATE: (It works)