Description
# brokenFX
**Beautiful custom effects for your NeoForge mods — one line of code each.**
Rings that warn of a blow, beams, forking lightning, pillars of light out of the sky, glowing cracks, screen shake and flashes,
269 ready-made particle effects, real 3D props flying about, and animated Blockbench models. Make your own effects in a
**visual editor** and tweak them **live in game** — save the file and the effect changes in front of you.
brokenFX is a **library**: on its own it adds nothing to survival. Players install it because a mod needs it; modders use it to make
their bosses, spells and weapons look great without writing a renderer.
---
## For players
Drop `brokenfx-x.x.x.jar` into `mods` next to the mod that needs it. Works with Iris shader packs. That's all.
Want to look around? These client commands work in any world, even on servers:
| Command | What it does |
|---|---|
| `/brokenfx demo` | rings, lines, pillar, beam, lightning, glow, cracks, shake and flash at once |
| `/brokenfx gallery` | all 269 effects, one after another, with their names |
| `/brokenfx play [scale] name` | one effect where you look |
| `/brokenfx list` | every effect — click one to see it |
---
## For modders
### 1. Add it to your mod
Put `brokenfx-1.0.0.jar` in your project's `libs/` folder.
```groovy
dependencies {
implementation files('libs/brokenfx-1.0.0.jar')
// optional — ship brokenFX inside your jar, so players need not install it:
jarJar(files('libs/brokenfx-1.0.0.jar'))
}
```
And in `neoforge.mods.toml`:
```toml
[[dependencies.yourmod]]
modId = "brokenfx"
type = "required"
versionRange = "[1.0.0,)"
ordering = "AFTER"
side = "BOTH"
```
If two mods carry brokenFX inside, NeoForge loads only the newest copy. Not using Gradle? The download includes `tools/embed.py`,
which puts brokenFX inside any mod jar.
### 2. Effects in one line (server side)
Everything is called on the server and shown to every player within 96 blocks.
```java
import com.broken.fx.BrokenFX;
import com.broken.fx.FxColor;
BrokenFX.effect(level, "slam_wave", pos, 2f); // a built-in effect
BrokenFX.effect(level, "yourmod:fire_nova", pos, 1f); // yours: assets/yourmod/effects/fire_nova.json
BrokenFX.effect(level, "moss_aura", entity, Vec3.ZERO, 1f);// riding on an entity
BrokenFX.stop(level, entity); // stop looping effects on it
BrokenFX.ring(level, pos, 4f, 20, FxColor.FIRE); // a warning ring, fills in over 20 ticks
BrokenFX.line(level, from, to, 16, FxColor.GOLD); // a warning line (a charge's path)
BrokenFX.beam(level, from, to, 0.15f, 30, FxColor.VIOLET); // a beam of light
BrokenFX.bolt(level, from, to, 0.04f, 12, FxColor.ICE); // forking lightning
BrokenFX.glow(level, pos, 1.5f, 40, FxColor.GOLD); // a glow in the air
BrokenFX.pillar(level, pos, 2.5f, 20, FxColor.SUN); // a pillar of light from the sky
BrokenFX.cracks(level, pos, 3f, 40, FxColor.EMBER); // glowing cracks over the ground
BrokenFX.shake(level, pos, 24, 0.8f); // screen shake for everyone near
BrokenFX.flash(player, 0.6f, FxColor.WHITE); // a full-screen flash
```
A fair boss attack is: show `ring(...)` for 20 ticks, then deal the damage with `effect("slam_wave")` and `shake(...)`.
For "then" there is a small server clock: `Props.later(level, 20, () -> {...})` and `Props.every(level, 40, tick -> {...})`.
Colours: `FxColor.WHITE GOLD FIRE EMBER BLOOD VIOLET ARCANE ICE WATER NATURE POISON SOUL SHADOW SUN`, or any `0xRRGGBB`.
### 3. 3D props
Real items and blocks shown in the world for a moment — swords falling from the sky, crystals out of the floor. Never saved.
```java
import com.broken.fx.prop.Props;
Props.spikes(level, pos, 5, 3f, Blocks.LIME_STAINED_GLASS.defaultBlockState(), 30); // crystal spikes for 30 ticks
Display sword = Props.item(level, new ItemStack(Items.DIAMOND_SWORD), above,
Props.item(3f, new Quaternionf().rotateX((float) Math.PI)), true, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND);
Props.later(level, 20, () -> Props.move(sword, ground, 4)); // falls in 4 ticks
Props.goneIn(level, sword, 60);
```
Also `Props.block`, `Props.shape` (turn / stretch smoothly), `Props.move`, `Props.gone`, `Props.box`, `Props.spike`, `Props.toward(dir)`.
### 4. Your own light in your renderers (client side)
```java
import com.broken.fx.client.Light;
// keep one in your render state: public final Light light = new Light();
s.light.begin(entityX, entityY, entityZ, ageInTicks); // coordinates from here on are relative to the entity
s.light.glow(0, 1.5f, 0, 1.2f, 0.9f, 0.6f, 0.2f); // a soft glow
s.light.beam(0, 2, 0, 0, 12, 0, 0.1f, 0.02f, 1f, 0.8f, 0.3f); // a beam
s.light.bolt(0, 2, 0, 3, 0, 1, seed, 0.03f, 2, 0.5f, 0.6f, 1f); // lightning
s.light.circle(0, 0.05f, 0, 3f, 0.08f, 1f, 0.4f, 0.1f); // a ring on the ground
// in submit():
s.light.submit(poseStack, collector);
```
Also `ribbon` (a band along any path), `crack`, `flat`. To draw your own buffers: `Draw.glow / haze / xray`, `Draw.solid`,
`Draw.glowLayer` (a model's glowing parts from a glow map).
### 5. Animated Blockbench models
1. Convert: `python tools/bb2rig.py dragon.bbmodel --ns yourmod --out src/main/resources --glow bright`
Every animation in the file comes along. `--glow #ffd040` makes pixels of that colour glow.
2. Your entity implements `Animated`; `RigRenderer` draws it:
```java
public class Dragon extends Monster implements Animated {
public String rig() { return "yourmod:dragon"; }
public float rigScale() { return 2.5f; }
public void animate(Rig.Pose pose, float time, float pt) {
pose.loop("idle", time, 1);
pose.loop("walk", time, walkAnimation.speed(pt) * 2);
if (biteAt >= 0) pose.swing("bite", time - biteAt, 1); // fades in and out by itself
if (deathTime > 0) pose.once("death", deathTime + pt, 2, 1);
}
public float glow() { return angry ? 1f : 0.4f; }
}
// e.registerEntityRenderer(DRAGON.get(), RigRenderer::new);
```
`Pose` also has `at` (any time, e.g. backwards), `turn` (turn a bone by hand — a head following a target), `hide`, and `where`
(where a bone is now — hang light on a tail tip).
---
## Making your own effects
An effect is a small JSON file of layers: each layer spawns sprites — how many, how often, where, how they fly, grow, spin, what
colour they glow and how they fade.
1. **Open the editor** — online (link on this page) or `editor/index.html` from the SDK, works offline. Layers on the left, a live 3D preview in the middle next to a player-sized figure, every setting
on the right. Drag a field's label sideways to scrub its value. Start from any of the 269 built-in effects. Press **Copy JSON**.
2. **In game:** `/brokenfx folder` opens your effects folder. Save the JSON there as `name.json`, then `/brokenfx loop name`.
The effect loops in front of you and **changes the moment you save the file**.
Or `/brokenfx new name slam_wave` — a copy of a built-in effect, already looping, ready to edit.
3. **Ship it:** put the file in `assets/yourmod/effects/name.json` and call `BrokenFX.effect(level, "yourmod:name", pos, 1f)`.
Your own textures go in `assets/yourmod/textures/effect/` and are used as `"tex": "yourmod:file.png"`.
Units: 1 = one block. Time is in frames, 60 a second (a life of 30 is half a second). Velocity is blocks per frame (0.1 = 6 blocks a second).
| Field | Meaning |
|---|---|
| `end`, `loop` | how many frames layers spawn; whether it repeats |
| `tex` | texture: `glow ring spark dust tear shard pebble leaf petal spore wisp clod dustring rune_ring eye iris pupil ore_frame` or yours |
| `col` | colour R G B and strength, 0–255 |
| `blend` | `2` light (adds, glows), `1` paint (smoke, dust, leaves) |
| `life`, `count`, `gen`, `offset` | lifetime; how many (−1 endless); frames between spawns; delay |
| `scale`, `grow` | size in blocks; growth per frame |
| `pos`, `sphere`, `lat`, `effrot` | spawn offset; on a sphere of this radius; at this latitude (0 up, 90 round the sides, 180 down); fly outward |
| `vel`, `acc` | velocity and acceleration (gravity ≈ `{"y": [-0.01, -0.01]}`) |
| `bill`, `rot`, `spin` | facing: `0` camera, `1` upright, `2` own rotation (`rot.x = 90` lies flat); rotation; spin per frame |
| `fin`, `fout` | frames to fade in / out |
| `children` | layers riding on every sprite of this one |
Nearly every number is a range `[from, to]`: each sprite picks a random value between them.
### Commands for making effects
| Command | What it does |
|---|---|
| `/brokenfx loop name` | loop an effect where you look (live editing) |
| `/brokenfx new name [base]` | new file in your folder (a copy of base), looping |
| `/brokenfx folder` | open your effects folder |
| `/brokenfx reload` | read every effect again |
| `/brokenfx stop` | stop everything |
---
## What's in the download
- `brokenfx-1.0.0.jar` — the mod
- `brokenfx-sdk-1.0.0.zip` (additional file): sources, `docs/EFFECTS.md`, `tools/bb2rig.py` (Blockbench → rig), `tools/embed.py` (put brokenFX
inside your jar), the editor, and **Storm Wand** — a small example mod: a warning ring, then lightning, a custom JSON effect, cracks,
shake and crystal spikes.
**License: MIT** — use it, embed it, change it, in any mod, free or paid; just keep the copyright notice.
Made by Larik for the mod Arcanum, then set free.




