Commands/particle

From Minecraft Wiki
Jump to: navigation, search
Java Edition.pngMclogo.svg
particle
Restrictions

Operator

First introduced

1.8 (14w04a)
PE 1.0.5 (PE 1.0.5 build 1)

Creates particles.

Syntax

Java Edition

particle <name> [<pos>] [<delta>] [<speed>] [<count>] [<mode>] [<player>]

Bedrock Edition

particle <name: string> <position: x y z> <size: x y z> <speed: float> [count: int]
Color added to make reading easier.
Arguments
name (BE: name: string)
Specifies the particle to create. Must be a particle name (for example, explosion).
  • dust requires 4 color channel parameters to be set along with the name, representing red, green, blue and alpha, each being a value in the range 0 to 1. For example: /particle dust 1.0 0.5 0.5 1.0 creates a pink particle at full opacity.
  • block and falling_dust require a block and an optional state as a parameter. For example: /particle block minecraft:grass_block[snowy=true]
  • item requires an item name as a parameter. For example: /particle item minecraft:apple
pos (BE: position: x y z) (optional[Java Edition only])
Specifies the position at which to create the particle. All values (including y) must be between -30,000,000 and 30,000,000 (inclusive, without the commas). May use tilde notation to specify a position relative to the command's execution.
delta (BE: size: x y z) (optional[Java Edition only])
Specifies the size of the 3-dimensional cuboid volume to spawn particles in, centered on position pos, and divided by about 8 (using 1 1 1 specifies a cuboid of about 8×8×8 in size).
Exception:[Bedrock Edition only] When name is reddust, mobSpell, or mobSpellAmbient and speed is not 0, and count is 0 or not specified, these values are set as the RGB channel values of the color of the particle, and are specified in the range 0 to 1. In this usage, the speed parameter acts as a multiplier on these values. If count is greater than 0 for those particles, delta are treated as a 3-dimensional volume as usual, rather than as a color, and randomized colors are used.
With mobSpell or mobSpellAmbient, 0 0 0 produces a black particle for example, 0 1 0 produces a green particle, and 0 0 0.5 produces a dark blue particle, etc.
The reddust particle's RGB channels behaves differently:
reddust
If xd is set to 0, it will be treated as 1.
The xd yd zd parameters can be set outside the range 0 to 1; a modulo operator fixes the color channels to the appropriate range.
Each channel's value is multiplied by a separate random value from 0.8 to 1.0, then by a single random value from 0.6 to 1.0.
A conversion to a Byte is applied to each channel, resulting in effective rounding towards zero.
The special behavior of the red channel can be worked around by setting its value to 0.001:
given value effective value color
0 0 0, or 1 0 0 1 0 0 red
0 1 0, or 1 1 0 1 1 0 yellow
0 0.5 0, or 1 0.5 0 1 0.5 0 orange
0 0 1, or 1 0 1 1 0 1 purple
0 1 1, or 1 1 1 1 1 1 white
0.001 0 0 0.001 0 0 black
0.001 1 0 0.001 1 0 green
0.001 0 1 0.001 0 1 blue
The other peculiarities are explained by this pseudocode:
Pseudocode
Set Red = xd, Green = yd, Blue = zd
Multiply each (Red, Green, Blue) by speed
If Red = 0 then set Red = 1
Set AllChannelMultiplier = RandomBetween(0.6, 1.0)
For each channel (Red, Green, Blue):
 ## Multiply (so that we step towards the range of a Byte)
 Multiply channel by 256
 ## Randomize (note that this causes a triangular distribution
 ## such that 0.74 is the mean net multiplier)
 Multiply channel by RandomBetween(0.8, 1.0)
 Multiply channel by AllChannelMultiplier
 ## Convert (to an actual Byte value)
 Round channel toward zero, to the nearest integer
 Set channel = channel Mod 256
Return color of this particle as (Red, Green, Blue)
To better illustrate this process, consider these particular values, which can be used for any of xd yd zd to affect their respective channels (with the exception of xd = Red = 0).
Input # Multiply # Randomize # Convert Result
0 0 0 0 Multipliers have no effect, so the channel will stay at 0. Note that this is not possible for the red channel.
0.001 0.256 0.12288 to 0.256 0 Since every possible value is less than 1, this channel will have a true bit value of 0, even for the red channel. This is true for any input value that has an absolute value of less than 1 / 256.
0.99 253.44 121.65 to 253.44 121 to 253 This produces a wide range of values for the channel, with 0.99 as the upper bound.
-0.01 -2.56 -2.56 to -1.2288 254 to 255 This produces a range of only the two brightest bit values (0.99 is now effectively the lower bound).
-0.006 -1.536 -1.536 to -0.73728 255 or 0 Similar to above. Note that if the randomized value is greater than -1, the channel wraps around to zero. This results in a some particles with bit 255 and some with bit 0 (i.e., some dark and some bright). Values closer to zero produce more dark particles, and values further from zero produce more bright particles.
2 512 245.76 to 512 245 to 255 and

0 to 255

This can produce every possible bit value. However, due to both overlap (eg., 245.76 and 501.76 = (245.76 + 256) give the same result due to modulo) and the triangular distribution caused by two random multipliers, some bit values are more likely.
1.921 491.776 236.05248 to 491.776 236 to 255 and

0 to 235

This covers the entire range of byte values with no overlap, so the probability distribution of the values is nearly triangular (363.91424 is the most likely value, which becomes bit 107). Note that 1.921 ~ 1 / (1 - 0.48).
speed (BE: speed: float) (optional[Java Edition only])
Specifies the speed of the particle. Must be at least 0.
count (BE: count: int) (optional)
Specifies the number of particle effects to create. Must be at least 0 (which produces one particle).
mode (optional) [Java Edition only]
Specifies the display mode: normal or force. Setting force will allow the particle(s) to be seen up to 256 blocks away and by players that use the minimal particles setting.
player (optional) [Java Edition only]
Allows control of which player should view this particle instead of everyone in the viewing range of the particle.
params (optional) [Java Edition only]
Allows blockdust, iconcrack, blockcrack and fallingdust to be modified to view a specific item or block. Two parameters are accepted for iconcrack.
For blockdust, blockcrack and fallingdust, the params argument specifies a numeric ID (block only) and a data value, using a single number: id+(data×4096).
For iconcrack, two params arguments specify the numeric id (block ID or item ID) and the data value separately.
Result
Fails if the arguments are not specified correctly.
On success, creates the specified particle.
Examples
To create a stationary huge explosion particle 10 blocks to the east:
particle explosion_emitter ~10 ~ ~ 0 0 0 0