Created
December 19, 2015 22:25
-
-
Save williamburns/13245a8c5683f53bf945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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