Commands/particle

Creates particles.

Java Edition
 * Syntax

Bedrock Edition


 * Color added to make reading easier.


 * Arguments


 * name (BE: name: string)
 * Specifies the particle to create. Must be a particle name (for example, ).


 * 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:   creates a pink particle at full opacity.


 * and  require a block and an optional state as a parameter. For example:


 * requires an item name as a parameter. For example:


 * x y z (BE: position: x y z )
 * 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.


 * xd yd zd (BE: size: x y z )
 * Specifies the size of the 3-dimensional cuboid volume to spawn particles in, centered on position x y z, and divided by about 8 (using  specifies a cuboid of about 8×8×8 in size).


 * Exception: When name is,  , or   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, xd yd zd are treated as a 3-dimensional volume as usual, rather than as a color, and randomized colors are used.
 * With  or ,   produces a black particle for example,   produces a green particle, and   produces a dark blue particle, etc.
 * The  particle's RGB channels behaves differently:


 * The other peculiarities are explained by this pseudocode:
 * {| class="wikitable"

! 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 = ).
 * {| class="wikitable" data-description="reddust examples"

! Input !! # Multiply !! # Randomize !! # Convert !! Result to   to
 * style="width: 60px;" |
 * style="width: 70px;" |
 * style="width: 170px;" |
 * style="width: 130px;" |
 * Multipliers have no effect, so the channel will stay at . Note that this is not possible for the red channel.
 * to
 * Since every possible value is less than, this channel will have a true bit value of  , even for the red channel. This is true for any input value that has an absolute value of less than.
 * to
 * to
 * This produces a wide range of values for the channel, with  as the upper bound.
 * to
 * to
 * This produces a range of only the two brightest bit values ( is now effectively the lower bound).
 * to
 * or
 * Similar to above. Note that if the randomized value is greater than, the channel wraps around to zero. This results in a some particles with bit   and some with bit   (i.e., some dark and some bright). Values closer to zero produce more dark particles, and values further from zero produce more bright particles.
 * to
 * to  and
 * to
 * to
 * This produces a range of only the two brightest bit values ( is now effectively the lower bound).
 * to
 * or
 * Similar to above. Note that if the randomized value is greater than, the channel wraps around to zero. This results in a some particles with bit   and some with bit   (i.e., some dark and some bright). Values closer to zero produce more dark particles, and values further from zero produce more bright particles.
 * to
 * to  and
 * to
 * or
 * Similar to above. Note that if the randomized value is greater than, the channel wraps around to zero. This results in a some particles with bit   and some with bit   (i.e., some dark and some bright). Values closer to zero produce more dark particles, and values further from zero produce more bright particles.
 * to
 * to  and
 * to
 * to  and
 * to
 * to  and
 * This can produce every possible bit value. However, due to both overlap (eg.,  and   give the same result due to modulo) and the triangular distribution caused by two random multipliers, some bit values are more likely.
 * to
 * to  and
 * to
 * to  and
 * to  and
 * This covers the entire range of byte values with no overlap, so the probability distribution of the values is nearly triangular ( is the most likely value, which becomes bit  ). Note that.
 * }
 * }


 * speed (BE: speed: float)
 * 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)
 * Specifies the display mode:  or  . Setting   will allow the particle(s) to be seen up to 256 blocks away and by players that use the minimal particles setting.


 * player (optional)
 * Allows control of which player should view this particle instead of everyone in the viewing range of the particle.


 * params (optional)
 * Allows,  ,   and   to be modified to view a specific item or block. Two parameters are accepted for.


 * For,   and  , the params argument specifies a numeric ID (block only) and a data value, using a single number: id+(data×4096).


 * For, 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: