Appearance
helix / LootTableDef
Class: LootTableDef
Defined in: core/values/loot-table.ts:119
A registerable loot table - the JSON written to data/<ns>/<loot_table folder>/<name>.json (via Datapack.lootTable) and referenced from /loot ... loot <ref>, container set_loot, or a block/mob drop. Built from LootPools whose item entries reuse the same ItemValues you give, so a dropped item is defined once.
dp.lootTable("chests/reward", new LootTableDef("chest").pool( new LootPool().rolls(1).item(Item.DIAMOND.count(3))));
Constructors
Constructor
new LootTableDef(
type?):LootTableDef
Defined in: core/values/loot-table.ts:127
Parameters
type?
string
loot-context type id (chest, block, entity, generic, ...). minecraft: is prepended to a bare id. Omit for an untyped table.
Returns
LootTableDef
Methods
func()
func(
fn):this
Defined in: core/values/loot-table.ts:136
A function applied to the whole table's output.
Parameters
fn
Returns
this
pool()
pool(
pool):this
Defined in: core/values/loot-table.ts:130
Add a pool (build it with LootPool).
Parameters
pool
Returns
this
toJson()
toJson(
version):Record<string,unknown>
Defined in: core/values/loot-table.ts:142
The loot-table JSON, with embedded values rendered for version.
Parameters
version
Returns
Record<string, unknown>