BlockLootModifiers
Expands
This class expands
Block
, meaning that the content found on this page can be called on that type directly.
Description
Additional methods for easier modification of block-related loot tables.Members
addLootModifier(name as string, modifier as ILootModifier)
Adds an script.zs
ILootModifier
to this block, with the given name.myBlock.addLootModifier(myString, myILootModifier);
Parameters:
name: string
Type: string
- The name of the loot modifier to add. addNoSilkTouchLootModifier(name as string, modifier as ILootModifier)
Adds an script.zs
ILootModifier
to this block, with the given name, only if it is not harvested with the silk touch enchantment.myBlock.addNoSilkTouchLootModifier(myString, myILootModifier);
Parameters:
name: string
Type: string
- The name of the loot modifier to add. addStateLootModifier(name as string, statePredicate as Builder, modifier as ILootModifier)
Adds an script.zs
ILootModifier
to this block, firing only if it matches the state outlined in the StatePropertiesPredicate
.// Block.addStateLootModifier(name as string, statePredicate as StatePropertiesPredicateBuilder, modifier as ILootModifier);myBlock.addStateLootModifier(myString, myBuilder, myILootModifier);
Parameters:
name: string
Type: string
- The name of the loot modifier to add. statePredicate: StatePropertiesPredicateBuilder
Type: StatePropertiesPredicateBuilder
- A consumer to configure the StatePropertiesPredicate
to identify the target state. addToolLootModifier(name as string, tool as IItemStack, modifier as ILootModifier)
Adds an
script.zs
ILootModifier
that fires if this block gets broken with the given tool.Parameters that may be attached to the tool such as count, damage, or NBT data are ignored.
myBlock.addToolLootModifier(myString, myIItemStack, myILootModifier);
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
script.zs
ILootModifier
that fires if this block 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.
// Block.addToolLootModifier(name as string, tool as IItemStack, matchDamage as bool, modifier as ILootModifier);myBlock.addToolLootModifier(myString, myIItemStack, myBool, myILootModifier);
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
script.zs
ILootModifier
that fires if this block 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.
// Block.addToolLootModifier(name as string, tool as IItemStack, matchDamage as bool, matchNbt as bool, modifier as ILootModifier);myBlock.addToolLootModifier(myString, myIItemStack, myBool, myBool, myILootModifier);
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.