Skip to content

Create Custom Firework

WolfyScript edited this page Jan 3, 2022 · 7 revisions

To create a new Firework, you need to write your own class in your separate plugin.

The two default abstract classes with predefined behaviour.

  • BlockFireWork - A firework that can be placed into the world.
  • ItemFireWork - A firework using a projectile like eggs, arrows, snowballs, etc.

If you would like to make a firework with custom behaviour, you should extend the AbstractFireWork directly.

Each firework requires a unique NamespacedKey to identify it. It is recommended to use your plugin for the NamespacedKey.

new NamespacedKey(yourPlugin, "your_custom_firework");

When done creating it, you need to register the firework, so the plugin can use it.

FireWorksRegistry registry = FancyFirework.getPlugin().getRegistry();

registry.register(yourCustomFirework);

BlockFireWork

ItemFireWork

Clone this wiki locally