From 29cb59e88188fae5fdf31eeb0b13cf858ae64693 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sun, 14 Jul 2024 23:02:05 +0200 Subject: [PATCH] //brush deform: Add inputExtent parameter and separate in/outputTransform for deformRegion --- .../com/sk89q/worldedit/function/factory/Deform.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java index ff05b2966f..fd239218d7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.extent.InputExtent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.EditContext; @@ -127,23 +128,26 @@ public Operation createFromContext(final EditContext context) { final Transform transform = TransformUtil.createTransformForExpressionCommand(mode, min, max, offset); LocalSession session = context.getSession(); + EditSession editSession = (EditSession) context.getDestination(); return new DeformOperation(context.getDestination(), region, transform, expression, - session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout()); + session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout(), editSession.getWorld(), transform); } private record DeformOperation( Extent destination, Region region, - Transform transform, + Transform outputTransform, Expression expression, - int timeout + int timeout, + InputExtent inputExtent, + Transform inputTransform ) implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { try { // TODO: Move deformation code final EditSession editSession = (EditSession) destination; - editSession.deformRegion(region, transform, expression, timeout, editSession.getWorld(), transform); + editSession.deformRegion(region, outputTransform, expression, timeout, inputExtent, inputTransform); return null; } catch (ExpressionException e) { throw new RuntimeException("Failed to execute expression", e); // TODO: Better exception to throw here?