3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Fix undo for stack, move

- Most/anything using ForwardCopyExtent basically
Dieser Commit ist enthalten in:
dordsor21 2020-04-23 17:07:34 +01:00
Ursprung 29b82d4e51
Commit 69bd0274dd
2 geänderte Dateien mit 14 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -2,6 +2,8 @@ package com.sk89q.worldedit.function.operation;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableVector3; import com.sk89q.worldedit.math.MutableVector3;
@ -11,16 +13,18 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import java.util.List; import java.util.List;
public class BackwardsExtentBlockCopy implements Operation { public class BackwardsExtentBlockCopy extends RegionVisitor implements Operation {
private final Region region; private final Region region;
private final Transform transform; private final Transform transform;
private final RegionFunction function; private final RegionFunction function;
private final BlockVector3 origin; private final BlockVector3 origin;
private int affected = 0;
private MutableBlockVector3 mutBV3 = new MutableBlockVector3(); private MutableBlockVector3 mutBV3 = new MutableBlockVector3();
private MutableVector3 mutV3 = new MutableVector3(); private MutableVector3 mutV3 = new MutableVector3();
BackwardsExtentBlockCopy(Region region, BlockVector3 origin, Transform transform, RegionFunction function) { BackwardsExtentBlockCopy(Region region, BlockVector3 origin, Transform transform, RegionFunction function) {
super(region, function);
this.region = region; this.region = region;
this.transform = transform; this.transform = transform;
this.function = function; this.function = function;
@ -34,7 +38,9 @@ public class BackwardsExtentBlockCopy implements Operation {
for (BlockVector3 pt : destRegion) { for (BlockVector3 pt : destRegion) {
BlockVector3 copyFrom = transform(inverse, pt); BlockVector3 copyFrom = transform(inverse, pt);
if (region.contains(copyFrom)) { if (region.contains(copyFrom)) {
function.apply(pt); if(function.apply(pt)) {
affected++;
}
} }
} }
return null; return null;
@ -68,6 +74,10 @@ public class BackwardsExtentBlockCopy implements Operation {
return mutBV3; return mutBV3;
} }
public int getAffected() {
return affected;
}
@Override @Override
public void cancel() { public void cancel() {

Datei anzeigen

@ -305,7 +305,7 @@ public class ForwardExtentCopy implements Operation {
} }
RegionFunction copy; RegionFunction copy;
Operation blockCopy = null; RegionVisitor blockCopy = null;
PositionTransformExtent transExt = null; PositionTransformExtent transExt = null;
if (!currentTransform.isIdentity()) { if (!currentTransform.isIdentity()) {
if (!(currentTransform instanceof AffineTransform) || ((AffineTransform) currentTransform).isOffAxis()) { if (!(currentTransform instanceof AffineTransform) || ((AffineTransform) currentTransform).isOffAxis()) {
@ -414,8 +414,7 @@ public class ForwardExtentCopy implements Operation {
} }
} }
int affected; affectedBlocks += blockCopy.getAffected();
affected = region.getArea();
return null; return null;
} }