From bf3b91aaa791c93269cd03e410f9937938343b6c Mon Sep 17 00:00:00 2001
From: Pieter12345
Date: Mon, 28 Oct 2019 15:02:24 +0100
Subject: [PATCH] Fix stack command diagonal shifting with -s flag
Fix `//stack -s [num]` shifting the selection to unexpected places. This fix causes `//stack -s [num]` behavior in diagonal directions to be consistent with the behavior in non-diagonal directions, which means that the last stack will be selected.
---
.../main/java/com/sk89q/worldedit/command/RegionCommands.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
index 65c1c2f50..2aa18962f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
@@ -373,9 +373,9 @@ public class RegionCommands {
if (moveSelection) {
try {
- final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
+ final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
- final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint();
+ final BlockVector3 shiftVector = direction.multiply(size).multiply(count);
region.shift(shiftVector);
session.getRegionSelector(world).learnChanges();