Skip to main content

ParticleBuilder

ParticleBuilder builds a particle definition. Create one with ParticleBuilder.create(Identifier) and register it through BundleEvents.registry { it.particles(...) } from a client entrypoint.

Creation​

MethodReturns
static create(Identifier id)builder

Core settings​

MethodNotes
.lifetime(int ticks)How long the particle lives.
.layer(ParticleLayer)TRANSLUCENT or OPAQUE render layer.
.alwaysShow()Visible even with reduced particle settings.
.factory(...)Swap the particle implementation.
.generateData(boolean)Skip JSON generation.

Colour and size​

MethodNotes
.color(Color)Single color.
.color(Color start, Color end, Easing)Fade between two colors.
.colorData(...)Raw color data object.
.scale(float) / .scaleData(ParticleScaleData)Size over time, optionally keyframed.

Motion​

MethodNotes
.velocity(Vector3d)Constant velocity in blocks per second.
.velocityData(...)Velocity over time.
.positionData(...) / .rotationData(...)Position and rotation over time.

Keyframes​

Keyframed data uses KeyframeSequence<T>:

new KeyframeSequence<Float>()
.add(value, time, easing)
.add(value, time, easing)

Each .add is a point on the curve. Between points the engine interpolates with the easing function.