From b5d8b3bedf884e03fe5b3f70c9e0d9670c315cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Sat, 9 Sep 2023 10:19:23 +0200 Subject: [PATCH] Implements https://github.com/IntellectualSites/fastasyncvoxelsniper/issues/291 with the new command system --- .../voxelsniper/brush/type/HeatRayBrush.java | 30 ++++++++++++++++--- src/main/resources/lang/strings.json | 1 + 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/thevoxelbox/voxelsniper/brush/type/HeatRayBrush.java b/src/main/java/com/thevoxelbox/voxelsniper/brush/type/HeatRayBrush.java index 61347c23..8c27be08 100644 --- a/src/main/java/com/thevoxelbox/voxelsniper/brush/type/HeatRayBrush.java +++ b/src/main/java/com/thevoxelbox/voxelsniper/brush/type/HeatRayBrush.java @@ -3,6 +3,7 @@ import cloud.commandframework.annotations.Argument; import cloud.commandframework.annotations.CommandMethod; import cloud.commandframework.annotations.CommandPermission; +import cloud.commandframework.annotations.specifier.Liberal; import cloud.commandframework.annotations.specifier.Range; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.math.BlockVector3; @@ -18,6 +19,7 @@ import com.thevoxelbox.voxelsniper.util.material.MaterialSet; import com.thevoxelbox.voxelsniper.util.material.MaterialSets; import com.thevoxelbox.voxelsniper.util.material.Materials; +import com.thevoxelbox.voxelsniper.util.message.VoxelSniperText; import org.bukkit.util.Vector; import org.bukkit.util.noise.PerlinNoiseGenerator; import org.jetbrains.annotations.NotNull; @@ -54,11 +56,11 @@ public class HeatRayBrush extends AbstractBrush { .with(BlockCategories.WOODEN_FENCES) .with(BlockCategories.FENCE_GATES) .with(BlockCategories.SNOW) + .with(BlockCategories.FIRE) .with(MaterialSets.TORCHES) .with(MaterialSets.FLORA) .add(BlockTypes.SPONGE) .add(BlockTypes.COBWEB) - .add(BlockTypes.FIRE) .add(BlockTypes.LADDER) .build(); @@ -67,6 +69,7 @@ public class HeatRayBrush extends AbstractBrush { private double requiredFireDensity; private double requiredAirDensity; + private boolean soulFire; private int octaves; private double frequency; private double amplitude; @@ -97,6 +100,20 @@ public void onBrushInfo( super.onBrushInfoCommand(snipe, Caption.of("voxelsniper.brush.heat-ray.info")); } + @CommandMethod("") + public void onBrushSoulfire( + final @NotNull Snipe snipe, + final @Argument("soul-fire") @Liberal boolean soulFire + ) { + this.soulFire = soulFire; + + SnipeMessenger messenger = snipe.createMessenger(); + messenger.sendMessage(Caption.of( + "voxelsniper.brush.heat-ray.set-soul-fire", + VoxelSniperText.getStatus(this.soulFire) + )); + } + @CommandMethod("oct ") public void onBrushOct( final @NotNull Snipe snipe, @@ -159,6 +176,7 @@ public void heatRay(Snipe snipe) { Vector targetBlockVector = Vectors.toBukkit(targetBlock); Vector currentLocation = new Vector(); int brushSize = toolkitProperties.getBrushSize(); + BlockType fire = soulFire ? BlockTypes.SOUL_FIRE : BlockTypes.FIRE; for (int z = brushSize; z >= -brushSize; z--) { for (int x = brushSize; x >= -brushSize; x--) { for (int y = brushSize; y >= -brushSize; y--) { @@ -190,7 +208,7 @@ public void heatRay(Snipe snipe) { currentLocation.getBlockX(), currentLocation.getBlockY(), currentLocation.getBlockZ(), - BlockTypes.FIRE + fire ); continue; } @@ -246,12 +264,12 @@ public void heatRay(Snipe snipe) { ); } } else if (fireDensity >= this.requiredFireDensity) { - if (currentBlockType != BlockTypes.FIRE) { + if (currentBlockType != fire) { setBlock( currentLocation.getBlockX(), currentLocation.getBlockY(), currentLocation.getBlockZ(), - BlockTypes.FIRE + fire ); } } else if (airDensity >= this.requiredAirDensity) { @@ -274,6 +292,10 @@ public void sendInfo(Snipe snipe) { snipe.createMessageSender() .brushNameMessage() .brushSizeMessage() + .message(Caption.of( + "voxelsniper.brush.heat-ray.set-soul-fire", + VoxelSniperText.getStatus(this.soulFire) + )) .message(Caption.of( "voxelsniper.brush.heat-ray.set-octaves", this.octaves diff --git a/src/main/resources/lang/strings.json b/src/main/resources/lang/strings.json index 66ea5d9f..95f41146 100644 --- a/src/main/resources/lang/strings.json +++ b/src/main/resources/lang/strings.json @@ -172,6 +172,7 @@ "voxelsniper.brush.generate-tree.set-maximum-leaf-thickness": "&9Maximum Leaf Thickness set to: &f{0}", "voxelsniper.brush.heat-ray.info": "&6Heat Ray Brush Parameters:\n&b/b hr oct [n] -- Sets octave parameter to n for the noise generator.\n&b/b hr amp [n] -- Sets amplitude parameter to n for the noise generator.\n&b/b hr freq [n] -- Sets frequency parameter to n for the noise generator.", + "voxelsniper.brush.heat-ray.set-soul-fire": "&bSoul fire mode is {0}", "voxelsniper.brush.heat-ray.set-octaves": "&aOctaves set to: &f{0}", "voxelsniper.brush.heat-ray.set-amplitude": "&aAmplitude set to: &f{0}", "voxelsniper.brush.heat-ray.set-frequency": "&aFrequency set to: &f{0}",