Expand description
Loot: change what loot tables give — a chest’s, a block’s drops, a
mob’s. crate::Registry::on_loot sees every table rolled; a
LootModifier (a .ydef, or built in code) adds and scales items on
some tables, finishing the stacks it adds with the mod’s named loot
functions (crate::Registry::loot_function).
Structs§
- Loot
- A loot table rolled: where and for whom, and what it gave. Handlers
change
items; each sees the one before’s result. - LootAdd
- An item a
LootModifieradds. - Loot
Modifier - Changes a mod makes to the loot of some tables: adds items, scales
some. A
.ydef(kind: "loot_modifier") or built in code. - Loot
Scale - Item counts a
LootModifierscales. - Loot
Stack - A stack of items: its id, how many, and its custom data (SNBT,
{}for none).
Functions§
- random
- A number in
[0, 1)— what loot’s chances and counts are drawn with.