Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

I'd like to give some firework items to a player, using a dispenser, or via some similar mechanism. How can I do this? Is it possible?

share|improve this question
1  
fireworks? is that new? –  Paralytic Dec 21 '12 at 18:28
    
@Paralytic yea its for the new year –  z ' Dec 21 '12 at 18:29
    
However activating them in the Vanilla 1.4.6 multiplayer server will disconnect the player wielding them with an "End Of Stream" error. Still, I can't help but look forward to what the community will create with Fireworks and Note Blocks. –  tombull89 Dec 21 '12 at 19:27
2  
Put a firework in a chest with a sign saying "fireworks here". –  Jeffrey Lin Apr 14 '13 at 16:56
add comment

8 Answers 8

up vote 16 down vote accepted
+50

The Dropper block, available since Minecraft 1.5, can be used for this purpose. It is similar to a dispenser, except that it does not “activate” items like arrows and fireworks, so they will be dropped for the player to pick them up instead.

share|improve this answer
    
This is definitely the right answer. –  jacen.garriss Dec 17 '13 at 20:14
add comment

When using a dispenser, the fireworks leave the dispenser armed, so that isn't much good.

Firework in dispenserLaunched firework

Also, because the fireworks all share an ID (401) command blocks can't be used (it just spawns a firework with no explosion in it).

