More exact testing for scaling/flipping in AffineTransform and only combine transforms when not equal in ForwardExtentCopy

- Fixes #1162
 - Also fixes rotation in x/z axes
This commit is contained in:
dordsor21 2021-07-10 19:47:39 +01:00
parent 338be0ff31
commit 41073bb1a0
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 5 additions and 4 deletions

View File

@ -279,6 +279,8 @@ public class ForwardExtentCopy implements Operation {
public Operation resume(RunContext run) throws WorldEditException {
if (currentTransform == null) {
currentTransform = transform;
} else if (!currentTransform.equals(transform)) {
currentTransform = currentTransform.combine(transform);
}
if (lastBiomeVisitor != null) {
affectedBiomeCols += lastBiomeVisitor.getAffected();
@ -406,7 +408,6 @@ public class ForwardExtentCopy implements Operation {
}
if (transExt != null) {
currentTransform = currentTransform.combine(transform);
transExt.setTransform(currentTransform);
}

View File

@ -306,13 +306,13 @@ public class AffineTransform implements Transform, Serializable {
return true;
}
// Check for flip-and-rotate
if (vector.getX() != 0 && vector.getY() != 0 && m01 != 0 && m10 != 0) {
if (vector.getX() != 0 && vector.getY() != 0 && ((m01 < 0 && m10 < 0) || (m01 > 0 && m10 > 0))) {
flip = true;
}
if (vector.getX() != 0 && vector.getZ() != 0 && m02 != 0 && m20 != 0) {
if (vector.getX() != 0 && vector.getZ() != 0 && ((m02 < 0 && m20 < 0) || (m02 > 0 && m20 > 0))) {
flip = !flip;
}
if (vector.getY() != 0 && vector.getZ() != 0 && m12 != 0 && m21 != 0) {
if (vector.getY() != 0 && vector.getZ() != 0 && ((m12 < 0 && m21 < 0) || (m12 > 0 && m21 > 0))) {
flip = !flip;
}
return flip;