use of com.fastasyncworldedit.core.math.transform.RoundedTransform in project FastAsyncWorldEdit by IntellectualSites.
the class ClipboardSpline method pasteBlocks.
@Override
protected int pasteBlocks(BlockVector3 target, Vector3 offset, double angle) throws MaxChangedBlocksException {
RoundedTransform transform = new RoundedTransform(new AffineTransform().translate(offset).rotateY(angle));
if (!this.transform.isIdentity()) {
transform = transform.combine(this.transform);
}
if (!originalTransform.isIdentity()) {
transform = transform.combine(originalTransform);
}
// Pasting
Clipboard clipboard = clipboardHolder.getClipboard();
clipboard.setOrigin(center.subtract(centerOffset).round());
clipboardHolder.setTransform(transform);
BlockVector3 functionOffset = target.subtract(clipboard.getOrigin());
final int offX = functionOffset.getBlockX();
final int offY = functionOffset.getBlockY();
final int offZ = functionOffset.getBlockZ();
Operation operation = clipboardHolder.createPaste(editSession).to(target).ignoreAirBlocks(true).filter(v -> buffer.add(v.getBlockX() + offX, v.getBlockY() + offY, v.getBlockZ() + offZ)).build();
Operations.completeLegacy(operation);
// Cleanup
clipboardHolder.setTransform(originalTransform);
clipboard.setOrigin(originalOrigin);
return operation instanceof ForwardExtentCopy ? ((ForwardExtentCopy) operation).getAffected() : 0;
}
Aggregations