Firework Rocket

A firework rocket is an item (and entity) used for creating decorative explosions, propelling the elytra, and loading into a crossbow as ammunition.

Obtaining
In Java Edition, fireworks can be obtained by crafting. A firework with no explosion effect is available on the Creative inventory.

Launching fireworks
To launch a firework rocket, its item on a block. They can also be launched from dispensers and crossbows.

Elytra
When the player holds a firework rocket in their hand and are gliding with the elytra, the firework rocket boosts the flying speed. If the rocket is equipped with a firework star of any kind, the player takes damage; the amount depends on the duration of the rocket. The duration or strength of the speed boost depends on the flight duration of the firework rocket.

Crossbow
A firework rocket can be used as ammunition for crossbows, although it deals damage only if it has an explosion effect. A higher flight duration gives the firework rocket a longer range, and more damage is added per firework star.

$$, if a firework rocket shot from a crossbow hits an entity, the rocket instantly explodes, no matter the flight duration. Attempting to do this $$, however, results in the firework passing through the entity, so the player must plan where to aim.

Behavior
Once launched, fireworks fly out vertically, with random horizontal offset up to 5 blocks. $$, fireworks can fly in any of the 6 directions a dispenser can point. After some time, the firework explodes into a colorful explosion based on the effects of the firework stars added upon crafting, or no explosion if no firework star was used. If multiple firework stars were added to the rocket upon crafting, they all explode simultaneously.

The explosion of a firework rocket deals to  points of damage, with one firework star. Each additional firework star on the rocket deals an additional to  points of damage. There is also a delay between detonation and the player hearing the sound, emulating real fireworks, but this sound travels much more slowly than in the real world. The explosion of a firework can be seen 64 blocks away, regardless of its height. Note: The explosion does not destroy end crystals, nor damage the Ender Dragon.

If the explosion exceeds the (unmodded) particle limit of 16,384, the oldest particles are removed before displaying new ones, resulting in severely diminished firework quality / duration. At most a firework should have 3 trail stars, more than that could waste diamonds, firework stars, and other fireworks. Particle counts per star are:

Twinkle effect adds 2 particles to the count.

Like most other entities, they can be moved by water and explosions, and teleported via portals. They also cannot move through solid surfaced blocks, upon hitting one, they either move to a side or explode based on the duration. If a firework explodes under a block, its explosion is flattened.

Duration and direction
Fireworks travel different heights based on the amount of gunpowder added. The number is displayed as a tag on the item's tooltip with the description of "Flight Duration".

The height it rises is between 12 to 22 blocks with 1 gunpowder, 23 to 39 blocks with 2 gunpowder, and 40 to 60 blocks with 3 gunpowder. (Note: Using command blocks, firework rockets with higher durations go higher and keep accelerating with virtually no terminal velocity. If the duration is long enough, the firework rocket could reach heights of over 1000000 blocks and speeds of over 10000 m/s in a matter of minutes. Such fireworks with significant X and Z motions speed up sideways exponentially and reach outside the world boundary in a matter of seconds.)

When spawned fireworks have a vertical speed of .05 and a random small X and Z speed (random value near zero with a standard deviation of .001). Each firework also determines its lifetime in ticks by 10 &times; (number of gunpowder + 1) + random value from 0 to 5 + random value from 0 to 6, after which it explodes. Each tick, the firework accelerates horizontally by multiplying its X and Z velocities by 1.15, and vertically by adding a constant factor of .04.

Fireworks can be made to travel different directions by being dispensed or launched under flowing water. The firework's direction then rapidly arcs to the horizontal and the travel distance increases to a point further than the height.

ID
Java Edition:

Bedrock Edition:

Item data

 * : The item's tag tag.

Trivia

 * Launching a rocket by hand on a wooden pressure plate activates it. The same doesn't hold for stone pressure plates, or for a dispenser placing a rocket onto a wooden pressure plate.
 * 2012 New Years is what inspired Jeb to add fireworks.
 * If the player shoots a firework into a Nether portal, it explodes in the Nether.