Moving Helix Thing

Discussion in 'BungeeCord Plugin Development' started by ventrixcode, May 27, 2017.

  1. Hey!

    I wanted to create an Helix like this


    but in Code...

    I tried this:

    Code (Text):
        public static void coneEffect(final Player player){
            ParticleEffect.ParticleColor color;
            color = new ParticleEffect.OrdinaryColor(0, 0, 12);
            new BukkitRunnable(){
                double phi = 0;
                public void run(){
                    phi = phi + Math.PI/8;
                    double x, y, z;

                    Location location1 = player.getLocation();
                    for (double t = 0; t <= 2*Math.PI; t = t + Math.PI/8){
                            x = 0.8*(2*Math.PI-t)*0.5*Math.cos(t + phi );
                            y = 0.5*t;
                            z = 0.8*(2*Math.PI-t)*0.5*Math.sin(t + phi );
                            location1.add(x, y, z);
                        Vector vec = new Vector(0, 0, 0);
                        ParticleEffect.FLAME.display(vec, 120, location1, 20);
                            location1.subtract(x,y,z);

                    }

                    if(phi > 10*Math.PI){
                        this.cancel();
                    }
                }
            }.runTaskTimer(main.instance, 2, 0);
        }

    and even this
    Code (Text):
        public static void createHelix3(Player player) {
            Location loc = player.getLocation();
            int radius = 2;
            for(double y = 0; y <= 50; y+=0.05) {
                double x = radius * Math.cos(y);
                double z = radius * Math.sin(y);
                PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(EnumParticle.VILLAGER_HAPPY,true, (float) (loc.getX() + x), (float) (loc.getY() + y), (float) (loc.getZ() + z), 0, 0, 0, 0, 1);
                for(Player online : Bukkit.getOnlinePlayers()) {
                    ((CraftPlayer)online).getHandle().playerConnection.sendPacket(packet);
                }
            }
        }

    Can anyone of you help me out?

    Greeting Jan from Germany