Skip to content

Instantly share code, notes, and snippets.

@williamburns
Created December 19, 2015 22:25
Show Gist options
  • Save williamburns/13245a8c5683f53bf945 to your computer and use it in GitHub Desktop.
Save williamburns/13245a8c5683f53bf945 to your computer and use it in GitHub Desktop.
public void playArc(final Player player){
new BukkitRunnable() {
double radius = 5;
double angle = 0;
double back = (Math.toRadians(360)) / 5;
Location loc = player.getLocation();
@Override
public void run() {
double t = 0;
for (int i = 1; i < 5; i++){
t+= Math.toRadians(360) / 5;
double x = radius * Math.cos(angle + t);
double z = radius * Math.sin(angle + t);
loc.add(x, 0, z);
ParticleEffect.FLAME.display(UtilVector.getVector(loc, player.getLocation()).multiply(0.75), 0.1F, loc, 1000D);
loc.subtract(x, 0, z);
x = radius * Math.cos(back + t);
z = radius * Math.sin(back + t);
loc.add(x, 0, z);
ParticleEffect.FLAME.display(UtilVector.getVector(loc, player.getLocation()).multiply(0.75), 0.1F, loc, 1000D);
loc.subtract(x, 0, z);
angle += Math.toRadians(360) / 5 / 20;
angle -= Math.toRadians(360) / 5 / 20;
}
}
}.runTaskTimer(getPlugin(), 0L, 1L);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment