mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-02-11 03:29:53 +00:00
Individual style settings
This commit is contained in:
parent
cc46c295e4
commit
dc020d5bf8
32 changed files with 571 additions and 350 deletions
|
@ -17,9 +17,11 @@ import org.bukkit.event.entity.EntityShootBowEvent;
|
|||
public class ParticleStyleArrows extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private static final String[] arrowEntityNames = new String[] { "ARROW", "SPECTRAL_ARROW", "TIPPED_ARROW" };
|
||||
private static final int MAX_ARROWS_PER_PLAYER = 10;
|
||||
private List<Projectile> arrows = new ArrayList<>();
|
||||
|
||||
private int maxArrowsPerPlayer;
|
||||
private boolean onlySpawnIfFlying;
|
||||
|
||||
public ParticleStyleArrows() {
|
||||
super("arrows", false, false, 0);
|
||||
}
|
||||
|
@ -31,12 +33,15 @@ public class ParticleStyleArrows extends DefaultParticleStyle implements Listene
|
|||
int count = 0;
|
||||
for (int i = this.arrows.size() - 1; i >= 0; i--) { // Loop backwards so the last-fired arrows are the ones that have particles if they go over the max
|
||||
Projectile arrow = this.arrows.get(i);
|
||||
if (this.onlySpawnIfFlying && arrow.isOnGround())
|
||||
continue;
|
||||
|
||||
if (arrow.getShooter() != null && ((Player) arrow.getShooter()).getUniqueId().equals(particle.getOwnerUniqueId())) {
|
||||
particles.add(new PParticle(arrow.getLocation(), 0.05F, 0.05F, 0.05F, 0.0F));
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= MAX_ARROWS_PER_PLAYER)
|
||||
if (count >= this.maxArrowsPerPlayer)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -73,12 +78,14 @@ public class ParticleStyleArrows extends DefaultParticleStyle implements Listene
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("max-arrows-per-player", 10, "The max number of arrows that will spawn particles per player");
|
||||
this.setIfNotExists("only-spawn-if-flying", false, "Only spawn particles while the arrow is still in the air");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.maxArrowsPerPlayer = config.getInt("max-arrows-per-player");
|
||||
this.onlySpawnIfFlying = config.getBoolean("only-spawn-if-flying");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ public class ParticleStyleBatman extends DefaultParticleStyle {
|
|||
|
||||
private int step = 0;
|
||||
|
||||
private int spawnDelay;
|
||||
|
||||
public ParticleStyleBatman() {
|
||||
super("batman", true, true, -1);
|
||||
}
|
||||
|
@ -115,17 +117,17 @@ public class ParticleStyleBatman extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
public void updateTimers() {
|
||||
this.step = (this.step + 1) % 20; // Only spawn once per second
|
||||
this.step = (this.step + 1) % this.spawnDelay; // Only spawn once per second
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("spawn-delay", 20, "The number of ticks to wait between particle spawns");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.spawnDelay = config.getInt("spawn-delay");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,22 +13,23 @@ public class ParticleStyleBeam extends DefaultParticleStyle {
|
|||
private int step = 0;
|
||||
private boolean reversed = false;
|
||||
|
||||
private int points;
|
||||
private double radius;
|
||||
|
||||
public ParticleStyleBeam() {
|
||||
super("beam", true, true, 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
int points = 16;
|
||||
double radius = 1;
|
||||
double slice = 2 * Math.PI / points;
|
||||
double slice = 2 * Math.PI / this.points;
|
||||
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < points; i++) {
|
||||
for (int i = 0; i < this.points; i++) {
|
||||
double angle = slice * i;
|
||||
double newX = location.getX() + radius * MathL.cos(angle);
|
||||
double newX = location.getX() + this.radius * MathL.cos(angle);
|
||||
double newY = location.getY() + (this.step / 10D) - 1;
|
||||
double newZ = location.getZ() + radius * MathL.sin(angle);
|
||||
double newZ = location.getZ() + this.radius * MathL.sin(angle);
|
||||
particles.add(new PParticle(new Location(location.getWorld(), newX, newY, newZ)));
|
||||
}
|
||||
return particles;
|
||||
|
@ -47,12 +48,14 @@ public class ParticleStyleBeam extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("points", 16, "The number of points in the circle");
|
||||
this.setIfNotExists("radius", 1.0, "The radius of the circle");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.points = config.getInt("points");
|
||||
this.radius = config.getInt("radius");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||
|
||||
public class ParticleStyleBlockBreak extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private int particleAmount;
|
||||
private double particleSpread;
|
||||
private double particleSpeed;
|
||||
|
||||
public ParticleStyleBlockBreak() {
|
||||
super("blockbreak", false, false, 0);
|
||||
}
|
||||
|
@ -28,8 +32,8 @@ public class ParticleStyleBlockBreak extends DefaultParticleStyle implements Lis
|
|||
|
||||
location.add(0.5, 0.5, 0.5); // Center around the block
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
particles.add(new PParticle(location, 0.5F, 0.5F, 0.5F, 0.05F));
|
||||
for (int i = 0; i < this.particleAmount; i++)
|
||||
particles.add(new PParticle(location, this.particleSpread, this.particleSpread, this.particleSpread, this.particleSpeed));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -41,12 +45,16 @@ public class ParticleStyleBlockBreak extends DefaultParticleStyle implements Lis
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particle-amount", 10, "The number of particles to spawn");
|
||||
this.setIfNotExists("particle-spread", 0.5, "The distance to spread particles");
|
||||
this.setIfNotExists("particle-speed", 0.05, "The speed of the particles");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.particleAmount = config.getInt("particle-amount");
|
||||
this.particleSpread = config.getInt("particle-spread");
|
||||
this.particleSpeed = config.getDouble("particle-speed");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
|
|
@ -18,6 +18,10 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||
|
||||
public class ParticleStyleBlockPlace extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private int particleAmount;
|
||||
private double particleSpread;
|
||||
private double particleSpeed;
|
||||
|
||||
public ParticleStyleBlockPlace() {
|
||||
super("blockplace", false, false, 0);
|
||||
}
|
||||
|
@ -28,8 +32,8 @@ public class ParticleStyleBlockPlace extends DefaultParticleStyle implements Lis
|
|||
|
||||
location.add(0.5, 0.5, 0.5); // Center around the block
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
particles.add(new PParticle(location, 0.75F, 0.75F, 0.75F, 0.05F));
|
||||
for (int i = 0; i < this.particleAmount; i++)
|
||||
particles.add(new PParticle(location, this.particleSpread, this.particleSpread, this.particleSpread, this.particleSpeed));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -41,12 +45,16 @@ public class ParticleStyleBlockPlace extends DefaultParticleStyle implements Lis
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particle-amount", 10, "The number of particles to spawn");
|
||||
this.setIfNotExists("particle-spread", 0.75, "The distance to spread particles");
|
||||
this.setIfNotExists("particle-speed", 0.05, "The speed of the particles");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.particleAmount = config.getInt("particle-amount");
|
||||
this.particleSpread = config.getInt("particle-spread");
|
||||
this.particleSpeed = config.getDouble("particle-speed");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
|
|
@ -22,7 +22,17 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
public class ParticleStyleCelebration extends DefaultParticleStyle {
|
||||
|
||||
private int step = 0;
|
||||
private final int spawnTime = 15;
|
||||
|
||||
private int spawnFrequency;
|
||||
private int burstAmount;
|
||||
private double baseBurstSize;
|
||||
private double burstSizeRandomizer;
|
||||
private int baseFuseLength;
|
||||
private int fuseLengthRandomizer;
|
||||
private double baseDistanceFrom;
|
||||
private double distanceFromRandomizer;
|
||||
private double fuseSpacing;
|
||||
private ParticleEffect fuseEffect;
|
||||
|
||||
public ParticleStyleCelebration() {
|
||||
super("celebration", true, true, 0);
|
||||
|
@ -43,7 +53,7 @@ public class ParticleStyleCelebration extends DefaultParticleStyle {
|
|||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
|
||||
this.step++;
|
||||
if (this.step == this.spawnTime) {
|
||||
if (this.step == this.spawnFrequency) {
|
||||
this.step = 0;
|
||||
|
||||
Random random = new Random();
|
||||
|
@ -63,21 +73,42 @@ public class ParticleStyleCelebration extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("spawn-frequency", 15, "How many ticks to wait between spawns");
|
||||
this.setIfNotExists("burst-amount", 40, "How many particles to spawn per burst");
|
||||
this.setIfNotExists("base-burst-size", 0.6, "The minimum size of the particle burst");
|
||||
this.setIfNotExists("burst-size-randomizer", 0.2, "The maximum size to add to the base of the particle burst");
|
||||
this.setIfNotExists("base-fuse-length", 4, "The minimum fuse length");
|
||||
this.setIfNotExists("fuse-length-randomizer", 3, "The max length to add to the base of the fuse");
|
||||
this.setIfNotExists("base-distance-from", 1.25, "The minimum distance to spawn from the player");
|
||||
this.setIfNotExists("distance-from-randomizer", 1.5, "The max distance to add to the base of the distance");
|
||||
this.setIfNotExists("fuse-spacing", 0.25, "The vertical distance between fuse particles");
|
||||
this.setIfNotExists("fuse-effect", "firework", "The effect type to use for the fuse particles");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
this.spawnFrequency = config.getInt("spawn-frequency");
|
||||
this.burstAmount = config.getInt("burst-amount");
|
||||
this.baseBurstSize = config.getDouble("base-burst-size");
|
||||
this.burstSizeRandomizer = config.getDouble("burst-size-randomizer");
|
||||
this.baseFuseLength = config.getInt("base-fuse-length");
|
||||
this.fuseLengthRandomizer = config.getInt("fuse-length-randomizer");
|
||||
this.baseDistanceFrom = config.getDouble("base-distance-from");
|
||||
this.distanceFromRandomizer = config.getDouble("distance-from-randomizer");
|
||||
this.fuseSpacing = config.getDouble("fuse-spacing");
|
||||
this.fuseEffect = ParticleEffect.fromInternalName(config.getString("fuse-effect"));
|
||||
|
||||
if (this.fuseEffect == null)
|
||||
this.fuseEffect = ParticleEffect.FIREWORK;
|
||||
}
|
||||
|
||||
private void spawnFirework(final Location location, final PPlayer pplayer, final ParticlePair particle, final Random random) {
|
||||
double angle = random.nextDouble() * Math.PI * 2;
|
||||
double distanceFrom = 1.25 + random.nextDouble() * 1.5;
|
||||
double distanceFrom = this.baseDistanceFrom + random.nextDouble() * this.distanceFromRandomizer;
|
||||
double dx = MathL.sin(angle) * distanceFrom;
|
||||
double dz = MathL.cos(angle) * distanceFrom;
|
||||
final Location loc = location.clone().add(dx, 1, dz);
|
||||
final int fuse = 3 + random.nextInt(3);
|
||||
final int fuse = this.baseFuseLength + random.nextInt(this.fuseLengthRandomizer);
|
||||
Player player = pplayer.getPlayer();
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
|
||||
|
@ -89,16 +120,16 @@ public class ParticleStyleCelebration extends DefaultParticleStyle {
|
|||
public void run() {
|
||||
if (this.fuseTimer < this.fuseLength) {
|
||||
ParticlePair trail = ParticlePair.getNextDefault(pplayer);
|
||||
trail.setEffect(ParticleEffect.FIREWORK);
|
||||
trail.setEffect(ParticleStyleCelebration.this.fuseEffect);
|
||||
trail.setStyle(DefaultStyles.CELEBRATION);
|
||||
|
||||
particleManager.displayParticles(player, trail, Collections.singletonList(new PParticle(this.location)));
|
||||
|
||||
this.location.add(0, 0.25, 0);
|
||||
this.location.add(0, ParticleStyleCelebration.this.fuseSpacing, 0);
|
||||
} else {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < 40; i++) {
|
||||
double radius = 0.6 + random.nextDouble() * 0.2;
|
||||
for (int i = 0; i < ParticleStyleCelebration.this.burstAmount; i++) {
|
||||
double radius = ParticleStyleCelebration.this.baseBurstSize + random.nextDouble() * ParticleStyleCelebration.this.burstSizeRandomizer;
|
||||
double u = random.nextDouble();
|
||||
double v = random.nextDouble();
|
||||
double theta = 2 * Math.PI * u;
|
||||
|
|
|
@ -9,6 +9,8 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleChains extends DefaultParticleStyle {
|
||||
|
||||
private int chainParticleAmount;
|
||||
|
||||
public ParticleStyleChains() {
|
||||
super("chains", true, true, 0);
|
||||
}
|
||||
|
@ -17,7 +19,7 @@ public class ParticleStyleChains extends DefaultParticleStyle {
|
|||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
|
||||
for (double n = -0.2; n < 0.6; n += 0.1) {
|
||||
for (double n = -0.2; n < 0.6; n += 0.8 / this.chainParticleAmount) {
|
||||
particles.add(new PParticle(location.clone().add(1 - n, n - 1.1, 1 - n)));
|
||||
particles.add(new PParticle(location.clone().add(1 - n, n - 1.1, -1 + n)));
|
||||
particles.add(new PParticle(location.clone().add(-1 + n, n - 1.1, 1 - n)));
|
||||
|
@ -34,12 +36,12 @@ public class ParticleStyleChains extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("chain-particle-amount", 8, "The number of particles per chain");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.chainParticleAmount = config.getInt("chain-particle-amount");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,13 +34,14 @@ import org.bukkit.util.Vector;
|
|||
|
||||
public class ParticleStyleCompanion extends DefaultParticleStyle {
|
||||
|
||||
private int numParticles = 150;
|
||||
private int particlesPerIteration = 5;
|
||||
private double size = 1.25;
|
||||
private double xFactor = 1.0, yFactor = 1.5, zFactor = 1.0;
|
||||
private double xOffset = 0.0, yOffset = -0.75, zOffset = 0.0;
|
||||
private int step = 0;
|
||||
|
||||
private int numParticles;
|
||||
private int particlesPerIteration;
|
||||
private double size;
|
||||
private double xFactor, yFactor, zFactor;
|
||||
private double xOffset, yOffset, zOffset;
|
||||
|
||||
public ParticleStyleCompanion() {
|
||||
super("companion", true, false, 1);
|
||||
}
|
||||
|
@ -59,9 +60,8 @@ public class ParticleStyleCompanion extends DefaultParticleStyle {
|
|||
vector.setZ(this.zFactor * r * MathL.sin(s) + this.zOffset);
|
||||
vector.setY(this.yFactor * this.size * MathL.cos(t) + this.yOffset);
|
||||
|
||||
for (int i = 0; i < this.particlesPerIteration; i++) {
|
||||
for (int i = 0; i < this.particlesPerIteration; i++)
|
||||
particles.add(new PParticle(location.clone().subtract(vector)));
|
||||
}
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -73,12 +73,28 @@ public class ParticleStyleCompanion extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particle-amount", 150, "The number of total particles in the animation cycle");
|
||||
this.setIfNotExists("particles-per-iteration", 5, "The number of particles spawned per iteration");
|
||||
this.setIfNotExists("size", 1.25, "The size of the animation");
|
||||
this.setIfNotExists("x-factor", 1.0, "The multiplier for the x-axis");
|
||||
this.setIfNotExists("y-factor", 1.5, "The multiplier for the y-axis");
|
||||
this.setIfNotExists("z-factor", 1.0, "The multiplier for the z-axis");
|
||||
this.setIfNotExists("x-offset", 0.0, "The offset for the x-axis");
|
||||
this.setIfNotExists("y-offset", -0.75, "The offset for the y-axis");
|
||||
this.setIfNotExists("z-offset", 0.0, "The offset for the x-axis");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.numParticles = config.getInt("particle-amount");
|
||||
this.particlesPerIteration = config.getInt("particles-per-iteration");
|
||||
this.size = config.getDouble("size");
|
||||
this.xFactor = config.getDouble("x-factor");
|
||||
this.yFactor = config.getDouble("y-factor");
|
||||
this.zFactor = config.getDouble("z-factor");
|
||||
this.xOffset = config.getDouble("x-offset");
|
||||
this.yOffset = config.getDouble("y-offset");
|
||||
this.zOffset = config.getDouble("z-offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,14 +39,15 @@ import org.bukkit.util.Vector;
|
|||
*/
|
||||
public class ParticleStyleCube extends DefaultParticleStyle {
|
||||
|
||||
private double edgeLength = 2;
|
||||
private double angularVelocityX = (Math.PI / 200) / 5;
|
||||
private double angularVelocityY = (Math.PI / 170) / 5;
|
||||
private double angularVelocityZ = (Math.PI / 155) / 5;
|
||||
private int particles = 7;
|
||||
private int step = 0;
|
||||
private boolean skipNextStep = false; // Only spawn every 2 ticks
|
||||
|
||||
private double edgeLength;
|
||||
private double angularVelocityX;
|
||||
private double angularVelocityY;
|
||||
private double angularVelocityZ;
|
||||
private int particlesPerEdge;
|
||||
|
||||
public ParticleStyleCube() {
|
||||
super("cube", true, true, 0);
|
||||
}
|
||||
|
@ -55,34 +56,35 @@ public class ParticleStyleCube extends DefaultParticleStyle {
|
|||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> pparticles = new ArrayList<>();
|
||||
|
||||
if (!this.skipNextStep) {
|
||||
double xRotation = this.step * this.angularVelocityX;
|
||||
double yRotation = this.step * this.angularVelocityY;
|
||||
double zRotation = this.step * this.angularVelocityZ;
|
||||
double a = this.edgeLength / 2;
|
||||
double angleX, angleY;
|
||||
Vector v = new Vector();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
angleY = i * Math.PI / 2;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
angleX = j * Math.PI;
|
||||
for (int p = 0; p <= this.particles; p++) {
|
||||
v.setX(a).setY(a);
|
||||
v.setZ(this.edgeLength * p / this.particles - a);
|
||||
VectorUtils.rotateAroundAxisX(v, angleX);
|
||||
VectorUtils.rotateAroundAxisY(v, angleY);
|
||||
VectorUtils.rotateVector(v, xRotation, yRotation, zRotation);
|
||||
pparticles.add(new PParticle(location.clone().add(v)));
|
||||
}
|
||||
}
|
||||
for (int p = 0; p <= particles; p++) {
|
||||
v.setX(a).setZ(a);
|
||||
v.setY(edgeLength * p / particles - a);
|
||||
if (this.skipNextStep)
|
||||
return pparticles;
|
||||
|
||||
double xRotation = this.step * this.angularVelocityX;
|
||||
double yRotation = this.step * this.angularVelocityY;
|
||||
double zRotation = this.step * this.angularVelocityZ;
|
||||
double a = this.edgeLength / 2;
|
||||
double angleX, angleY;
|
||||
Vector v = new Vector();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
angleY = i * Math.PI / 2;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
angleX = j * Math.PI;
|
||||
for (int p = 0; p <= this.particlesPerEdge; p++) {
|
||||
v.setX(a).setY(a);
|
||||
v.setZ(this.edgeLength * p / this.particlesPerEdge - a);
|
||||
VectorUtils.rotateAroundAxisX(v, angleX);
|
||||
VectorUtils.rotateAroundAxisY(v, angleY);
|
||||
VectorUtils.rotateVector(v, xRotation, yRotation, zRotation);
|
||||
pparticles.add(new PParticle(location.clone().add(v)));
|
||||
}
|
||||
}
|
||||
for (int p = 0; p <= this.particlesPerEdge; p++) {
|
||||
v.setX(a).setZ(a);
|
||||
v.setY(this.edgeLength * p / this.particlesPerEdge - a);
|
||||
VectorUtils.rotateAroundAxisY(v, angleY);
|
||||
VectorUtils.rotateVector(v, xRotation, yRotation, zRotation);
|
||||
pparticles.add(new PParticle(location.clone().add(v)));
|
||||
}
|
||||
}
|
||||
|
||||
return pparticles;
|
||||
|
@ -96,12 +98,20 @@ public class ParticleStyleCube extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("edge-length", 2.0, "The length (in blocks) of the edges of the cube");
|
||||
this.setIfNotExists("angular-velocity-x", 0.00314159265, "The angular velocity on the x-axis");
|
||||
this.setIfNotExists("angular-velocity-y", 0.00369599135, "The angular velocity on the y-axis");
|
||||
this.setIfNotExists("angular-velocity-z", 0.00405366794, "The angular velocity on the z-axis");
|
||||
this.setIfNotExists("particles-per-edge", 7, "The number of particles to spawn per edge of the cube");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.edgeLength = config.getDouble("edge-length");
|
||||
this.angularVelocityX = config.getDouble("angular-velocity-x");
|
||||
this.angularVelocityY = config.getDouble("angular-velocity-y");
|
||||
this.angularVelocityZ = config.getDouble("angular-velocity-z");
|
||||
this.particlesPerEdge = config.getInt("particles-per-edge");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleFeet extends DefaultParticleStyle {
|
||||
|
||||
private double feetOffset;
|
||||
private double particleSpreadX, particleSpreadY, particleSpreadZ;
|
||||
private double particleSpeed;
|
||||
private int particlesPerTick;
|
||||
|
||||
public ParticleStyleFeet() {
|
||||
super("feet", true, false, 0.5);
|
||||
}
|
||||
|
@ -16,7 +21,8 @@ public class ParticleStyleFeet extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
particles.add(new PParticle(location.clone().subtract(0, 0.95, 0), 0.4F, 0.0F, 0.4F, 0.0F));
|
||||
for (int i = 0; i < this.particlesPerTick; i++)
|
||||
particles.add(new PParticle(location.clone().add(0, this.feetOffset, 0), this.particleSpreadX, this.particleSpreadY, this.particleSpreadZ, this.particleSpeed));
|
||||
return particles;
|
||||
}
|
||||
|
||||
|
@ -27,12 +33,22 @@ public class ParticleStyleFeet extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("feet-offset", -0.95, "How far to offset the player location vertically");
|
||||
this.setIfNotExists("particle-spread-x", 0.4, "How far to spread the particles on the x-axis");
|
||||
this.setIfNotExists("particle-spread-y", 0.0, "How far to spread the particles on the y-axis");
|
||||
this.setIfNotExists("particle-spread-z", 0.4, "How far to spread the particles on the z-axis");
|
||||
this.setIfNotExists("particle-speed", 0.0, "The speed of the particles");
|
||||
this.setIfNotExists("particles-per-tick", 1, "How many particles to spawn per tick");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.feetOffset = config.getDouble("feet-offset");
|
||||
this.particleSpreadX = config.getDouble("particle-spread-x");
|
||||
this.particleSpreadY = config.getDouble("particle-spread-y");
|
||||
this.particleSpreadZ = config.getDouble("particle-spread-z");
|
||||
this.particleSpeed = config.getDouble("particle-speed");
|
||||
this.particlesPerTick = config.getInt("particles-per-tick");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,11 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleHalo extends DefaultParticleStyle {
|
||||
|
||||
private int step = 0;
|
||||
private boolean skipNextSpawn = false;
|
||||
|
||||
private int points;
|
||||
private double radius;
|
||||
private double playerOffset;
|
||||
|
||||
public ParticleStyleHalo() {
|
||||
super("halo", true, false, -0.5);
|
||||
|
@ -19,18 +23,16 @@ public class ParticleStyleHalo extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
if (this.step % 2 == 0)
|
||||
if (this.skipNextSpawn)
|
||||
return particles;
|
||||
|
||||
int points = 16;
|
||||
double radius = .65;
|
||||
double slice = 2 * Math.PI / points;
|
||||
double slice = 2 * Math.PI / this.points;
|
||||
|
||||
for (int i = 0; i < points; i++) {
|
||||
for (int i = 0; i < this.points; i++) {
|
||||
double angle = slice * i;
|
||||
double dx = radius * MathL.cos(angle);
|
||||
double dy = 1.5;
|
||||
double dz = radius * MathL.sin(angle);
|
||||
double dx = this.radius * MathL.cos(angle);
|
||||
double dy = this.playerOffset;
|
||||
double dz = this.radius * MathL.sin(angle);
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
return particles;
|
||||
|
@ -38,19 +40,21 @@ public class ParticleStyleHalo extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
public void updateTimers() {
|
||||
this.step++;
|
||||
if (this.step > 30)
|
||||
this.step = 0;
|
||||
this.skipNextSpawn = !this.skipNextSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particle-amount", 16, "The number of points in the halo");
|
||||
this.setIfNotExists("radius", 0.65, "The radius of the halo");
|
||||
this.setIfNotExists("player-offset", 1.5, "How far to offset the player location");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.points = config.getInt("particle-amount");
|
||||
this.radius = config.getDouble("radius");
|
||||
this.playerOffset = config.getDouble("player-offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,19 +18,18 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||
|
||||
public class ParticleStyleHurt extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private int thickMultiplier;
|
||||
|
||||
public ParticleStyleHurt() {
|
||||
super("hurt", false, false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> baseParticles = DefaultStyles.THICK.getParticles(particle, location);
|
||||
|
||||
int multiplyingFactor = 3; // Uses the same logic as ParticleStyleThick except multiplies the resulting particles by 3x
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < baseParticles.size() * multiplyingFactor; i++) {
|
||||
particles.add(baseParticles.get(i % baseParticles.size()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.thickMultiplier; i++)
|
||||
particles.addAll(DefaultStyles.THICK.getParticles(particle, location));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -58,12 +57,12 @@ public class ParticleStyleHurt extends DefaultParticleStyle implements Listener
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("thick-multiplier", 3, "How much to multiply the particles by", "This style uses the same spawning as the 'thick' style");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.thickMultiplier = config.getInt("thick-multiplier");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,11 +11,14 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleInvocation extends DefaultParticleStyle {
|
||||
|
||||
private int points = 6;
|
||||
private double radius = 3.5;
|
||||
private double step = 0;
|
||||
private int circleStep = 0;
|
||||
private int numSteps = 120;
|
||||
|
||||
private int points;
|
||||
private double radius;
|
||||
private int numSteps;
|
||||
private double playerOffset;
|
||||
private double speedMultiplier;
|
||||
|
||||
public ParticleStyleInvocation() {
|
||||
super("invocation", true, true, 0.5);
|
||||
|
@ -23,13 +26,13 @@ public class ParticleStyleInvocation extends DefaultParticleStyle {
|
|||
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
double speed = this.getSpeedByEffect(particle.getEffect());
|
||||
double speed = this.getSpeedByEffect(particle.getEffect()) * this.speedMultiplier;
|
||||
|
||||
// Circle around everything, spawn less often
|
||||
if (this.circleStep % 5 == 0) {
|
||||
for (int i = 0; i < this.numSteps; i++) {
|
||||
double dx = MathL.cos(Math.PI * 2 * ((double) i / this.numSteps)) * this.radius;
|
||||
double dy = -0.9;
|
||||
double dy = this.playerOffset;
|
||||
double dz = MathL.sin(Math.PI * 2 * ((double) i / this.numSteps)) * this.radius;
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
|
@ -38,7 +41,7 @@ public class ParticleStyleInvocation extends DefaultParticleStyle {
|
|||
// Orbit going clockwise
|
||||
for (int i = 0; i < this.points; i++) {
|
||||
double dx = MathL.cos(this.step + (Math.PI * 2 * ((double) i / this.points))) * this.radius;
|
||||
double dy = -0.9;
|
||||
double dy = this.playerOffset;
|
||||
double dz = MathL.sin(this.step + (Math.PI * 2 * ((double) i / this.points))) * this.radius;
|
||||
double angle = Math.atan2(dz, dx);
|
||||
double xAng = -MathL.cos(angle);
|
||||
|
@ -49,7 +52,7 @@ public class ParticleStyleInvocation extends DefaultParticleStyle {
|
|||
// Orbit going counter-clockwise
|
||||
for (int i = 0; i > -this.points; i--) {
|
||||
double dx = MathL.cos(-this.step + (Math.PI * 2 * ((double) i / this.points))) * this.radius;
|
||||
double dy = -0.9;
|
||||
double dy = this.playerOffset;
|
||||
double dz = MathL.sin(-this.step + (Math.PI * 2 * ((double) i / this.points))) * this.radius;
|
||||
double angle = Math.atan2(dz, dx);
|
||||
double xAng = -MathL.cos(angle);
|
||||
|
@ -71,7 +74,7 @@ public class ParticleStyleInvocation extends DefaultParticleStyle {
|
|||
case ENCHANT:
|
||||
case NAUTILUS:
|
||||
case PORTAL:
|
||||
return radius * 2;
|
||||
return 7;
|
||||
case END_ROD:
|
||||
case SMOKE:
|
||||
case SQUID_INK:
|
||||
|
@ -96,12 +99,20 @@ public class ParticleStyleInvocation extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("spinning-points", 6, "The number of points that spin around the circle in each direction");
|
||||
this.setIfNotExists("radius", 3.5, "The radius of the circle");
|
||||
this.setIfNotExists("circle-points", 120, "The number of points around the circle");
|
||||
this.setIfNotExists("player-offset", -0.9, "How far to vertically offset the player's location");
|
||||
this.setIfNotExists("speed-multiplier", 1, "A multiplier to change how fast the particles move");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.points = config.getInt("spinning-points");
|
||||
this.radius = config.getDouble("radius");
|
||||
this.numSteps = config.getInt("circle-points");
|
||||
this.playerOffset = config.getDouble("player-offset");
|
||||
this.speedMultiplier = config.getDouble("speed-multiplier");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import dev.esophose.playerparticles.manager.ParticleManager;
|
|||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -16,13 +17,20 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||
|
||||
public class ParticleStyleMove extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private int multiplier;
|
||||
|
||||
public ParticleStyleMove() {
|
||||
super("move", false, false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
return DefaultStyles.NORMAL.getParticles(particle, location);
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < this.multiplier; i++)
|
||||
particles.addAll(DefaultStyles.NORMAL.getParticles(particle, location));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,12 +40,12 @@ public class ParticleStyleMove extends DefaultParticleStyle implements Listener
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("multiplier", 1, "The multiplier for the number of particles to spawn", "This style uses the same spawning as the 'normal' style");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.multiplier = config.getInt("multiplier");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
|
|
@ -21,112 +21,112 @@ public class ParticleStyleNormal extends DefaultParticleStyle {
|
|||
List<PParticle> particles = new ArrayList<>();
|
||||
|
||||
switch (particleEffect) {
|
||||
case AMBIENT_ENTITY_EFFECT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case ANGRY_VILLAGER:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case BARRIER:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case BLOCK:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case BUBBLE:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case BUBBLE_COLUMN_UP:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case BUBBLE_POP:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case CLOUD:
|
||||
return Collections.singletonList(new PParticle(location, 0.0, 0.0, 0.0, 0.0));
|
||||
case CRIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case CURRENT_DOWN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DAMAGE_INDICATOR:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DOLPHIN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DRAGON_BREATH:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DRIPPING_LAVA:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case DRIPPING_WATER:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case DUST:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
case ENCHANT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 1.0));
|
||||
case ENCHANTED_HIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case END_ROD:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case ENTITY_EFFECT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case EXPLOSION:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case EXPLOSION_EMITTER:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case FALLING_DUST:
|
||||
for (int i = 0; i < 2; i++)
|
||||
particles.add(new PParticle(location.add(0, 0.75, 0), 0.6, 0.4, 0.6, 0.0));
|
||||
return particles;
|
||||
case FIREWORK:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case FISHING:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case FLAME:
|
||||
return Collections.singletonList(new PParticle(location, 0.1, 0.1, 0.1, 0.05));
|
||||
case FOOTSTEP:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case HAPPY_VILLAGER:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
case HEART:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case INSTANT_EFFECT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case ITEM:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case ITEM_SLIME:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case ITEM_SNOWBALL:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case LARGE_SMOKE:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case LAVA:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case MYCELIUM:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case NAUTILUS:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 1.0));
|
||||
case NOTE:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case POOF:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case PORTAL:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 1.0));
|
||||
case RAIN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SMOKE:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SPELL:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SPIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case SPLASH:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SQUID_INK:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case SWEEP_ATTACK:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case TOTEM_OF_UNDYING:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case UNDERWATER:
|
||||
for (int i = 0; i < 5; i++)
|
||||
particles.add(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
return particles;
|
||||
case WITCH:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
default:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case AMBIENT_ENTITY_EFFECT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case ANGRY_VILLAGER:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case BARRIER:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case BLOCK:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case BUBBLE:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case BUBBLE_COLUMN_UP:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case BUBBLE_POP:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case CLOUD:
|
||||
return Collections.singletonList(new PParticle(location, 0.0, 0.0, 0.0, 0.0));
|
||||
case CRIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case CURRENT_DOWN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DAMAGE_INDICATOR:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DOLPHIN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DRAGON_BREATH:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case DRIPPING_LAVA:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case DRIPPING_WATER:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case DUST:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
case ENCHANT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 1.0));
|
||||
case ENCHANTED_HIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case END_ROD:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case ENTITY_EFFECT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case EXPLOSION:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case EXPLOSION_EMITTER:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case FALLING_DUST:
|
||||
for (int i = 0; i < 2; i++)
|
||||
particles.add(new PParticle(location.add(0, 0.75, 0), 0.6, 0.4, 0.6, 0.0));
|
||||
return particles;
|
||||
case FIREWORK:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case FISHING:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case FLAME:
|
||||
return Collections.singletonList(new PParticle(location, 0.1, 0.1, 0.1, 0.05));
|
||||
case FOOTSTEP:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case HAPPY_VILLAGER:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
case HEART:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case INSTANT_EFFECT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case ITEM:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case ITEM_SLIME:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case ITEM_SNOWBALL:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case LARGE_SMOKE:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case LAVA:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case MYCELIUM:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case NAUTILUS:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 1.0));
|
||||
case NOTE:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case POOF:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case PORTAL:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 1.0));
|
||||
case RAIN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SMOKE:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SPELL:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SPIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case SPLASH:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SQUID_INK:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case SWEEP_ATTACK:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case TOTEM_OF_UNDYING:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case UNDERWATER:
|
||||
for (int i = 0; i < 5; i++)
|
||||
particles.add(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
return particles;
|
||||
case WITCH:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
default:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,11 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleOrbit extends DefaultParticleStyle {
|
||||
|
||||
private static final int orbs = 3;
|
||||
private static final int numSteps = 120;
|
||||
private int step = 0;
|
||||
|
||||
private int orbs;
|
||||
private int numSteps;
|
||||
|
||||
public ParticleStyleOrbit() {
|
||||
super("orbit", true, true, 0);
|
||||
}
|
||||
|
@ -21,9 +22,9 @@ public class ParticleStyleOrbit extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < orbs; i++) {
|
||||
double dx = -(MathL.cos((this.step / (double) numSteps) * (Math.PI * 2) + (((Math.PI * 2) / orbs) * i)));
|
||||
double dz = -(MathL.sin((this.step / (double) numSteps) * (Math.PI * 2) + (((Math.PI * 2) / orbs) * i)));
|
||||
for (int i = 0; i < this.orbs; i++) {
|
||||
double dx = -(MathL.cos((this.step / (double) this.numSteps) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i)));
|
||||
double dz = -(MathL.sin((this.step / (double) this.numSteps) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i)));
|
||||
particles.add(new PParticle(location.clone().add(dx, 0, dz)));
|
||||
}
|
||||
return particles;
|
||||
|
@ -31,17 +32,19 @@ public class ParticleStyleOrbit extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
public void updateTimers() {
|
||||
this.step = (this.step + 1) % numSteps;
|
||||
this.step = (this.step + 1) % this.numSteps;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("orbs", 3, "The number of orbs that orbit the player");
|
||||
this.setIfNotExists("steps", 120, "The number of spawning steps around the player");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.orbs = config.getInt("orbs");
|
||||
this.numSteps = config.getInt("steps");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleOverhead extends DefaultParticleStyle {
|
||||
|
||||
private double headOffset;
|
||||
private double particleSpreadX, particleSpreadY, particleSpreadZ;
|
||||
private double particleSpeed;
|
||||
private int particlesPerTick;
|
||||
|
||||
public ParticleStyleOverhead() {
|
||||
super("overhead", true, false, -0.5);
|
||||
}
|
||||
|
@ -16,8 +21,10 @@ public class ParticleStyleOverhead extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
particles.add(new PParticle(location.clone().add(0, 1.75, 0), 0.4F, 0.1F, 0.4F, 0.0F));
|
||||
particles.add(new PParticle(location.clone().add(0, 1.75, 0), 0.4F, 0.1F, 0.4F, 0.0F));
|
||||
|
||||
for (int i = 0; i < this.particlesPerTick; i++)
|
||||
particles.add(new PParticle(location.clone().add(0, this.headOffset, 0), this.particleSpreadX, this.particleSpreadY, this.particleSpreadZ, this.particleSpeed));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
||||
|
@ -28,12 +35,22 @@ public class ParticleStyleOverhead extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("head-offset", 1.75, "How far to offset the player location vertically");
|
||||
this.setIfNotExists("particle-spread-x", 0.4, "How far to spread the particles on the x-axis");
|
||||
this.setIfNotExists("particle-spread-y", 0.1, "How far to spread the particles on the y-axis");
|
||||
this.setIfNotExists("particle-spread-z", 0.4, "How far to spread the particles on the z-axis");
|
||||
this.setIfNotExists("particle-speed", 0.0, "The speed of the particles");
|
||||
this.setIfNotExists("particles-per-tick", 1, "How many particles to spawn per tick");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.headOffset = config.getDouble("head-offset");
|
||||
this.particleSpreadX = config.getDouble("particle-spread-x");
|
||||
this.particleSpreadY = config.getDouble("particle-spread-y");
|
||||
this.particleSpreadZ = config.getDouble("particle-spread-z");
|
||||
this.particleSpeed = config.getDouble("particle-speed");
|
||||
this.particlesPerTick = config.getInt("particles-per-tick");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,13 +9,15 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStylePoint extends DefaultParticleStyle {
|
||||
|
||||
private double offset;
|
||||
|
||||
public ParticleStylePoint() {
|
||||
super("point", true, false, -0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
return Collections.singletonList(new PParticle(location.clone().add(0.0, 1.5, 0.0)));
|
||||
return Collections.singletonList(new PParticle(location.clone().add(0.0, this.offset, 0.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,12 +27,12 @@ public class ParticleStylePoint extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("player-offset", 1.5, "How far to offset the player location vertically");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.offset = config.getDouble("player-offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,11 +11,16 @@ import org.bukkit.util.Vector;
|
|||
|
||||
public class ParticleStylePopper extends DefaultParticleStyle {
|
||||
|
||||
private double grow = 0.08f;
|
||||
private double radials = Math.PI / 16;
|
||||
private int helices = 2;
|
||||
private int step = 0;
|
||||
private int maxStep = 35;
|
||||
|
||||
private double grow;
|
||||
private double radials;
|
||||
private int helices;
|
||||
private int maxStep;
|
||||
private int popParticleAmount;
|
||||
private double popSpread;
|
||||
private double popSpeed;
|
||||
private double popOffset;
|
||||
|
||||
public ParticleStylePopper() {
|
||||
super("popper", true, true, 0.5);
|
||||
|
@ -33,11 +38,9 @@ public class ParticleStylePopper extends DefaultParticleStyle {
|
|||
particles.add(new PParticle(location.clone().add(v)));
|
||||
}
|
||||
|
||||
if (this.step == this.maxStep - 1) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
particles.add(new PParticle(location.clone().add(0, 1.5, 0), 0.5, 0.5, 0.5, 0.03));
|
||||
}
|
||||
}
|
||||
if (this.step == this.maxStep - 1)
|
||||
for (int i = 0; i < this.popParticleAmount; i++)
|
||||
particles.add(new PParticle(location.clone().add(0, this.popOffset, 0), this.popSpread, this.popSpread, this.popSpread, this.popSpeed));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -49,12 +52,26 @@ 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("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");
|
||||
this.setIfNotExists("pop-particle-amount", 10, "How many particles to spawn when the highest point is reached");
|
||||
this.setIfNotExists("pop-particle-spread", 0.5, "How much to spread out the popped particles");
|
||||
this.setIfNotExists("pop-particle-speed", 0.03, "How much speed to apply to the popped particles");
|
||||
this.setIfNotExists("pop-particle-offset", 1.5, "How far to vertically offset the pop particles location from the player");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.grow = config.getDouble("grow");
|
||||
this.radials = Math.PI / config.getInt("radials");
|
||||
this.helices = config.getInt("helices");
|
||||
this.maxStep = config.getInt("step-amount");
|
||||
this.popParticleAmount = config.getInt("pop-particle-amount");
|
||||
this.popSpread = config.getDouble("pop-particle-spread");
|
||||
this.popSpeed = config.getDouble("pop-particle-speed");
|
||||
this.popOffset = config.getDouble("pop-particle-offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,10 +11,13 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStylePulse extends DefaultParticleStyle {
|
||||
|
||||
private int points = 50;
|
||||
private double radius = 0.5;
|
||||
private double step = 0;
|
||||
private int numSteps = 15;
|
||||
|
||||
private int points;
|
||||
private double radius;
|
||||
private double offset;
|
||||
private int numSteps;
|
||||
private double speedMultiplier;
|
||||
|
||||
public ParticleStylePulse() {
|
||||
super("pulse", true, true, 0.5);
|
||||
|
@ -23,12 +26,12 @@ public class ParticleStylePulse extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
double speed = this.getSpeedByEffect(particle.getEffect());
|
||||
double speed = this.getSpeedByEffect(particle.getEffect()) * this.speedMultiplier;
|
||||
|
||||
if (this.step == 0) {
|
||||
for (int i = 0; i < this.points; i++) {
|
||||
double dx = MathL.cos(Math.PI * 2 * ((double) i / this.points)) * this.radius;
|
||||
double dy = -0.9;
|
||||
double dy = this.offset;
|
||||
double dz = MathL.sin(Math.PI * 2 * ((double) i / this.points)) * this.radius;
|
||||
double angle = Math.atan2(dz, dx);
|
||||
double xAng = MathL.cos(angle);
|
||||
|
@ -76,12 +79,20 @@ public class ParticleStylePulse extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("points", 50, "The number of points to spawn in the pulse circle");
|
||||
this.setIfNotExists("radius", 0.5, "The radius of the pulse circle");
|
||||
this.setIfNotExists("offset", -0.9, "The amount to vertically offset from the player location");
|
||||
this.setIfNotExists("delay", 15, "How many ticks to wait between pulses");
|
||||
this.setIfNotExists("speed-multiplier", 1, "A multiplier to change how fast the particles shoot away");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.points = config.getInt("points");
|
||||
this.radius = config.getDouble("radius");
|
||||
this.offset = config.getDouble("offset");
|
||||
this.numSteps = config.getInt("delay");
|
||||
this.speedMultiplier = config.getDouble("speed-multiplier");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,13 +10,14 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleQuadhelix extends DefaultParticleStyle {
|
||||
|
||||
private static final int orbs = 4;
|
||||
private static int maxStepX = 80;
|
||||
private static int maxStepY = 60;
|
||||
private int stepX = 0;
|
||||
private int stepY = 0;
|
||||
private boolean reverse = false;
|
||||
|
||||
private int orbs;
|
||||
private int maxStepX;
|
||||
private int maxStepY;
|
||||
|
||||
public ParticleStyleQuadhelix() {
|
||||
super("quadhelix", true, true, 0);
|
||||
}
|
||||
|
@ -24,10 +25,10 @@ public class ParticleStyleQuadhelix extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < orbs; i++) {
|
||||
double dx = -(MathL.cos((this.stepX / (double) maxStepX) * (Math.PI * 2) + (((Math.PI * 2) / orbs) * i))) * ((maxStepY - Math.abs(this.stepY)) / (double) maxStepY);
|
||||
double dy = (this.stepY / (double) maxStepY) * 1.5;
|
||||
double dz = -(MathL.sin((this.stepX / (double) maxStepX) * (Math.PI * 2) + (((Math.PI * 2) / orbs) * i))) * ((maxStepY - Math.abs(this.stepY)) / (double) maxStepY);
|
||||
for (int i = 0; i < this.orbs; i++) {
|
||||
double dx = -(MathL.cos((this.stepX / (double) this.maxStepX) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i))) * ((this.maxStepY - Math.abs(this.stepY)) / (double) this.maxStepY);
|
||||
double dy = (this.stepY / (double) this.maxStepY) * 1.5;
|
||||
double dz = -(MathL.sin((this.stepX / (double) this.maxStepX) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i))) * ((this.maxStepY - Math.abs(this.stepY)) / (double) this.maxStepY);
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
return particles;
|
||||
|
@ -36,28 +37,32 @@ public class ParticleStyleQuadhelix extends DefaultParticleStyle {
|
|||
@Override
|
||||
public void updateTimers() {
|
||||
this.stepX++;
|
||||
if (this.stepX > maxStepX) {
|
||||
if (this.stepX > this.maxStepX) {
|
||||
this.stepX = 0;
|
||||
}
|
||||
if (this.reverse) {
|
||||
this.stepY++;
|
||||
if (this.stepY > maxStepY)
|
||||
if (this.stepY > this.maxStepY)
|
||||
this.reverse = false;
|
||||
} else {
|
||||
this.stepY--;
|
||||
if (this.stepY < -maxStepY)
|
||||
if (this.stepY < -this.maxStepY)
|
||||
this.reverse = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("orbs", 4, "The number of orbs to spawn");
|
||||
this.setIfNotExists("steps-x", 80, "The number of steps for the x-axis");
|
||||
this.setIfNotExists("steps-y", 60, "The number of steps for the y-axis");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.orbs = config.getInt("orbs");
|
||||
this.maxStepX = config.getInt("steps-x");
|
||||
this.maxStepY = config.getInt("steps-y");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ import org.bukkit.Location;
|
|||
public class ParticleStyleRings extends DefaultParticleStyle {
|
||||
|
||||
private int step = 0;
|
||||
private final static int maxStep = 32;
|
||||
|
||||
private int maxStep;
|
||||
|
||||
public ParticleStyleRings() {
|
||||
super("rings", true, true, 0);
|
||||
|
@ -21,8 +22,8 @@ public class ParticleStyleRings extends DefaultParticleStyle {
|
|||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
|
||||
double ring1 = Math.PI / (maxStep / 2D) * this.step;
|
||||
double ring2 = Math.PI / (maxStep / 2D) * (((this.step + maxStep / 2D) % maxStep));
|
||||
double ring1 = Math.PI / (this.maxStep / 2D) * this.step;
|
||||
double ring2 = Math.PI / (this.maxStep / 2D) * (((this.step + this.maxStep / 2D) % this.maxStep));
|
||||
|
||||
particles.add(new PParticle(location.clone().add(MathL.cos(ring1), MathL.sin(ring1), MathL.sin(ring1))));
|
||||
particles.add(new PParticle(location.clone().add(MathL.cos(ring1 + Math.PI), MathL.sin(ring1), MathL.sin(ring1 + Math.PI))));
|
||||
|
@ -34,17 +35,17 @@ public class ParticleStyleRings extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
public void updateTimers() {
|
||||
this.step = (this.step + 1) % maxStep;
|
||||
this.step = (this.step + 1) % this.maxStep;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particles-per-ring", 32, "The number of particles that will spawn for each ring");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.maxStep = config.getInt("particles-per-ring");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,24 +10,25 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleSphere extends DefaultParticleStyle {
|
||||
|
||||
private int density;
|
||||
private double radius;
|
||||
|
||||
public ParticleStyleSphere() {
|
||||
super("sphere", true, true, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
int density = 15;
|
||||
double radius = 1.5f;
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < density; i++) {
|
||||
for (int i = 0; i < this.density; i++) {
|
||||
double u = Math.random();
|
||||
double v = Math.random();
|
||||
double theta = 2 * Math.PI * u;
|
||||
double phi = Math.acos(2 * v - 1);
|
||||
double dx = radius * MathL.sin(phi) * MathL.cos(theta);
|
||||
double dy = radius * MathL.sin(phi) * MathL.sin(theta);
|
||||
double dz = radius * MathL.cos(phi);
|
||||
double dx = this.radius * MathL.sin(phi) * MathL.cos(theta);
|
||||
double dy = this.radius * MathL.sin(phi) * MathL.sin(theta);
|
||||
double dz = this.radius * MathL.cos(phi);
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
|
||||
|
@ -41,12 +42,14 @@ public class ParticleStyleSphere extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("density", 15, "The number of particles to spawn per tick");
|
||||
this.setIfNotExists("radius", 1.5, "The radius of the sphere");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.density = config.getInt("density");
|
||||
this.radius = config.getDouble("radius");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,37 +10,43 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleSpin extends DefaultParticleStyle {
|
||||
|
||||
private static final int maxSteps = 30;
|
||||
private int step = 0;
|
||||
|
||||
private int maxSteps = 30;
|
||||
private double radius;
|
||||
private double offset;
|
||||
|
||||
public ParticleStyleSpin() {
|
||||
super("spin", true, true, -0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
double slice = (Math.PI * 2 / maxSteps) * this.step;
|
||||
double slice = (Math.PI * 2 / this.maxSteps) * this.step;
|
||||
|
||||
double radius = .5;
|
||||
double newX = location.getX() + radius * MathL.cos(slice);
|
||||
double newY = location.getY() + 1.5;
|
||||
double newZ = location.getZ() + radius * MathL.sin(slice);
|
||||
double newX = location.getX() + this.radius * MathL.cos(slice);
|
||||
double newY = location.getY() + this.offset;
|
||||
double newZ = location.getZ() + this.radius * MathL.sin(slice);
|
||||
return Collections.singletonList(new PParticle(new Location(location.getWorld(), newX, newY, newZ)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTimers() {
|
||||
this.step = (this.step + 1) % maxSteps;
|
||||
this.step = (this.step + 1) % this.maxSteps;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particles-per-rotation", 30, "The number of particles to spawn per rotation");
|
||||
this.setIfNotExists("radius", 0.5, "The radius of the circle");
|
||||
this.setIfNotExists("offset", 1.5, "The amount to vertically offset the player location");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.maxSteps = config.getInt("particles-per-rotation");
|
||||
this.radius = config.getDouble("radius");
|
||||
this.offset = config.getDouble("offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@ public class ParticleStyleSpiral extends DefaultParticleStyle {
|
|||
|
||||
private int stepX = 0;
|
||||
|
||||
private int particles = 12;
|
||||
private int particlesPerRotation = 90;
|
||||
private double radius = 0.8;
|
||||
|
||||
public ParticleStyleSpiral() {
|
||||
super("spiral", true, true, 0);
|
||||
}
|
||||
|
@ -19,10 +23,10 @@ public class ParticleStyleSpiral extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int stepY = -60; stepY < 60; stepY += 10) {
|
||||
double dx = -(MathL.cos(((this.stepX + stepY) / 90D) * Math.PI * 2)) * 0.8;
|
||||
double dy = stepY / 45D;
|
||||
double dz = -(MathL.sin(((this.stepX + stepY) / 90D) * Math.PI * 2)) * 0.8;
|
||||
for (double stepY = -60; stepY < 60; stepY += 120D / this.particles) {
|
||||
double dx = -(MathL.cos(((this.stepX + stepY) / (double) this.particlesPerRotation) * Math.PI * 2)) * this.radius;
|
||||
double dy = stepY / this.particlesPerRotation / 2D;
|
||||
double dz = -(MathL.sin(((this.stepX + stepY) / (double) this.particlesPerRotation) * Math.PI * 2)) * this.radius;
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
return particles;
|
||||
|
@ -35,12 +39,16 @@ public class ParticleStyleSpiral extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("particles", 12, "The number of particles to spawn around the player");
|
||||
this.setIfNotExists("particles-per-rotation", 90, "How many particles spawn before a full rotation is made");
|
||||
this.setIfNotExists("radius", 0.8, "The radius of the spiral");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.particles = config.getInt("particles");
|
||||
this.particlesPerRotation = config.getInt("particles-per-rotation");
|
||||
this.radius = config.getDouble("radius");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ public class ParticleStyleSwords extends DefaultParticleStyle implements Listene
|
|||
|
||||
private static final List<String> SWORD_NAMES;
|
||||
|
||||
private int multiplier;
|
||||
|
||||
static {
|
||||
SWORD_NAMES = new ArrayList<>();
|
||||
SWORD_NAMES.addAll(Arrays.asList("WOOD_SWORD", "STONE_SWORD", "IRON_SWORD", "GOLD_SWORD", "GOLDEN_SWORD", "DIAMOND_SWORD", "TRIDENT"));
|
||||
|
@ -33,13 +35,10 @@ public class ParticleStyleSwords extends DefaultParticleStyle implements Listene
|
|||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> baseParticles = DefaultStyles.NORMAL.getParticles(particle, location);
|
||||
|
||||
int multiplyingFactor = 15; // Uses the same logic as ParticleStyleNormal except multiplies the resulting particles by 3x
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < baseParticles.size() * multiplyingFactor; i++) {
|
||||
particles.add(baseParticles.get(i % baseParticles.size()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.multiplier; i++)
|
||||
particles.addAll(DefaultStyles.NORMAL.getParticles(particle, location));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -51,12 +50,12 @@ public class ParticleStyleSwords extends DefaultParticleStyle implements Listene
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("multiplier", 15, "The multiplier for the number of particles to spawn", "This style uses the same spawning as the 'normal' style");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.multiplier = config.getInt("multiplier");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
|
|
@ -9,19 +9,18 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleThick extends DefaultParticleStyle {
|
||||
|
||||
private int multiplier;
|
||||
|
||||
public ParticleStyleThick() {
|
||||
super("thick", true, true, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> baseParticles = DefaultStyles.NORMAL.getParticles(particle, location);
|
||||
|
||||
int multiplyingFactor = 10; // Uses the same logic as ParticleStyleNormal except multiplies the resulting particles by 10x
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < baseParticles.size() * multiplyingFactor; i++) {
|
||||
particles.add(baseParticles.get(i % baseParticles.size()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.multiplier; i++)
|
||||
particles.addAll(DefaultStyles.NORMAL.getParticles(particle, location));
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
@ -33,12 +32,12 @@ public class ParticleStyleThick extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("multiplier", 1, "The multiplier for the number of particles to spawn", "This style uses the same spawning as the 'normal' style");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.multiplier = config.getInt("multiplier");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,25 +10,14 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleTwins extends DefaultParticleStyle {
|
||||
|
||||
private static double[] cos, sin;
|
||||
private static final int orbs = 2;
|
||||
private static final int numSteps = 60;
|
||||
private int stepX = 0;
|
||||
private int stepY = 0;
|
||||
private int maxStepY = 30;
|
||||
private boolean reverse = false;
|
||||
|
||||
static {
|
||||
cos = new double[120];
|
||||
sin = new double[120];
|
||||
|
||||
int i = 0;
|
||||
for (double n = 0; n < numSteps; n++) {
|
||||
cos[i] = -MathL.cos(n / numSteps * Math.PI * 2);
|
||||
sin[i] = -MathL.sin(n / numSteps * Math.PI * 2);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
private int orbs = 2;
|
||||
private double radius = 1;
|
||||
private int numSteps = 60;
|
||||
private int maxStepY = 30;
|
||||
|
||||
public ParticleStyleTwins() {
|
||||
super("twins", true, true, 0);
|
||||
|
@ -37,10 +26,13 @@ public class ParticleStyleTwins extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
for (int i = 0; i < orbs; i++) {
|
||||
double dx = cos[(this.stepX + (numSteps / orbs * i)) % numSteps];
|
||||
for (int i = 0; i < this.orbs; i++) {
|
||||
double slice = Math.PI * 2 / this.numSteps;
|
||||
double orbSlice = Math.PI * 2 / this.orbs;
|
||||
|
||||
double dx = -MathL.cos(slice * this.stepX + orbSlice * i) * this.radius;
|
||||
double dy = (this.stepY / (double) this.maxStepY);
|
||||
double dz = sin[(this.stepX + (numSteps / orbs * i)) % numSteps];
|
||||
double dz = -MathL.sin(slice * this.stepX + orbSlice * i) * this.radius;
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
return particles;
|
||||
|
@ -49,7 +41,7 @@ public class ParticleStyleTwins extends DefaultParticleStyle {
|
|||
@Override
|
||||
public void updateTimers() {
|
||||
this.stepX++;
|
||||
if (this.stepX > numSteps) {
|
||||
if (this.stepX > this.numSteps) {
|
||||
this.stepX = 0;
|
||||
}
|
||||
|
||||
|
@ -66,12 +58,18 @@ public class ParticleStyleTwins extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("orbs", 2, "The number of particle orbs to spawn");
|
||||
this.setIfNotExists("radius", 1.0, "The radius of where to spawn the particles");
|
||||
this.setIfNotExists("horizontal-steps", 60, "The number of particles that spawn to make a full horizontal rotation");
|
||||
this.setIfNotExists("vertical-steps", 30, "The number of particles that spawn to move either up or down");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.orbs = config.getInt("orbs");
|
||||
this.radius = config.getDouble("radius");
|
||||
this.numSteps = config.getInt("horizontal-steps");
|
||||
this.maxStepY = config.getInt("vertical-steps");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,11 +34,12 @@ import org.bukkit.util.Vector;
|
|||
|
||||
public class ParticleStyleVortex extends DefaultParticleStyle {
|
||||
|
||||
private double grow = .05f;
|
||||
private double radials = Math.PI / 16;
|
||||
private int helices = 4;
|
||||
private int step = 0;
|
||||
private int maxStep = 70;
|
||||
|
||||
private double grow;
|
||||
private double radials;
|
||||
private int helices;
|
||||
private int maxStep;
|
||||
|
||||
public ParticleStyleVortex() {
|
||||
super("vortex", true, true, 0.5);
|
||||
|
@ -66,12 +67,18 @@ 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("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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.grow = config.getDouble("grow");
|
||||
this.radials = Math.PI / config.getInt("radials");
|
||||
this.helices = config.getInt("helices");
|
||||
this.maxStep = config.getInt("step-amount");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,9 +11,12 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleWhirl extends DefaultParticleStyle {
|
||||
|
||||
private int points = 2;
|
||||
private double step = 0;
|
||||
private int numSteps = 40;
|
||||
|
||||
private int points;
|
||||
private int numSteps;
|
||||
private double speedMultiplier;
|
||||
private double offset;
|
||||
|
||||
public ParticleStyleWhirl() {
|
||||
super("whirl", true, true, 0.5);
|
||||
|
@ -22,11 +25,11 @@ public class ParticleStyleWhirl extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
double speed = this.getSpeedByEffect(particle.getEffect());
|
||||
double speed = this.getSpeedByEffect(particle.getEffect()) * this.speedMultiplier;
|
||||
|
||||
for (int i = 0; i < this.points; i++) {
|
||||
double dx = MathL.cos(this.step + (Math.PI * 2 * ((double) i / this.points)));
|
||||
double dy = -0.9;
|
||||
double dy = this.offset;
|
||||
double dz = MathL.sin(this.step + (Math.PI * 2 * ((double) i / this.points)));
|
||||
double angle = Math.atan2(dz, dx);
|
||||
double xAng = MathL.cos(angle);
|
||||
|
@ -73,12 +76,18 @@ public class ParticleStyleWhirl extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("rays", 2, "The number of rays to spawn");
|
||||
this.setIfNotExists("steps", 40, "The number of ticks it takes to make a full rotation");
|
||||
this.setIfNotExists("speed-multiplier", 1, "A multiplier to change how fast the particles move");
|
||||
this.setIfNotExists("offset", -0.9, "The vertical offset from the player location");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.points = config.getInt("rays");
|
||||
this.numSteps = config.getInt("steps");
|
||||
this.speedMultiplier = config.getDouble("speed-multiplier");
|
||||
this.offset = config.getDouble("offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,9 +11,12 @@ import org.bukkit.Location;
|
|||
|
||||
public class ParticleStyleWhirlwind extends DefaultParticleStyle {
|
||||
|
||||
private int points = 3;
|
||||
private double step = 0;
|
||||
private int numSteps = 40;
|
||||
|
||||
private int points;
|
||||
private int numSteps;
|
||||
private double speedMultiplier;
|
||||
private double offset;
|
||||
|
||||
public ParticleStyleWhirlwind() {
|
||||
super("whirlwind", true, true, 0.5);
|
||||
|
@ -22,12 +25,12 @@ public class ParticleStyleWhirlwind extends DefaultParticleStyle {
|
|||
@Override
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<>();
|
||||
double speed = this.getSpeedByEffect(particle.getEffect()) * 2.5;
|
||||
double speed = this.getSpeedByEffect(particle.getEffect()) * this.speedMultiplier;
|
||||
|
||||
// Orbit going clockwise
|
||||
for (int i = 0; i < this.points; i++) {
|
||||
double dx = MathL.cos(this.step + (Math.PI * 2 * ((double) i / this.points)));
|
||||
double dy = -0.9;
|
||||
double dy = this.offset;
|
||||
double dz = MathL.sin(this.step + (Math.PI * 2 * ((double) i / this.points)));
|
||||
double angle = Math.atan2(dz, dx);
|
||||
double xAng = MathL.cos(angle);
|
||||
|
@ -74,12 +77,18 @@ public class ParticleStyleWhirlwind extends DefaultParticleStyle {
|
|||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("rays", 3, "The number of rays to spawn");
|
||||
this.setIfNotExists("steps", 40, "The number of ticks it takes to make a full rotation");
|
||||
this.setIfNotExists("speed-multiplier", 2.5, "A multiplier to change how fast the particles move");
|
||||
this.setIfNotExists("offset", -0.9, "The vertical offset from the player location");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.points = config.getInt("rays");
|
||||
this.numSteps = config.getInt("steps");
|
||||
this.speedMultiplier = config.getDouble("speed-multiplier");
|
||||
this.offset = config.getDouble("offset");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ public class ParticleStyleWings extends DefaultParticleStyle {
|
|||
|
||||
private int spawnTimer = 0; // Spawn particles every 3 ticks
|
||||
|
||||
private int spawnDelay;
|
||||
|
||||
public ParticleStyleWings() {
|
||||
super("wings", false, true, 0);
|
||||
}
|
||||
|
@ -36,17 +38,17 @@ public class ParticleStyleWings extends DefaultParticleStyle {
|
|||
@Override
|
||||
public void updateTimers() {
|
||||
this.spawnTimer++;
|
||||
this.spawnTimer %= 3;
|
||||
this.spawnTimer %= this.spawnDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDefaultSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.setIfNotExists("spawn-delay", 3, "The number of ticks to wait between particle spawns");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
|
||||
this.spawnDelay = config.getInt("spawn-delay");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue