Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made clonestamp brush clone blocks only above the target block (but including the target itself) #242

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
import com.github.kevindagame.util.Shapes;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.location.BaseLocation;
import com.github.kevindagame.voxelsniper.location.VoxelLocation;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

/**
Expand All @@ -22,9 +20,6 @@
*/
public class CloneStampBrush extends StampBrush {

private BaseLocation startingPoint;


/**
* The clone method is used to grab a snapshot of the selected area dictated blockPositionY targetBlock.x y z v.brushSize v.voxelHeight and v.cCen.
* <p/>
Expand All @@ -34,10 +29,9 @@ public class CloneStampBrush extends StampBrush {
* @param v the caller
*/
private void clone(final SnipeData v) {
VoxelLocation point = getTargetBlock().getLocation().makeMutable();
point.add(0, v.getcCen(), 0);
this.startingPoint = point.makeImmutable();
var positions = Shapes.cylinder(startingPoint, RotationAxis.Y, v.getBrushSize(), v.getVoxelHeight(), 0, false);
VoxelLocation startingPoint = getTargetBlock().getLocation().makeMutable();
startingPoint.add(0, v.getcCen(), 0);
var positions = Shapes.cylinder(startingPoint, RotationAxis.Y, v.getBrushSize(), v.getVoxelHeight(), (v.getVoxelHeight() / 2.0) - 1, false);
KevinDaGame marked this conversation as resolved.
Show resolved Hide resolved
this.clone.clear();
this.toStamp.clear();
this.sorted = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.kevindagame.util;

import com.github.kevindagame.snipe.Undo;
import com.github.kevindagame.voxelsniper.block.BlockFace;
import com.github.kevindagame.voxelsniper.block.IBlock;
import com.github.kevindagame.voxelsniper.location.BaseLocation;
Expand Down Expand Up @@ -81,7 +80,7 @@ public static List<BaseLocation> voxelDisc(BaseLocation location, int brushSize)
return positions;
}

public static List<BaseLocation> cylinder(BaseLocation centerPoint, RotationAxis axis, int brushSize, int height, int shift, boolean smooth) {
public static List<BaseLocation> cylinder(BaseLocation centerPoint, RotationAxis axis, int brushSize, int height, double shift, boolean smooth) {
List<BaseLocation> positions = new ArrayList<>();
for (int y = 0; y < height; y++) {
var pos = axis.getLocationTranslator().invoke(centerPoint.getWorld(), 0, (int) (y - (height / 2.0) + 1 + shift), 0);
Expand Down Expand Up @@ -121,8 +120,6 @@ public static List<BaseLocation> dome(BaseLocation location, int brushSize, int
final int absoluteHeight = Math.abs(height);
final boolean negative = height < 0;

final Undo undo = new Undo();

final int brushSizeTimesVoxelHeight = brushSize * absoluteHeight;
final double stepScale = ((brushSize * brushSize) + brushSizeTimesVoxelHeight + brushSizeTimesVoxelHeight) / 5.0;

Expand Down
Loading