Updated ClipboardSpline paste

This commit is contained in:
Hazel Trinity 2020-08-16 01:08:35 -07:00
parent cd0dac813c
commit e5f092c3ef
2 changed files with 7 additions and 6 deletions

View File

@ -8,6 +8,7 @@ import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.interpolation.Interpolation;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.RoundedTransform;
@ -80,7 +81,7 @@ public class ClipboardSpline extends Spline {
}
@Override
protected int pasteBlocks(BlockVector3 target, BlockVector3 offset, double angle) throws MaxChangedBlocksException {
protected int pasteBlocks(BlockVector3 target, Vector3 offset, double angle) throws MaxChangedBlocksException {
RoundedTransform transform = new RoundedTransform(new AffineTransform()
.translate(offset)
.rotateY(angle));

View File

@ -127,9 +127,9 @@ public abstract class Spline {
Preconditions.checkArgument(position <= 1);
// Calculate position from spline
BlockVector3 target = interpolation.getPosition(position).toBlockPoint();
BlockVector3 offset = target.subtract(target.round());
target = target.subtract(offset).round();
Vector3 target = interpolation.getPosition(position);
BlockVector3 blockTarget = target.toBlockPoint();
Vector3 offset = target.subtract(target.floor());
// Calculate rotation from spline
@ -139,10 +139,10 @@ public abstract class Spline {
Math.atan2(direction.getZ(), direction.getX()) - Math.atan2(deriv2D.getZ(), deriv2D.getX())
);
return pasteBlocks(target, offset, angle);
return pasteBlocks(blockTarget, offset, angle);
}
protected abstract int pasteBlocks(BlockVector3 target, BlockVector3 offset, double angle) throws MaxChangedBlocksException;
protected abstract int pasteBlocks(BlockVector3 target, Vector3 offset, double angle) throws MaxChangedBlocksException;
private void initSections() {
int sectionCount = nodeCount - 1;