@Override public void onRun() { Location location = getLocation(); for (int j = 0; j < stepsPerIteration; j++) { if (step % particles == 0) { rndF.clear(); rndAngle.clear(); } while (rndF.size() < arcs) { rndF.add(RandomUtils.random.nextFloat()); } while (rndAngle.size() < arcs) { rndAngle.add(RandomUtils.getRandomAngle()); } for (int i = 0; i < arcs; i++) { float pitch = rndF.get(i) * 2 * this.pitch - this.pitch; float x = (step % particles) * length / particles; float y = (float) (pitch * Math.pow(x, 2)); Vector v = new Vector(x, y, 0); VectorUtils.rotateAroundAxisX(v, rndAngle.get(i)); VectorUtils.rotateAroundAxisZ(v, -location.getPitch() * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -(location.getYaw() + 90) * MathUtils.degreesToRadians); display(particle, location.add(v)); location.subtract(v); } step++; } } }
@Override public void onRun() { Location location = getLocation(); location.add(RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * 0.6d)); location.add(0, RandomUtils.random.nextFloat() * 2, 0); display(particle, location); }
@Override public void onRun() { Location location = getLocation(); for (int i = 0; i < particles; i++) { Vector vector = RandomUtils.getRandomVector().multiply(radius); if (!sphere) { vector.setY(Math.abs(vector.getY())); } location.add(vector); display(particle, location); location.subtract(vector); } }
@Override public void onRun() { Location location = getLocation(); for (int i = 0; i < 20; i++) { location.add(RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * 0.6d)); location.add(0, RandomUtils.random.nextFloat() * 2, 0); display(particle, location); } }
@Override public void onRun() { if (radiusIncrease != 0) { radius += radiusIncrease; } Location location = getLocation(); location.add(0, yOffset, 0); for (int i = 0; i < particles; i++) { Vector vector = RandomUtils.getRandomVector().multiply(radius); location.add(vector); display(particle, location); location.subtract(vector); } }
double r1 = RandomUtils.getRandomAngle(), r2 = RandomUtils.getRandomAngle(), r3 = RandomUtils.getRandomAngle(); for (Vector v : cache) { if (v.getY() > 0) {
@Override public void onRun() { Location location = getLocation(); for (int i = 0; i < 10; i++) { Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * 0.6d); v.setY(RandomUtils.random.nextFloat() * 1.8); location.add(v); display(particle, location); location.subtract(v); } }
@Override public void onRun() { Location location = getLocation(); for (int i = 0; i < particlesNucleus; i++) { Vector v = RandomUtils.getRandomVector().multiply(radius * radiusNucleus); location.add(v); display(particleNucleus, location, colorNucleus); location.subtract(v); } for (int i = 0; i < particlesOrbital; i++) { double angle = step * angularVelocity; for (int j = 0; j < orbitals; j++) { double xRotation = (Math.PI / orbitals) * j; Vector v = new Vector(Math.cos(angle), Math.sin(angle), 0).multiply(radius); VectorUtils.rotateAroundAxisX(v, xRotation); VectorUtils.rotateAroundAxisY(v, rotation); location.add(v); display(particleOrbital, location, colorOrbital); location.subtract(v); } step++; } }
@Override public void onRun() { Location location = getLocation(); for (int x = 0; x < particles; x++) { if (step > particlesCone) { step = 0; } if (randomize && step == 0) { rotation = RandomUtils.getRandomAngle(); } double angle = step * angularVelocity + rotation; float radius = step * radiusGrow; float length = step * lengthGrow; Vector v = new Vector(Math.cos(angle) * radius, length, Math.sin(angle) * radius); VectorUtils.rotateAroundAxisX(v, (location.getPitch() + 90) * MathUtils.degreesToRadians); VectorUtils.rotateAroundAxisY(v, -location.getYaw() * MathUtils.degreesToRadians); location.add(v); display(particle, location); location.subtract(v); step++; } } }
@Override public void onRun() { Location location = getLocation(); for (int i = 1; i <= strands; i++) { double angle = 2 * i * Math.PI / strands + rotation; for (int j = 1; j <= particlesStrand; j++) { float ratio = (float) j / particlesStrand; double x, y, z; x = Math.cos(angle) * radius * ratio; y = Math.sin(Math.PI * j / particlesStrand) * height; z = Math.sin(angle) * radius * ratio; location.add(x, y, z); display(particle, location); location.subtract(x, y, z); } } for (int i = 0; i < particlesSpout; i++) { Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextFloat() * radius * radiusSpout); v.setY(RandomUtils.random.nextFloat() * heightSpout); location.add(v); display(particle, location); location.subtract(v); } }
Vector vector = RandomUtils.getRandomVector().multiply(sphereRadius); location.add(vector); display(sphereParticle, location, sphereColor);
@Override public void onRun() { Location location = getLocation(); location.add(0, yOffset, 0); for (int i = 0; i < 50; i++) { Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * cloudSize); display(cloudParticle, location.add(v), cloudColor, 0, 7); location.subtract(v); } Location l = location.add(0, .2, 0); for (int i = 0; i < 15; i++) { int r = RandomUtils.random.nextInt(2); double x = RandomUtils.random.nextDouble() * particleRadius; double z = RandomUtils.random.nextDouble() * particleRadius; l.add(x, 0, z); if (r != 1) { display(mainParticle, l); } l.subtract(x, 0, z); l.subtract(x, 0, z); if (r != 1) { display(mainParticle, l); } l.add(x, 0, z); } }
@Override public void onRun() { if (firework == null) { Builder b = FireworkEffect.builder().with(fireworkType); b.withColor(color).withColor(color2).withColor(color3); b.withFade(fadeColor); b.trail(true); firework = b.build(); } Location location = getLocation(); for (int i = 0; i < explosions; i++) { Vector v = RandomUtils.getRandomVector().multiply(radius); detonate(location, v); if (soundInterval != 0 && step % soundInterval == 0) { location.getWorld().playSound(location, sound, soundVolume, soundPitch); } } step++; }
Vector v = RandomUtils.getRandomCircleVector().multiply(radius); if (r.nextFloat() <= sideRatio) {
@Override public void onRun() { Location l = getLocation().add(0, yOffset, 0); for (int i = 0; i < (100 * cloudSize); i++) { Vector v = RandomUtils.getRandomCircleVector().multiply(RandomUtils.random.nextDouble() * cloudSize); if (showCloud) { display(cloudParticle, l.add(v), cloudColor, 0, 7); l.subtract(v); } } Location t = l.clone().add(0, .2, 0); double r = .45 * (maxTornadoRadius * (2.35 / tornadoHeight)); for (double y = 0; y < tornadoHeight; y += distance) { double fr = r * y; if (fr > maxTornadoRadius) { fr = maxTornadoRadius; } for (Vector v : createCircle(y, fr)) { if (showTornado) { display(tornadoParticle, t.add(v), tornadoColor); t.subtract(v); step++; } } } l.subtract(0, yOffset, 0); }