Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sphereEffect(final Player player) {
- Location l = player.getLocation();
- double bigR = 4;
- for(int rInt = 0; rInt <= 20; rInt++) {
- double radius = 0.2 * rInt;
- for(double t = 0; t <= 2 * Math.PI; t += 0.2) {
- player.sendMessage("" + radius);
- double x = radius * Math.cos(t);
- double z = radius * Math.sin(t);
- double y = Math.sqrt((Math.pow(bigR, 2) - Math.pow(x, 2) - Math.pow(z, 2)));
- double y2 = -y;
- //The particle packet
- Packet packet = new PacketPlayOutWorldParticles("fireworksSpark", (float) (l.getX() + x), (float) (l.getY() + y), (float) (l.getZ() + z), 0, 0, 0, 0, 1);
- Packet packet2 = new PacketPlayOutWorldParticles("fireworksSpark", (float) (l.getX() + x), (float) (l.getY() + y2), (float) (l.getZ() + z), 0, 0, 0, 0, 1);
- for(Player online : Bukkit.getOnlinePlayers()) {
- ((CraftPlayer) online).getHandle().playerConnection.sendPacket(packet);
- ((CraftPlayer) online).getHandle().playerConnection.sendPacket(packet2);
- }
- }
- }
- player.sendMessage("0 square root: " + Math.sqrt(0));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement