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.
This commit is contained in:
Pieter12345 2019-10-28 15:02:24 +01:00
parent 21f3d967c3
commit bf3b91aaa7
No known key found for this signature in database
GPG Key ID: 06AAD14739314D2B

View File

@ -373,9 +373,9 @@ public class RegionCommands {
if (moveSelection) { if (moveSelection) {
try { 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); region.shift(shiftVector);
session.getRegionSelector(world).learnChanges(); session.getRegionSelector(world).learnChanges();