From ca1a62ac799bccfc8c3798cef7d6f4155ce1f3bc Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 23 May 2018 16:17:37 +1000 Subject: [PATCH] Add targetoffset scroll action --- .../object/brush/scroll/ScrollAction.java | 2 ++ .../brush/scroll/ScrollTargetOffset.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTargetOffset.java diff --git a/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollAction.java b/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollAction.java index 8a414ad8..29ccbf41 100644 --- a/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollAction.java +++ b/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollAction.java @@ -64,6 +64,8 @@ public abstract class ScrollAction implements ScrollTool { patterns[i - 1] = WorldEdit.getInstance().getPatternFactory().parseFromInput(arg, parserContext); } return (new ScrollPattern(tool, patterns)); + case "targetoffset": + return (new ScrollTargetOffset(tool)); case "range": return (new ScrollRange(tool)); case "size": diff --git a/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTargetOffset.java b/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTargetOffset.java new file mode 100644 index 00000000..09a864e5 --- /dev/null +++ b/core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTargetOffset.java @@ -0,0 +1,19 @@ +package com.boydti.fawe.object.brush.scroll; + +import com.boydti.fawe.util.MathMan; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.command.tool.BrushTool; +import com.sk89q.worldedit.entity.Player; + +public class ScrollTargetOffset extends ScrollAction { + public ScrollTargetOffset(BrushTool tool) { + super(tool); + } + + @Override + public boolean increment(Player player, int amount) { + BrushTool tool = getTool(); + tool.setTargetOffset(tool.getTargetOffset() + amount); + return true; + } +}