From d13111b29919a65424364243eca5258029bf8610 Mon Sep 17 00:00:00 2001 From: Esophose Date: Fri, 17 Jan 2020 05:01:44 -0700 Subject: [PATCH] Add radius setting to vortex styles --- .../playerparticles/styles/ParticleStylePopper.java | 7 +++++-- .../playerparticles/styles/ParticleStyleVortex.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/esophose/playerparticles/styles/ParticleStylePopper.java b/src/main/java/dev/esophose/playerparticles/styles/ParticleStylePopper.java index 1a0f718..efd4b3c 100644 --- a/src/main/java/dev/esophose/playerparticles/styles/ParticleStylePopper.java +++ b/src/main/java/dev/esophose/playerparticles/styles/ParticleStylePopper.java @@ -13,6 +13,7 @@ public class ParticleStylePopper extends DefaultParticleStyle { private int step = 0; + private double radius; private double grow; private double radials; private int helices; @@ -30,7 +31,7 @@ public class ParticleStylePopper extends DefaultParticleStyle { public List getParticles(ParticlePair particle, Location location) { List particles = new ArrayList<>(); - double radius = (1 - (double) this.step / this.maxStep); + double radius = this.radius * (1 - (double) this.step / this.maxStep); for (int i = 0; i < this.helices; i++) { double angle = this.step * this.radials + (2 * Math.PI * i / this.helices); Vector v = new Vector(MathL.cos(angle) * radius, this.step * this.grow - 1, MathL.sin(angle) * radius); @@ -52,7 +53,8 @@ public class ParticleStylePopper extends DefaultParticleStyle { @Override protected void setDefaultSettings(CommentedFileConfiguration config) { - this.setIfNotExists("grow", 0.08, "How much to change the radius per particle"); + this.setIfNotExists("radius", 1.0, "The radius at the bottom of the vortex"); + this.setIfNotExists("grow", 0.08, "How much to change the height per particle"); this.setIfNotExists("radials", 16, "The steepness of how fast the particles grow upwards", "More = faster/taller growth"); this.setIfNotExists("helices", 2, "The number of orbs spinning around the player"); this.setIfNotExists("step-amount", 32, "How many steps it takes to reach the highest point"); @@ -64,6 +66,7 @@ public class ParticleStylePopper extends DefaultParticleStyle { @Override protected void loadSettings(CommentedFileConfiguration config) { + this.radius = config.getDouble("radius"); this.grow = config.getDouble("grow"); this.radials = Math.PI / config.getInt("radials"); this.helices = config.getInt("helices"); diff --git a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleVortex.java b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleVortex.java index fb3b130..19bba5a 100644 --- a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleVortex.java +++ b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleVortex.java @@ -36,6 +36,7 @@ public class ParticleStyleVortex extends DefaultParticleStyle { private int step = 0; + private double radius; private double grow; private double radials; private int helices; @@ -49,7 +50,7 @@ public class ParticleStyleVortex extends DefaultParticleStyle { public List getParticles(ParticlePair particle, Location location) { List particles = new ArrayList<>(); - double radius = 2 * (1 - (double) this.step / this.maxStep); + double radius = this.radius * (1 - (double) this.step / this.maxStep); for (int i = 0; i < this.helices; i++) { double angle = this.step * this.radials + (2 * Math.PI * i / this.helices); Vector v = new Vector(MathL.cos(angle) * radius, this.step * this.grow - 1, MathL.sin(angle) * radius); @@ -67,7 +68,8 @@ public class ParticleStyleVortex extends DefaultParticleStyle { @Override protected void setDefaultSettings(CommentedFileConfiguration config) { - this.setIfNotExists("grow", 0.05, "How much to change the radius per particle"); + this.setIfNotExists("radius", 2.0, "The bottom radius of the vortex"); + this.setIfNotExists("grow", 0.05, "How much to change the height per particle"); this.setIfNotExists("radials", 16, "The steepness of how fast the particles grow upwards", "More = faster/taller growth"); this.setIfNotExists("helices", 4, "The number of orbs spinning around the player"); this.setIfNotExists("step-amount", 70, "How many steps it takes to reach the highest point"); @@ -75,6 +77,7 @@ public class ParticleStyleVortex extends DefaultParticleStyle { @Override protected void loadSettings(CommentedFileConfiguration config) { + this.radius = config.getDouble("radius"); this.grow = config.getDouble("grow"); this.radials = Math.PI / config.getInt("radials"); this.helices = config.getInt("helices");