1.8.8 Trying to make Helix and its not coming out as planned

Discussion in 'Spigot Plugin Development' started by DragonTailGamin, Mar 15, 2020.


  1. here you see his friend start teleporting and when it starts it does the helix/spiral. Anyway thats how im trying to make it look. 47:53

    So what happens is a particle flame appears and starts circling the player for 10 seconds(ends about at the top of the players head) and then stops when the player teleports.

    Ive got the movement but the flames arent going in a circle they just spaz everywhere.
    https://gyazo.com/a4dcb58a1a59f72761be375fa7af9683 - here a gif of what my codes does. I cant figure out my problem!

    Also planning on adding that dark shadow effect you can see after he teleports but thatll be for later. Unless you wanna be a kind person and do it <3


    i used this video for mostly all the code, i'm not taking credit for the code!

    if it was a simple problem say but dont shit on me plz lol new to programming

    @EventHandler
    public void toggle(PlayerInteractEvent event){
    final Player player = event.getPlayer();
    if (event.getAction() == Action.LEFT_CLICK_AIR){
    new BukkitRunnable(){
    Location loc = player.getLocation();
    double t = 0;//time
    double r = 1;//size
    public void run(){
    t += Math.PI/32;//more particles per curve
    double x = r*Math.cos(t);
    double y = 0.1*t;//increase up slower
    double z = r*Math.sin(t); //well you are making it increase the distance by quite a lot
    loc.add(x, y, z);
    player.getWorld().playEffect(loc, Effect.FLAME, 100);
    loc.subtract(x, y, z);
    if (t > Math.PI*6.5){ //changes height(i think)
    this.cancel();
    }
    }
    }.runTaskTimer(Essentials.getEssentials(), 2, 1);
    }
    }
     
    #1 DragonTailGamin, Mar 15, 2020
    Last edited: Mar 15, 2020
  2. I would use spawParticle() instead of playEffect() it is more flexible and allows you to set the particle‘s velocity. But if I remember correctly this method doesn’t exist in 1.8. That’s probably the reason the guy in the video uses protollib for sending particle packets.
     
  3. Yeah spawParticle() is basically the same thing has playEffect() just newer version so yeah i cant use spawParticle! but it did look to have same parameters so i dont think there would have been a difference
     
  4. Code (Text):

          double y = 0;
          while (y < 2) {            
              for (int degree = 0; degree < 360; degree++) {
                    double radians = Math.toRadians(degree);
                    double x = Math.cos(radians);
                    double z = Math.sin(radians);
                    location.add(x, y, z);
                    location.getWorld().spawnParticle(particle, location, 0);
                    location.subtract(x, y, z);
                    y += 0.0035;
                }
         }
     
    This creates a single helix around the player. You can play with the y += 0.0035 to adjust how many times it wraps around the player.
    You will need to replace SpawnParticle with the 1.8 equivalent.
    This is a quick animation you will prolly have to setup a runnable to slow it down.
     
  5. The reason the particles are flying around rapidly like that is because the "extra" value is set to 1 when you use playEffect(). The extra value controls how fast the particles will move around, and the flame particle is extremely sensitive to this. You will need to use packets if you want to control this value (set to 0) since you are in 1.8. The easiest way to do this is to make use of DarkBlade12's ParticleLib which can be found here. Using that and what @Tarluin said should get you what you want.
     
    • Like Like x 1
  6. UnderNahc
    #8134
    yo can you add me on discord and help me fix it im trying my best right now but its not really working!