Interface ParticleDescription

Custom particle type params object.

interface ParticleDescription {
    acceleration?: [number, number, number];
    addLifetimeAfterImpact?: number;
    animators?: {
        alpha?: AnimatorDescription;
        color?: ColorAnimatorDescription;
        icon?: AnimatorDescription;
        size?: AnimatorDescription;
        texture?: AnimatorDescription;
    };
    collision?: boolean;
    color?: [number, number, number, number];
    color2?: [number, number, number, number];
    emitters?: {
        death?: SubEmitterDescription;
        idle?: SubEmitterDescription;
        impact?: SubEmitterDescription;
    };
    framesX?: number;
    framesY?: number;
    friction?: {
        air?: number;
        block?: number;
    };
    isUsingBlockLight?: boolean;
    keepVelocityAfterImpact?: boolean;
    lifetime: [number, number];
    rebuildDelay?: number;
    render?: number;
    size: [number, number];
    texture: string;
    velocity?: [number, number, number];
}

Properties

acceleration?: [number, number, number]

Particle's acceleration, if it's spawned without this parameter.

[0, 0, 0]
addLifetimeAfterImpact?: number

Particle will lose given number of ticks from it's maximum lifetime, when touching a block.

This value makes sense only if collision param is true.

0
animators?: {
    alpha?: AnimatorDescription;
    color?: ColorAnimatorDescription;
    icon?: AnimatorDescription;
    size?: AnimatorDescription;
    texture?: AnimatorDescription;
}

Animators allow to change some properties of the specific particle depending on the time, each animator is described as an object of definite format and can be not described, if it's not needed.

Type declaration

  • Optionalalpha?: AnimatorDescription

    Describes the particle's opacity, for the unit value the alpha in the color parameter from the type's description is taken.

  • Optionalcolor?: ColorAnimatorDescription

    Describes the animated color value, if particle supports it. Accepts values in RGBA ranges, like color property in descriptor.

    2.0.4b38

  • Optionalicon?: AnimatorDescription

    Describes the animation frame, if particle supports it. Must have the value between 0 and 1.

  • Optionalsize?: AnimatorDescription

    Describes the behavior of particle's size, for the unit size the size from the type's description is taken.

  • Optionaltexture?: AnimatorDescription

    Describes the animation frame, if particle supports it. Must have the value between 0 and 1.

    Use icon instead.

collision?: boolean

If true, particle won't go through blocks. It reduces performance if there are lots of these particles.

false.
color?: [number, number, number, number]

Four component color of the particle (RGBA).

[1, 1, 1, 1]
color2?: [number, number, number, number]

2.0.4b38

emitters?: {
    death?: SubEmitterDescription;
    idle?: SubEmitterDescription;
    impact?: SubEmitterDescription;
}

Sub-emitters (don't confuse with emitters) describe how specific particle can emit other particles, according to some events, that may happen to it. Each sub-emitter is described as an object of definite format and can be not described if it's not needed.

Type declaration

framesX?: number

Animation frame grid size around width.

2.0.4b38

framesY?: number

Animation frame grid size around height.

2.0.4b38

friction?: {
    air?: number;
    block?: number;
}

Particle's speed modifier in the air and when touching a block. Usually it's a number between 0 and 1, close to 1, but in fact it can be any value. Both values are 1 by default.

Type declaration

  • Optionalair?: number
  • Optionalblock?: number

    This value makes sense only if collision param is true.

isUsingBlockLight?: boolean

If true, the particle will be exposed to the world's lighting. If false, the particle will always have maximum brightness. Enabling this parameter may reduce the performance when having lots of particles.

false.
keepVelocityAfterImpact?: boolean

If false, particle's speed will be set to zero when touching a block. If true, the speed will be saved.

This value makes sense only if collision param is true.

lifetime: [number, number]

Minimum and maximum particle's lifetime in ticks.

rebuildDelay?: number

Time in ticks between particle mesh updates.

2.0.4b38

render?: number

Particle's render type:

  • 0 - additive
  • 1 - without blending
  • 2 - with blending
size: [number, number]

Minimum and maximum size of the particle.

texture: string

Particle's texture name from /particle-atlas resource directory.

velocity?: [number, number, number]

Particle's initial velocity, if it's spawned without initial speed parameter.

[0, 0, 0]

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.