Attaching entities to other entities

Discussion in 'Plugin Development' started by Charliebiff05, Jul 7, 2018.

Thread Status:
Not open for further replies.
  1. Offline


    Hey there my name is charlie and Im new to coding bukkit plugins, not looking to be spoonfed but if anyone can give me a pointer or two about how I would go about say attaching a firework entity to a snowball.

  2. @Charliebiff05
    Well, what do you mean by 'attaching':
    1. If you want the firework to ride the snowball, you would just need to set the firework as a passager for the snowball.
    2. If you mean attach as in to add a lead the entities, you would just need to set the snowball as the leash holder for the firework.
    3. If you mean you want to store in memory the firework and the snowball, so you can get the firework by getting the snowball, create a HashMap<SnowBall, Firework>. Use the .put() method to initially add them to the hashmap, and the .get(Snowball) method to get the firework.
  3. Offline


    I'll be setting the firework as a passenger to the snowball, but if I only wanted the explosion and not the trail of the rocket flying in the air how would that be done?

  4. Offline


    @Charliebiff05 well Firework#detonate() will instantly make the firework explode. Do you mean that?
  5. Offline


    yes that's what I meant! thanks @MightyOne , how would I spawn the firework as a passenger...?
    cheers guys

    and how would I loop it so that every half second a new detonated firework spawns
    Last edited: Jul 11, 2018
  6. Offline


    That can be done with a BukkiRunnable.
    Just put the spawning of the Firework inside the BukkiRunnable
    Firework f = world.spawn...
    and run it as BukkiRunnable#runTaskTimer(...)
Thread Status:
Not open for further replies.

Share This Page