mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
Move vectors to static creators, for caching
This commit is contained in:
committed by
IronApollo
parent
a9919d130c
commit
4d6045813c
@ -43,14 +43,14 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
}
|
||||
|
||||
private CuboidRegion transform(Transform transform, Region region) {
|
||||
BlockVector3 min = new BlockVector3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
BlockVector3 max = new BlockVector3(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
BlockVector3 min = BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
BlockVector3 max = BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
BlockVector3 pos1 = region.getMinimumPoint();
|
||||
BlockVector3 pos2 = region.getMaximumPoint();
|
||||
for (int x : new int[] { pos1.getBlockX(), pos2.getBlockX() }) {
|
||||
for (int y : new int[] { pos1.getBlockY(), pos2.getBlockY() }) {
|
||||
for (int z : new int[] { pos1.getBlockZ(), pos2.getBlockZ() }) {
|
||||
BlockVector3 pt = transform(transform, new BlockVector3(x, y, z));
|
||||
BlockVector3 pt = transform(transform, BlockVector3.at(x, y, z));
|
||||
min = min.getMinimum(pt);
|
||||
max = max.getMaximum(pt);
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
// tmp.mutY((tmp.getBlockY() + origin.getBlockY()));
|
||||
// tmp.mutZ((tmp.getBlockZ() + origin.getBlockZ()));
|
||||
// return tmp;
|
||||
return transform.apply(new Vector3(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint().add(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
|
||||
return transform.apply(Vector3.at(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint().add(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,6 @@ import com.sk89q.worldedit.function.visitor.IntersectRegionFunction;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Identity;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -322,7 +321,7 @@ public class ForwardExtentCopy implements Operation {
|
||||
int z = translation.getBlockZ();
|
||||
|
||||
maskFunc = position -> {
|
||||
BlockVector3 bv = new BlockVector3(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
|
||||
BlockVector3 bv = BlockVector3.at(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
|
||||
if (region.contains(bv)) {
|
||||
return sourceFunction.apply(bv);
|
||||
}
|
||||
@ -330,7 +329,7 @@ public class ForwardExtentCopy implements Operation {
|
||||
};
|
||||
|
||||
copySrcFunc = position -> {
|
||||
BlockVector3 bv = new BlockVector3(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
|
||||
BlockVector3 bv = BlockVector3.at(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
|
||||
if (!region.contains(bv)) {
|
||||
return sourceFunction.apply(position);
|
||||
}
|
||||
|
Reference in New Issue
Block a user