Reference: Mob Lists
Registry type: LibDatabase.MOB_LIST (library_of_exile_mob_list) — SyncTime.NEVER
MobList
com.robertx22.library_of_exile.database.mob_list.MobList
Implements IAutoGson<MobList>, JsonExileRegistry<MobList>, ITaggable<MobListTag>.
Serialized fields
| Field | Type | Default | Description |
|---|---|---|---|
id |
String |
"" |
GUID |
weight |
int |
1000 |
Selection weight relative to other mob lists |
mobs |
List<MobEntry> |
[] |
Weighted list of mob types |
tags |
MobListTagsHolder |
empty | Tags on this list |
Constructor
new MobList(String id, int weight, List<MobEntry> mobs, RegistryTag<MobList>... tags)
Key method
MobEntry getRandomMob() // weighted-random selection from mobs list
Datapack folder: data/<namespace>/library_of_exile_mob_list/
MobEntry
public int weight;
public String mob_id; // EntityType ResourceLocation string
Constructor:
new MobEntry(int weight, EntityType<?> mob)
// Stores ForgeRegistries.ENTITY_TYPES.getKey(mob).toString() into mob_id
MobListTagsHolder
Wraps the list of tag strings for serialization.
boolean has(RegistryTag<MobList> tag)
RegistryTag<MobList> / MobListTag
new MobListTag(String modid, String id)
// Full tag string: "modid:id"
Built-in tags (MobListTags)
| Constant | Full string | Meaning |
|---|---|---|
HAS_FLYING_MOBS |
library_of_exile:has_flying_mobs |
List contains flying entities |
HARVEST |
library_of_exile:harvest |
Harvest league context |
MAP |
library_of_exile:map |
General map spawning |
FOREST |
library_of_exile:forest |
Forest biome maps |
OBELISK |
library_of_exile:obelisk |
Ancient obelisk spawns |
Built-in mob lists (LibMobLists)
| Key | id | Tags |
|---|---|---|
GENERIC_UNDEAD |
generic_undead |
— |
SPIDER_FOREST |
spider_forest |
— |
NETHER |
nether |
HAS_FLYING_MOBS |
EVIL_VILLAGER |
evil_villager |
— |
GREEN |
green |
HAS_FLYING_MOBS |
FOREST |
forest |
FOREST, HARVEST |
MAP_DEFAULT |
map_default |
MAP |
Runtime API
ExileRegistryContainer<MobList> container = Database.getRegistry(LibDatabase.MOB_LIST);
// Weighted random list:
MobList list = container.random();
// Filter by tag then pick:
List<MobList> mapLists = container.getFiltered(
ml -> ml.tags.has(MobListTags.MAP)
);
MobList chosen = RandomUtils.weightedRandom(mapLists);
// Resolve the EntityType:
EntityType<?> type = ForgeRegistries.ENTITY_TYPES
.getValue(new ResourceLocation(chosen.getRandomMob().mob_id));
JSON template
{
"id": "my_mod:cave_mobs",
"weight": 1000,
"mobs": [
{ "weight": 1000, "mob_id": "minecraft:cave_spider" },
{ "weight": 500, "mob_id": "minecraft:silverfish" }
],
"tags": {
"tags": [
"library_of_exile:map"
]
}
}