WorldEdit

WorldEdit

42M Downloads

Translating a clipboard doesn't copy the BlockData correctly

AsyncVoid opened this issue ยท 1 comments

commented

Versions

WorldEdit version: 7.2.0-beta-02
Platform version: paper-1.13.2

Describe the bug

When translating a clipboard, rotating it then translating it back again to rotate it around its center, the blockdata is not present.

To Reproduce

I am trying to rotate a 16xYx16 schematic around the Y axis at the exact center point.
I am doing this by:
AffineTransform transform = new AffineTransform();
transform = transform.translate(7.5d, 0, 7.5d);
transform = transform.rotateY(90f);
transform = transform.translate(-7.5d, 0, -7.5d);
holder.setTransform(holder.getTransform().combine(transform));
I translate it 7.5 blocks because 7.5 is half of 15, the midpoint of the clipboard as blocks are numbered 0-15.
It is then rotated, then put back to where it should be.
The blocks end up in the right place, however the blockdata does not appear present.
If I do not translate and just rotate then the blockdata is present as expected.

Expected behavior
The blockdata should be copied to the right place.

Screenshots
What happens: image
What should happen: image

Additional context
This presumably happens with other floating-point translations?
I can't set the origin of the clipboard to the exact middle because BlockVector3 only accepts integers.
Fast-mode doesn't effect outcome.
EDIT:

transform = transform.translate(8, 0, 8);
transform = transform.rotateY(90f);
transform = transform.translate(-8, 0, -8);

Also does not preserve BlockData. It seems to be a problem with translate in general

commented

as discussed in discord the code here is fundamentally wrong as the translations are affected by the rotation of the transform.