what are these beautiful fireworks?

Good question... custom fireworks, but without using any mod or removing default ones.

Just a datapack, a file you can put in the world folder and which will work for everyone in that world, also on (vanilla) servers.


You just need to download the datapack HERE


Do you want to add your own firework?

You need to know a little bit about datapacks. But you don't need to modify mine, you can create a new one. If you will use my datapack and your together, you will also get your personal fireworks, since my datapack will also read your datapack files.

These words are of little use, let's see how to add some fireworks.

1) Install Fireworks+ Datapack in your world

Download this file and place it in .minecraft/saves/aworldfolder/datapacks
You don't need to unzip the file, leave it as it is.
Join the world and type /reload

2) Create an empty datapack

Go in the same folder as before (.minecraft/saves/aworldfolder/datapacks) and create a new folder, called with a cool name. I will call it "Cool Fireworks".

Create a simple text file with this content:

You can choose what you want as description of the datapack, it doesn't matter. Save the file as pack.mcmeta inside the Datapack Folder (in my case it's Cool Fireworks). Also, create a folder called "data" inside it.

3) Add the function tags used to interact with the Firework+ Datapack

Simple, no? Inside the data-folder create a new folder, called "ulg", within it you need to create a matryoshka of folders: inside ulg place "tags", then "functions" inside tags, then "fireworks", then "sub". We finally did! You will get this path until sub... DatapackName/data/ulg/tags/functions/fireworks/sub. Very long and totally useless, since we will only work inside "sub" folder.

Inside "sub" you need to create 4 .json files called "checkitem.json", "performexplosion.json", "performfireworkchange.json" and "persistentfirework.json". What should you write inside them?

First, choose a namespace. Don't use "ulg","minecraft" or things with a few letters or you know other people use. I called my datapack folder "Cool Fireworks", so I will use "cool_fireworks" as namespace (no spaces, no points, no uppercase letters or strange characters. Avoid numbers).

So, taking "cool_fireworks" as namespace, let's write inside the 4 json files.

Open them using VS Code or Brackets (you could only use other text editor but I unsuggest doing it). Place {"replace":false,"values":["namespace:filename"]}. Namespace is the one you chose, like "cool_fireworks", Filename is the name of the file you are writing, but without the .json.

Example: With my magic namespace "cool_fireworks" I will modify checkitem.json.

Here my content. For "performexplosion.json" I will write performexplosion instead of checkitem.
Obviously, if you know how datapack works you know you can choose to call everything in a different way and how to place it.

4) Add the functions where we will work on.

Go inside the Datapack Folder, then open data-folder, and create a folder called as the namespace you chose before. I chose "cool_fireworks", so I will create the "cool_fireworks" folder.

Inside cool_fireworks or the namespace you chose, I will create a folder named "functions".

Do you remember the 4 json files? Now we will create 4 files with the same names, but with .mcfunction extension. So, inside data/cool_fireworks/functions I will create "checkitem.mcfunction", "performexplosion.mcfunction", "performfireworkchange.mcfunction" and "persistentfirework.mcfunction". These are text files, and you can easily modify them using the text editor you want. I will use VS Code anyway.

5) Create the new firework recipe

I will create the Barrier Firework, a simple one. It will create barrier particles when it explodes.

But first, I need to create the item and its recipe. I'm opening data/cool_fireworks/functions/checkitem.mcfunction
I want people need a Red Dye item to get the firework. The Red Dye item id is "minecraft:red_dye".
If you don't know the id of an item, go on minecraft with commands enabled, hold the item you want and type /data get entity @s SelectedItem.id The id will be minecraft:+what the game gave you.
So, I will write

execute if entity @e[type=item,tag=!global.ignore,distance=..0.5,nbt={Item:{id:"minecraft:red_dye",Count:1b}}] run data modify storage ulg:fireworks intick.checkitem set value "cool_fireworks:barrier"
execute if entity @e[type=item,tag=!global.ignore,distance=..0.5,nbt={Item:{id:"minecraft:red_dye",Count:1b}}] run kill @e[type=item,tag=!global.ignore,tag=!global.ignore.kill,distance=..0.5,nbt={Item:{id:"minecraft:red_dye",Count:1b}},limit=1]

Two lines, you only need to change minecraft:red_dye inside the id of the item you want, and cool_fireworks:barrier in yourdatapacknamespace:fireworknamespace. Your namespace is the one you chose before, the firework namespace is a new one. I want to add the Barrier Firework, so I chose "barrier" as firework namespace.

Remember the firework namespace, for the same firework you need to use the same namespace.

Now I will open data/cool_fireworks/functions/performfireworkchange.mcfunction and I will write this text inside:

execute if data storage ulg:fireworks {intick:{checkitem:"cool_fireworks:barrier"}} run data modify entity @s Item.tag.ulg set value {customfirework:1b,CustomFirework:"cool_fireworks:barrier",PersistentFirework:{IsPersistent:0b,RemoveDefaultDurability:0b}}

If you want to add more checks and changes, you need to know how datapacks work and redirect to a new function after run keyword.

Now, replace cool_fireworks:barrier with yourdatapacknamespace:fireworknamespace, as you did before.
If you want to know that, the firework data are the ones after "set value".

customfirework:1b means that fireworks is a custom one, so my datapack knows and applies the functions on it.
CustomFirework:"yourdatapackname:fireworknamespace" is used to set what custom firework it is. We want it to be our own firework.
PersistentFirework part is used for persistent fireworks, that is fireworks that last a long time exploding or doing things. I will not explain how to work on them in this tutorial. IsPersistent says to my datapack if the firework is persistent (1b) or not (0b). Again, use 0b since we don't need a persistent firework. RemoveDefaultDurability says the datapack if the firework will last 3 seconds (0b) or more (1b, and the time is specified inside the explosion function).

6) Create the Firework Explosion

Now I'm opening data/cool_fireworks/functions/performexplosion.mcfunction to write a line inside it.

execute as @s[type=minecraft:firework_rocket,tag=!global.ignore,nbt={FireworksItem:{tag:{ulg:{CustomFirework:"cool_fireworks:barrier"}}}}] run function cool_fireworks:explosions/barrier

Again, replace cool_fireworks:barrier with yourdatapacknamespace:fireworknamespace. Replace cool_fireworks:explosions/barrier with yourdatapacknamespace:explosions/fireworknamespace.

I know I am repeating the same thing many times, but I want it to be as understandable as possible and I hope to succeed.

Go on data/cool_fireworks/functions and create the "explosions" folder there. Inside this new folder, I will create barrier.mcfunction file. You will call it as the firework namespace but always with the .mcfunction extensions.

Open this new file...
I said I want it to create barrier particles, so I will just place "particle barrier ~ ~ ~ 1 1 1 1 500 force" in a line.

Remember you need to use relative coordinates (~ ~ ~) and force method for particles, or people will not be able to see it.

Done!

7) Get your firework playing survival or creative

Place an item frame on the floor or on a table, place a firework you created inside it, and drop the item you chose. For my example, I will drop a red dye on the item frame and wait (3 seconds). If you did the first steps well, the item will disappear and the firework will have become the custom one. How to know if it works? Find a beautiful plane and try it!

Here my cool_fireworks:barrier Firework