Skip to main content

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.

ParameterTypeDescription
idstringFull identifier, e.g. "mymod:haste_ii"
settingstableOptional settings table (see below)

Settings Table

KeyTypeDefaultDescription
categorystring"neutral"Effect category: "beneficial", "harmful", or "neutral"
colorint0xFFFFFFRGB 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)