Reference: Mob Affixes
Registry type: LibDatabase.MOB_AFFIX (library_of_exile_mob_affix) — SyncTime.ON_LOGIN
ExileMobAffix
com.robertx22.library_of_exile.database.affix.types.ExileMobAffix
Abstract base. Implements JsonExileRegistry<ExileMobAffix>, GsonCustomSer<ExileMobAffix>.
Serialized fields
| Field | Type | Default | Description |
|---|---|---|---|
id |
String |
"" |
GUID |
affects |
Affects |
MOB |
Target type |
serializer |
String |
"" |
Type discriminator for Gson |
weight |
int |
1000 |
Weighted-random frequency |
modid |
String |
"" |
Owning mod id |
Affects enum
| Value | Meaning |
|---|---|
MOB |
Applied to non-player living entities |
PLAYER |
Applied to players |
AttributeMobAffix
Serializer string: "attribute_mob_affix"
Adds or multiplies an entity attribute.
AttributeMobAffix.Data record fields
| Field | Type | Description |
|---|---|---|
attribute_id |
String |
Attribute ResourceLocation (e.g. "minecraft:generic.max_health") |
uuid |
String |
UUID string for the AttributeModifier — must be unique per affix |
operation |
AttributeModifier.Operation |
ADDITION, MULTIPLY_BASE, or MULTIPLY_TOTAL |
number_range |
AffixNumberRange |
Min/max stat values |
Factory
AttributeMobAffix.Data.of(Attribute attribute, UUID uuid,
AttributeModifier.Operation op, AffixNumberRange range)
PotionMobAffix
Serializer string: "potion_mob_affix"
Applies a status effect on a recurring schedule.
PotionMobAffix.Data record fields
| Field | Type | Description |
|---|---|---|
status_effect_id |
String |
Effect ResourceLocation (e.g. "minecraft:speed") |
amplifer |
AffixNumberRange |
Amplifier range (0 = level I) |
duration_ticks |
AffixNumberRange |
Effect duration in ticks |
apply_every_x_seconds |
int |
Reapplication interval in seconds |
Convenience factories
Data.of5sEvery10s(MobEffect effect, AffixNumberRange amp)
Data.of3sEvery10s(MobEffect effect, AffixNumberRange amp)
Data.of1sEvery10s(MobEffect effect, AffixNumberRange amp)
Data.ofPermanent(MobEffect effect, AffixNumberRange amp) // 10 s / 10 s
AffixNumberRange
public float min;
public float max;
float getNumber(int perc) // linear interpolation: min + (max-min) * perc / 100
int getInt(int perc) // rounded version
perc range: 0–100.
ExileAffixData
Active affix instance attached to an entity.
public int perc; // power percentage, 0-100
public String affix; // GUID of the ExileMobAffix
public String uuid; // random UUID for this instance
Constructor: new ExileAffixData(String affixGuid, int perc)
GrabMobAffixesEvent
Fired by ExileEvents.GRAB_MOB_AFFIXES. Called at tick 3 (spawn) and every 20 ticks.
LivingEntity en
void add(ExileAffixData data)
Apply strategies
| Strategy | Attribute affixes | Potion affixes |
|---|---|---|
applyOnMobSpawn |
Adds the AttributeModifier |
No-op |
applyManually |
Adds the AttributeModifier |
No-op |
remove |
Removes the AttributeModifier |
Removes the effect |
onEverySecond |
No-op | Applies effect if tickCount % (20 * interval) == 0 |
JSON template
Attribute affix
{
"id": "my_mod:example_attribute",
"serializer": "attribute_mob_affix",
"affects": "MOB",
"weight": 1000,
"modid": "my_mod",
"attribute_id": "minecraft:generic.armor",
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"operation": "ADDITION",
"number_range": { "min": 2.0, "max": 10.0 }
}
Potion affix
{
"id": "my_mod:example_potion",
"serializer": "potion_mob_affix",
"affects": "MOB",
"weight": 800,
"modid": "my_mod",
"status_effect_id": "minecraft:slowness",
"amplifer": { "min": 0.0, "max": 2.0 },
"duration_ticks": 60,
"apply_every_x_seconds": 10
}
Datapack folder: data/<namespace>/library_of_exile_mob_affix/