From e1c0d00fc7a053cd1d49a4954f2b4a006e26144f Mon Sep 17 00:00:00 2001 From: Lennart99 <23156309+Lennart99@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:23:53 +0200 Subject: [PATCH 1/3] made clonestamp brush clone blocks only above the target block (but including the target itself) --- .../com/github/kevindagame/brush/CloneStampBrush.java | 8 ++------ .../src/main/java/com/github/kevindagame/util/Shapes.java | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java index 4bf0e15e..b0e9e092 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java @@ -11,7 +11,6 @@ import com.github.kevindagame.voxelsniper.location.VoxelLocation; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; import java.util.List; /** @@ -22,9 +21,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. *

@@ -36,8 +32,8 @@ public class CloneStampBrush extends StampBrush { 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); + BaseLocation startingPoint = point.makeImmutable(); + var positions = Shapes.cylinder(startingPoint, RotationAxis.Y, v.getBrushSize(), v.getVoxelHeight(), (v.getVoxelHeight() / 2.0) - 1, false); this.clone.clear(); this.toStamp.clear(); this.sorted = false; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java index f64175a6..23089662 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java @@ -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; @@ -81,7 +80,7 @@ public static List voxelDisc(BaseLocation location, int brushSize) return positions; } - public static List cylinder(BaseLocation centerPoint, RotationAxis axis, int brushSize, int height, int shift, boolean smooth) { + public static List cylinder(BaseLocation centerPoint, RotationAxis axis, int brushSize, int height, double shift, boolean smooth) { List 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); @@ -121,8 +120,6 @@ public static List 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; From d39db51f4fc157d274a27d64faa44727bf4bb144 Mon Sep 17 00:00:00 2001 From: Lennart99 <23156309+Lennart99@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:02:26 +0200 Subject: [PATCH 2/3] Small optimization --- .../java/com/github/kevindagame/brush/CloneStampBrush.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java index b0e9e092..eab254cb 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java @@ -30,9 +30,8 @@ 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); - BaseLocation startingPoint = point.makeImmutable(); + 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); this.clone.clear(); this.toStamp.clear(); From d82d77cfdba5c958b5050c4445b55df4a190011c Mon Sep 17 00:00:00 2001 From: Lennart99 <23156309+Lennart99@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:02:43 +0200 Subject: [PATCH 3/3] imports --- .../main/java/com/github/kevindagame/brush/CloneStampBrush.java | 1 - 1 file changed, 1 deletion(-) diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java index eab254cb..f6b2b3d2 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java @@ -7,7 +7,6 @@ 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;