axicer

coneParticles

Jan 17th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. public static void cone(Player player){
  2.         final Location loc = player.getLocation();
  3.         new BukkitRunnable() {
  4.             double t = 0;
  5.             double r = 1.5;
  6.             @Override
  7.             public void run() {
  8.                 t += Math.PI/8;
  9.                 r -= 0.1;
  10.                 double x = r*Math.cos(t);
  11.                 double y = 0.5*t;
  12.                 double z = r*Math.sin(t);
  13.                 double xb = -r*Math.cos(t);
  14.                 double zb = -r*Math.sin(t);
  15.                 double xc = r*Math.cos(t+Math.PI/2);
  16.                 double zc = r*Math.sin(t+Math.PI/2);
  17.                 double xd = -r*Math.cos(t+Math.PI/2);
  18.                 double zd = -r*Math.sin(t+Math.PI/2);
  19.                 loc.add(x, y, z);
  20.                 ParticleEffect.FIREWORKS_SPARK.display(0, 0, 0, 0, 5, loc, 100);
  21.                 loc.subtract(x, y, z);
  22.                 loc.add(xb, y, zb);
  23.                 ParticleEffect.FIREWORKS_SPARK.display(0, 0, 0, 0, 5, loc, 100);
  24.                 loc.subtract(xb, y, zb);
  25.                 loc.add(xc, y, zc);
  26.                 ParticleEffect.FIREWORKS_SPARK.display(0, 0, 0, 0, 5, loc, 100);
  27.                 loc.subtract(xc, y, zc);
  28.                 loc.add(xd, y, zd);
  29.                 ParticleEffect.FIREWORKS_SPARK.display(0, 0, 0, 0, 5, loc, 100);
  30.                 loc.subtract(xd, y, zd);
  31.                 if(r <= 0.4){
  32.                     this.cancel();
  33.                 }
  34.             }
  35.         }.runTaskTimer(pl, 0, 1);
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment