Skip to main content

Module loot

Module loot 

Source
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 LootModifier adds.
LootModifier
Changes a mod makes to the loot of some tables: adds items, scales some. A .ydef (kind: "loot_modifier") or built in code.
LootScale
Item counts a LootModifier scales.
LootStack
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.