Skip to content
Permalink
Browse files

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.
  • Loading branch information
Pieter12345 committed Oct 28, 2019
1 parent 21f3d96 commit bf3b91aaa791c93269cd03e410f9937938343b6c
Showing with 2 additions and 2 deletions.
  1. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
@@ -373,9 +373,9 @@ public int stack(Actor actor, World world, EditSession editSession, LocalSession

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();

0 comments on commit bf3b91a

Please sign in to comment.
You can’t perform that action at this time.