MobEffectRegistry — Mob Effect Registry API
Phase: Startup (startup_scripts/) via mob_effect.registry event
Register custom status effects that can then be applied to players using player.addEffect.
Cannot be hot-reloaded
Mob effects are registered into the Minecraft registry at startup. They cannot be added or removed at runtime with /atomicoffe reload.
Usage
Effects are registered inside the "mob_effect.registry" event:
onEvent("mob_effect.registry", function(e)
e.create("mymod:regen_ii", {
category = "beneficial",
color = 0xFF5555,
})
end)
e.create(id, settings)
Registers a new status effect.
| Parameter | Type | Description |
|---|---|---|
id | string | Full identifier, e.g. "mymod:haste_ii" |
settings | table | Optional settings table (see below) |
Settings Table
| Key | Type | Default | Description |
|---|---|---|---|
category | string | "neutral" | Effect category: "beneficial", "harmful", or "neutral" |
color | int | 0xFFFFFF | RGB particle colour as a hex integer |
Full Example
-- startup_scripts/effects.lua
onEvent("mob_effect.registry", function(e)
-- A beneficial blue glow effect
e.create("mymod:mystic_power", {
category = "beneficial",
color = 0x4444FF,
})
-- A harmful poison-like effect
e.create("mymod:withering_curse", {
category = "harmful",
color = 0x2D2D2D,
})
end)
Then apply the effect in server scripts:
-- server_scripts/main.lua
onEvent("player.join", function(e)
e.player.addEffect("mymod:mystic_power", 600, 0) -- 30 seconds, level I
end)