From 41073bb1a0f73c58308cad13c9206ca16ed67831 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 10 Jul 2021 19:47:39 +0100 Subject: [PATCH] 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 --- .../worldedit/function/operation/ForwardExtentCopy.java | 3 ++- .../com/sk89q/worldedit/math/transform/AffineTransform.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 83b259e1c..4a164fc64 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -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); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java index 3129e9c66..68c7344e2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java @@ -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;