Skip to content

Effects

ssbaxys edited this page Oct 26, 2026 · 1 revision

Fire, explosions, TNT, weather and particles right in the UI.

FxLayer is an effects layer you can put on top of anything (for example, in a StackLayout).

fx.spawn(VanillaFx.fire(x, y, 32, 32));                 // fire; .stop() fades it out
fx.spawn(VanillaFx.soulFire(x, y, 32, 32));
fx.spawn(VanillaFx.explosion(cx, cy, 1f));              // fireballs, flash, smoke, sparks, sound
fx.spawn(VanillaFx.primedTnt(x, -20, floorY, 22, 3f)    // falls, bounces, flashes, explodes
        .velocity(40, 0).onExplode(() -> panel.play(VanillaFx.shake(panel, 6, 0.5f))));
fx.spawn(VanillaFx.flames(x, y, 24));  fx.spawn(VanillaFx.lavaPop(x, y, 14));  fx.spawn(VanillaFx.smokePuff(x, y, 20));

Weather and particles:

  • snow and rain use the vanilla precipitation textures in two layers, plus flakes, drops and splashes; cherryLeaves, drips (water or lava), bubbles.
  • Particles: hearts, angry, happy, note (color depends on the note pitch), crit (normal and magic), totem, enchant (runes pulled toward a point).

Effects use vanilla textures and sounds by id, so they pick up the player's resource packs.

Registry by name. All built-in effects are registered as minecraft:*. Add your own in one line:

FxRegistry.register("mymod:confetti", (x, y, w, h) -> new Particles(null).gravity(140).wobble(30, 1.2f)
        .emitter((p, r, dt) -> p.emit(x + r.nextFloat() * w, y, 0, 40, 2f, 2f, Color.hsv(r.nextFloat() * 360, 0.7f, 1)), 3f));
fx.spawn("mymod:confetti");                 // over the whole layer
fx.spawn("minecraft:snow", x, y, w, h);     // a built-in one by name

Options for your own particles (Particles): gravity, drag, growth, tint, blend, wobble (sway), attract (pull toward a point), floor and ceiling (with a landing handler), streak (dashes along velocity), frames(BY_LIFE | LOOP | RANDOM), emitter. Without a sprite (new Particles(null)) particles are drawn as pixel squares. Effects can be combined: Effect.group(a, b). An effect without its own class: Effect.of(tick, render). For animated textures there is SpriteSheet.

Particles behind a menu (Backdrop.Kind.PARTICLES)

new Backdrop(Backdrop.Kind.PARTICLES)
        .particles(Backdrop.ParticleStyle.SNOW)  // SPARKS, SNOW, DUST
        .particleCount(90)
        .repel(60f, 900f)                        // cursor repel radius and strength
        .speed(1f);

Sparks rise and fade (drawn with additive blending), snow falls and sways, dust drifts slowly. The cursor pushes particles away, then they smoothly return to their speed. Your own colors: colors(...).


← Maps · English home · Blur, Clipping and GIF →

Clone this wiki locally