Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public void sphereEffect(final Player player) {
  2. Location l = player.getLocation();
  3.  
  4.  
  5. double bigR = 4;
  6. for(int rInt = 0; rInt <= 20; rInt++) {
  7. double radius = 0.2 * rInt;
  8. for(double t = 0; t <= 2 * Math.PI; t += 0.2) {
  9. player.sendMessage("" + radius);
  10. double x = radius * Math.cos(t);
  11. double z = radius * Math.sin(t);
  12. double y = Math.sqrt((Math.pow(bigR, 2) - Math.pow(x, 2) - Math.pow(z, 2)));
  13. double y2 = -y;
  14.  
  15.  
  16. //The particle packet
  17. Packet packet = new PacketPlayOutWorldParticles("fireworksSpark", (float) (l.getX() + x), (float) (l.getY() + y), (float) (l.getZ() + z), 0, 0, 0, 0, 1);
  18. Packet packet2 = new PacketPlayOutWorldParticles("fireworksSpark", (float) (l.getX() + x), (float) (l.getY() + y2), (float) (l.getZ() + z), 0, 0, 0, 0, 1);
  19.  
  20. for(Player online : Bukkit.getOnlinePlayers()) {
  21. ((CraftPlayer) online).getHandle().playerConnection.sendPacket(packet);
  22. ((CraftPlayer) online).getHandle().playerConnection.sendPacket(packet2);
  23. }
  24. }
  25.  
  26. }
  27. player.sendMessage("0 square root: " + Math.sqrt(0));
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement