BlockStateLootModifiers
Expands
This class expands
BlockState
, meaning that the content found on this page can be called on that type directly.
Description
Additional methods for easier modification of block state-related loot tables.Members
addBlockLootModifier(name as string, modifier as ILootModifier)
Adds an
ILootModifier
to this block, ignoring the current state. Parameters:
name: string
Type: string
- The name of the loot modifier. addNoSilkTouchLootModifier(name as string, modifier as ILootModifier)
Adds an
ILootModifier
to this block, with the given name, only if it is not harvested with the silk touch enchantment. Parameters:
name: string
Type: string
- The name of the loot modifier to add. addTargetedLootModifier(name as string, modifier as ILootModifier)
Adds an
ILootModifier
to the current block, only if it matches the current block state precisely. Parameters:
name: string
Type: string
- The name of the loot modifier. addToolLootModifier(name as string, tool as IItemStack, modifier as ILootModifier)
Adds an
ILootModifier
that fires if this block state gets broken with the given tool.Parameters that may be attached to the tool such as count, damage, or NBT data are ignored.
Parameters:
name: string
Type: string
- The name of the loot modifier. addToolLootModifier(name as string, tool as IItemStack, matchDamage as bool, modifier as ILootModifier)
Adds an
ILootModifier
that fires if this block state gets broken with the given tool, optionally considering its damage.Additional parameters that may be attached to the tool, such as NBT or count, are ignored.
Parameters:
name: string
Type: string
- The name of the loot modifier. matchDamage: bool
Type: bool
- Whether to consider damage or not when trying to match the tool. addToolLootModifier(name as string, tool as IItemStack, matchDamage as bool, matchNbt as bool, modifier as ILootModifier)
Adds an
ILootModifier
that fires if this block state gets broken with the given tool, optionally considering its damage or NBT.Additional parameters that may be attached to the tool, such as count, are ignored.
Parameters:
name: string
Type: string
- The name of the loot modifier. matchDamage: bool
Type: bool
- Whether to consider damage or not when trying to match the tool. matchNbt: bool
Type: bool
- Whether to consider NBT data or not when trying to match the tool.