You can, however, use spawners to spawn the dropped item entity (one of Seth Bling's scripts can be used.) These are harder to control, though, and limiting the amount of items the player gets can be tricky.

Dropped item entity Using MCedit to make the spawner Spawned from custom spawner

Note this technique can be used to spawn any custom item, such as enchanted weapons and custom potions.

share|improve this answer
    
Can't you use the data values with the /give command? –  MBraedley Dec 21 '12 at 18:48
4  
@MBraedley Fireworks don't even have data values, due to the number of different combinations of stars and fuse lengths it'd be impractical, they have the type of firework stored in their tile entity, like how books store their text. –  Ronan Forman Dec 21 '12 at 18:53
    
This could be updated to mention the new Dropper. –  SevenSidedDie Mar 23 '13 at 8:22
add comment

If you're playing on a CraftBukkit server, the Essentials plugin has a /firework command. You could give your players fireworks through the /give (item code 401) command and then let the players "customise" the fireworks with the /fireworks command.

The syntax for the command is (and will be applied to the stack of fireworks currently held in-hand)

/firework color:color fade:color shape:shape effect:effect

You can choose three colours for the inital burst using /firework color:red,blue,green. You can also choose the shape by using /firework shape:star,ball,large,creeper,burst (one of those 5) and change the effect with /firework effect:trail,twinkle. Power (flight) settings can be ajusted with /firework power:1,2,3

So, do a /give 401 for 64 fireworks, and then for a firework which bursts red, blue and green, does a large ball effect, twinkles/crackles and has maximum flight height you can use:

/firework color:red,blue,green shape:ball effect:twinkle power:3

share|improve this answer
    
This could be combined with command blocks, too. –  SevenSidedDie Feb 22 '13 at 17:25
    
@SevenSidedDie, would (or do) Command Blocks work with plugin commands? –  tombull89 Feb 22 '13 at 17:53
    
I can't confirm from experience, but they seem to from what I've read. –  SevenSidedDie Feb 22 '13 at 17:54
add comment

I have not tried this yet but I was thinking you could do this with a few Bukkit plugins - WorldEdit, Citizens, and Denizen.

  1. Create a chest and fill with the various fireworks you wish to give out.
  2. Using WorldEdit copy and save the chest as a schematic.
  3. Using Citizens and Denizen create a script that creates and uses a NPC (Non-Playable Character) to ask and offer the fireworks to players.
  4. In the Denizen script loads and reloads the chest schematic each time a player interacts with the NPC or just automatically reloads the chest after a set period of time.

I believe this should work as Denizen scripts allow you to load WorldEdit schematics.

share|improve this answer
add comment

You may leave it in a chest. then he will get it.

share|improve this answer
add comment

Because fireworks have weird metadata I made a tool to make fireworks easy. They are saved as kits so if you want players to have them, just give them access to the kit. You can find the tutorial at

and the download link will be in the description.

It's really simple to make complex and custom fireworks using this method.

share|improve this answer
add comment

Just write in a command block: give @p 401 1 color:red,blue,green shape:ball effect:twinkle power:2

share|improve this answer
add comment

There are several ways to give a player on your server Fireworks.

Of course, the obvious way is to simply craft them from Firework Stars and give them to the player. This requires materials, requires you to walk up to them, etc. You could leave them in a Chest, but that still isn't automatable.

You can try putting the Fireworks in a Dispenser, but it will fire them off rather than give them. Instead, the Dropper can be used to properly dispense Fireworks that a player can pick up and use.

The most flexible option, however, is the /give command. It requires being an Operator on the server, but the power it has in customizing the fireworks is incredible.

Using /give with Fireworks

Using a command of the form

/give <PLAYERNAME> fireworks <AMOUNT> 0 <DATA>

you can create arbitrarily complex fireworks, using colours not even present in the game, and give them to a player. It works both directly typed in, or through Command Blocks, though direct typing has much more strict character limits. Command blocks can use all the usual @p selector stuff in place of PLAYERNAME.

Explosion Data

The data format is as follows:

{Fireworks:{Flight:<FLIGHT LENGTH>, Explosions:[<EXPLOSION INFO>]}}

Flight length is a number, corresponding to the duration the firework should fly. Explosions will be of the following form:

{Type:<TYPE>, Colors[<COLORS>], Flicker:<0 or 1>, Trail:<0 or 1>}

And you can add multiple explosions by just putting commas between them. The Type is a number, with 0 for Small Ball, 1 for Large Ball, 2 for Star Shaped, 3 for Creeper Shaped, and 4 for Burst. Flicker and Trail (Which control the effects normally gained from using a Diamond or Glowstone Dust in the Firework Star)are 0 to not be used, 1 to be present, and can be omitted entirely.

The Colors section is a series of numbers, with commas between them. Each corresponds to a single colour used to create the firework. The numbers are in the form

Blue + 256 * Green + 256*256*Red

Where Blue, Green, and Red are numbers between 0 and 255. So 255 is solid blue, 65280 is solid green, and 16711680 is solid red.

Putting it together

So, putting it together, a /give command to give my character a single firework, with a fuse length of 3, and a single small-ball explosion of stark blue sparks, should look like:

/give wmailman fireworks 1 0 {Fireworks:{Flight:3, Explosions:[{Type:0, Colors:[255]}]}}

Whereas, a command to give me three fireworks, with a one-length fuse, with two explosions, one a red star, the other a green and blue large ball, would become:

/give wmailman fireworks 1 0 {Fireworks:{Flight:1, Explosions:[{Type:2, Colors:[16711680]}, {Type:1, Colors:[255, 65280]}]}}

And, just for one last example, you could use

/give wmailman fireworks 1 0 {Fireworks:{Flight:3, Explosions:[{Type:0, Colors:[255], Flicker:1, Trail:1}]}}

to create a version of the first fireworks, but with the explosion having both the flicker and trail effects.

Caveats

  • The colour listed on any firework created this way will be named "Custom" in the item, unless you use the exact colour codes created by crafting in-game. Unfortunately, I do not know what those numbers are exactly.

  • Almost everything in the data is case-sensitive.

Firework Stars

You can also do this with Firework Stars. The data tag will be in the format

{Explosion:<EXPLOSION INFO>}

Where the Explosion Info is the same as described for Fireworks.

Pictures

Because this post turned into a bit of a wall of text, here's some example shots of me using /give:

Me typing the command

Once that command is typed in, the resulting firework is added to my inventory:

Me holding the fireworks

The command used here was

/give wmailman fireworks 1 0 {Fireworks:{Flight:3, Explosions:[Type:0, Colors:[255, 65535]}]}}

This means a single firework, fuse length of 3, with one Small Ball explosion, with two colours, one solid blue, the other blue-green.

Despite the names of the colours displaying as Custom, the resulting explosion has nice pretty blue and blue-green sparks, as I expected:

The explosion

Sources:

The Minecraft Wiki Page on the player.dat format has a small section on Fireworks. The colour numbers are described elsewhere on that page. Most of the work lies in turning the result into the JSONish format Minecraft expects. Which is basically just leniently-parsed JSON.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.