@minecraft/server / LootTableManager
Class: LootTableManager ​
Defined in: @minecraft/server/index.d.ts:15942
Manager for Loot Table related APIs. Allows for generation of drops from blocks and entities according to their loot tables.
Methods ​
generateLootFromBlock() ​
generateLootFromBlock(
block,tool?):ItemStack[] |undefined
Defined in: @minecraft/server/index.d.ts:15966
Parameters ​
block ​
The block to generate loot from.
tool? ​
Optional. The tool to use in the looting operation.
Returns ​
ItemStack[] | undefined
An array of item stacks dropped from the loot drop event. Can be empty if no loot dropped, or undefined if the provided tool is insufficient to mine the block.
Remarks ​
Generates loot from a given block as if it had been mined.
Throws ​
Throws if the block is in an unloaded chunk, or if the block's position is outside of world bounds.
LocationOutOfWorldBoundariesError
generateLootFromBlockPermutation() ​
generateLootFromBlockPermutation(
blockPermutation,tool?):ItemStack[] |undefined
Defined in: @minecraft/server/index.d.ts:15979
Parameters ​
blockPermutation ​
tool? ​
Optional. The tool to use in the looting operation.
Returns ​
ItemStack[] | undefined
An array of item stacks dropped from the loot drop event. Can be empty if no loot dropped, or undefined if the provided tool is insufficient to mine the block.
Remarks ​
Generates loot from a given block permutation as if it had been mined.
generateLootFromBlockType() ​
generateLootFromBlockType(
scriptBlockType,tool?):ItemStack[] |undefined
Defined in: @minecraft/server/index.d.ts:15992
Parameters ​
scriptBlockType ​
tool? ​
Optional. The tool to use in the looting operation.
Returns ​
ItemStack[] | undefined
An array of item stacks dropped from the loot drop event. Can be empty if no loot dropped, or undefined if the provided tool is insufficient to mine the block.
Remarks ​
Generates loot from a given block type as if it had been mined.
generateLootFromEntity() ​
generateLootFromEntity(
entity,tool?):ItemStack[] |undefined
Defined in: @minecraft/server/index.d.ts:16007
Parameters ​
entity ​
tool? ​
Optional. The tool to use in the looting operation.
Returns ​
ItemStack[] | undefined
An array of item stacks dropped from the loot drop event. Can be empty if no loot dropped, or undefined if the entity was invalid.
Remarks ​
Generates loot from given a entity as if it had been killed.
Throws ​
This function can throw errors.
generateLootFromEntityType() ​
generateLootFromEntityType(
entityType,tool?):ItemStack[] |undefined
Defined in: @minecraft/server/index.d.ts:16019
Parameters ​
entityType ​
tool? ​
Optional. The tool to use in the looting operation.
Returns ​
ItemStack[] | undefined
An array of item stacks dropped from the loot drop event. Can be empty if no loot dropped.
Remarks ​
Generates loot from given a entity type as if it had been killed.
generateLootFromTable() ​
generateLootFromTable(
lootTable,tool?):ItemStack[] |undefined
Defined in: @minecraft/server/index.d.ts:16031
Parameters ​
lootTable ​
tool? ​
Optional. The tool to use in the looting operation.
Returns ​
ItemStack[] | undefined
An array of item stacks dropped from the loot drop event. Can be empty if no loot dropped, or undefined if the provided tool is insufficient to mine the block.
Remarks ​
Generates loot from a given LootTable.
getLootTable() ​
getLootTable(
path):LootTable|undefined
Defined in: @minecraft/server/index.d.ts:16045
Parameters ​
path ​
string
Path to the table to retrieve. Does not include file extension, or 'loot_tables/' folder prefix. Example: entities/creeper.
Returns ​
LootTable | undefined
Returns a LootTable if one is found, or undefined if the provided path does not correspond to an existing loot table.
Remarks ​
Retrieves a single loot table from the level's current registry.