Repository navigation
VFX
A small 3D effects engine (it came from AbyssOrigins): shockwaves, domes, beams, slashes, wings, rifts... The server
sends one small spec per effect, and every client builds and animates the geometry itself with AbyssCore's own
shaders (abysscore:abyss_band, abyss_field, abyss_void, abyss_glow). Same code on NeoForge 1.21.1 and Forge 1.20.1.
import com.gugas749.abysscore.api.vfx.AbyssVfx;
import com.gugas749.abysscore.api.vfx.VfxType;// Builder: every setter is optional
AbyssVfx.of(VfxType.SHOCKWAVE)
.at(pos) // Vec3, or .at(entity) = its feet
.scale(5) // meaning depends on the type (radius, height, size...)
.colors(0xFF6A1F, 0xFFD27A) // primary + highlight, 0xRRGGBB
.duration(18) // ticks
.send(level); // everyone within 96 blocks
// One-liners for the common ones
AbyssVfx.burst(level, pos, 1.2f, 0x9B6BFF, 0xE0D0FF);
AbyssVfx.sparks(level, pos, 1f, 0xFFD27A, 0xFFFFFF);
AbyssVfx.shockwave(level, pos, 5, 0xFF6A1F, 0xFFD27A, 18);
AbyssVfx.beam(level, from, to, 0.35f, 0xC0182E, 0xFF8A9A, 14);
AbyssVfx.helix(level, player, 2.4f, 0xE8C872, 0xFFFFFF, 30);| Builder method | Description |
|---|---|
at(Vec3) / at(Entity)
|
Where. Default: the followed entity's feet. |
dir(Vec3) / to(Vec3)
|
A facing vector (SLASH, RIFT, SPARKS, CRESCENT) or an absolute target point (BEAM, BOLT) |
scale(float), extra(float)
|
Per-type parameters (see the table below) |
color(rgb) / colors(rgb, rgb2)
|
Primary and highlight colours |
duration(ticks) |
Lifetime. Default 20. |
follow(Entity) |
Attached: moves with the entity and ends when it is removed |
flags(int) |
AbyssVfx.HALF, VOID, VERTICAL, REVERSE, SUSTAIN, STOP (OR them together) |
send(level) / send(level, range)
|
Everyone in the level within 96 (or range) blocks |
sendTo(player) / sendTo(players)
|
Only these players (private marks, "only you can see it") |
build() |
The VfxSpec itself (e.g. to play it client-side) |
VfxType |
scale | extra | Notes |
|---|---|---|---|
SHOCKWAVE |
max radius | Ground ring + rising wall + flash + sparks | |
DOME |
radius | Energy sphere; HALF = hemisphere, VOID = dark; may follow |
|
PILLAR |
height | radius | Column of light upward |
BEAM |
width | From at to to (absolute point) |
|
SLASH |
radius | sweep degrees | Crescent sweep facing dir; VERTICAL = upright, REVERSE = other way |
HELIX |
height | Twin ribbons spiralling up; REVERSE spins the other way |
|
SIGIL |
radius | star points | Rotating rune circle on the ground |
WINGS |
On follow; VOID = bat wings |
||
VORTEX |
radius | Spiral arms, lensing rings, black core | |
BURST |
size | Flash, star rays, shell, sparks; VOID = dark |
|
BOLT |
Forked lightning from at to to
|
||
TENDRILS |
height | count | Shadow tendrils from the ground |
TRAIL |
width | Ribbon behind follow
|
|
MARK |
Rotating reticle above follow
|
||
SPARKS |
count multiplier |
dir = bias velocity |
|
RIFT |
height | Portal slit facing dir; SUSTAIN keeps it open (see below) |
|
AURA |
radius | Ground ring + wisps around follow; VOID = smoke |
|
CRESCENT |
travel distance | crescent radius | Flies along dir with afterimages; VERTICAL / REVERSE change the lean |
Every built-in has the id abysscore:<name> (VfxType.SHOCKWAVE.id()), which is also what /abysscore vfx takes.
AbyssVfx.stop(level, player, VfxType.WINGS); // ends attached wings early
AbyssVfx.stop(level, player, VfxType.AURA, 0x7CD957); // only the aura with that primary colour
// A rift that stays open: send it again every few seconds (players who arrive late see it too);
// a client that already shows it just keeps it alive. It closes by itself when the re-sends stop.
AbyssVfx.of(VfxType.RIFT).at(pos).dir(facing).scale(2.4f).colors(0x9B6BFF, 0xE0D0FF)
.duration(200).flags(AbyssVfx.SUSTAIN).send(level);
// ...close it now (plays the closing animation)
AbyssVfx.of(VfxType.RIFT).at(pos).flags(AbyssVfx.STOP).send(level);Extend VfxInstance, draw with the VfxCanvas primitives, and register a factory once on the client. The server
plays it with AbyssVfx.of(yourId); flags bits 16-29 are free for your own options.
import com.gugas749.abysscore.api.vfx.client.AbyssVfxClient;
import com.gugas749.abysscore.api.vfx.client.VfxCanvas;
import com.gugas749.abysscore.api.vfx.client.VfxInstance;
public final class HaloEffect extends VfxInstance {
public HaloEffect(VfxSpec spec) { super(spec, spec.duration()); }
@Override
protected void draw(VfxCanvas c, float t, float pt) {
Vec3 top = anchor(pt).add(0, 2.3, 0); // follows the entity
float a = envelope(t, 0.2f, 0.3f); // fade in / out
c.ring(c.band, top, VfxCanvas.UP, 0.45, 0.12, 32, color(), a, seconds(pt));
c.glowDisc(top, 0.6, color2(), a * 0.5f);
}
}
// client only, once: e.g. in FMLClientSetupEvent -> event.enqueueWork(...) (both loaders)
AbyssVfxClient.register(ResourceLocation.fromNamespaceAndPath("mymod", "halo"), HaloEffect::new);
// server
AbyssVfx.of(ResourceLocation.fromNamespaceAndPath("mymod", "halo")).follow(player).colors(0xF6D77A, 0xFFFFFF).duration(100).send(level);VfxCanvas - all positions are world space:
| Material (field) | Look |
|---|---|
c.band |
Additive plasma ribbon: white-hot centre, flame edges (rings, beams, slashes) |
c.field |
Additive energy membrane with cells and scan lines (domes, shells) |
c.glow |
Plain additive vertex colour, no UV (soft glows, rays, sparks) |
c.voidMatter |
Dark translucent swirling matter with a coloured rim (rifts, tendrils, smoke) |
| Primitive | |
|---|---|
ring(vc, centre, normal, r, width, segs, rgb, a, uPhase) |
Flat annulus |
arc(vc, centre, basis, r, w, start, sweep, segs, rgb, a, uPhase) |
Partial ring that swells mid-arc |
wall(vc, centre, r, h, segs, rgb, aBottom, aTop, uPhase) |
Vertical cylinder |
ribbon(vc, pts, widths, alphas, rgb, uStart, uStep) |
Camera-facing tube through points |
flatRibbon(vc, pts, widths, alphas, normal, rgb, uStart, uStep) |
Ribbon lying in a plane |
stroke(vc, a, b, w, normal, rgb, alpha, u0, u1) |
Straight flat stroke |
sphere(vc, centre, r, lat, lon, rgb, a, rimPower, half, uPhase) |
UV sphere with a fresnel rim |
disc(vc, centre, e1, e2, rx, ry, segs, rgb, a, uPhase) |
Elliptical disc (hot core with BAND, black core with VOID) |
glowDisc(centre, r, rgb, a), rays(centre, len, w, count, rot, rgb, a), streak(head, dir, len, w, rgb, a), diamond(vc, c, r, rgb, a)
|
Camera-facing glows |
basis(n), onCircle(basis, angle), horizontal(v), ellipse(...), fill(n, v)
|
Maths helpers |
VfxInstance gives you spec, rand (seeded: every client draws the same shape), age, lifetime, anchor(pt),
bodyYaw(pt), followed(), seconds(pt), isLocalFirstPerson(), nearFade(...), easing (easeOut, smooth,
envelope) and spawnSparks(...) (the engine's own glowing particles). Override onTick(), release() (closing
animation on STOP), refresh() (SUSTAIN heartbeat) or cullDistance() when needed.
AbyssVfxClient.spawn(spec) plays a spec on this client only (no packet), clear() removes everything, count()
says how many are live (max 320). Effects are dropped when the player changes dimension.
- Setup: depending on AbyssCore
- Sides, threads and lifecycle: read this first
- Permissions
- Networking
- Synced player data
- Corruption
- Damage
- Continuous effects
- Screen overlays
- VFX: 3D effects
- Cinematics
- Sky
- Commands
- GUI toolkit
- GeckoLib
- Outside the API package: vanish and config queries
- Complete example: a mana mod
- Limitations, troubleshooting and changelog
- Quick reference