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 ILootModifier to this block, with the given name.
script.zs
// Block.addLootModifier(name as string, modifier as ILootModifier);
myBlock.addLootModifier(myString, myILootModifier);

Parameters:

name Type: string - The name of the loot modifier to add.
modifier Type: ILootModifier - The loot modifier to add.
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.
script.zs
// Block.addNoSilkTouchLootModifier(name as string, modifier as ILootModifier);
myBlock.addNoSilkTouchLootModifier(myString, myILootModifier);

Parameters:

name Type: string - The name of the loot modifier to add.
modifier Type: ILootModifier - The loot modifier to add.
addStateLootModifier(name as string, statePredicate as Builder, modifier as ILootModifier)
Adds an ILootModifier to this block, firing only if it matches the state outlined in the StatePropertiesPredicate.
script.zs
// Block.addStateLootModifier(name as string, statePredicate as StatePropertiesPredicateBuilder, modifier as ILootModifier);
myBlock.addStateLootModifier(myString, myBuilder, myILootModifier);

Parameters:

name Type: string - The name of the loot modifier to add.
statePredicate Type: StatePropertiesPredicateBuilder - A consumer to configure the StatePropertiesPredicate to identify the target state.
modifier Type: ILootModifier - The loot modifier to add.
addToolLootModifier(name as string, tool as IItemStack, modifier as ILootModifier)
Adds an 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.

script.zs
// Block.addToolLootModifier(name as string, tool as IItemStack, modifier as ILootModifier);
myBlock.addToolLootModifier(myString, myIItemStack, myILootModifier);

Parameters:

name Type: string - The name of the loot modifier.
tool Type: IItemStack - The tool the block was broken with.
modifier Type: ILootModifier - The loot modifier to add to the block.
addToolLootModifier(name as string, tool as IItemStack, matchComponents as bool, modifier as ILootModifier)
Adds an 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.

script.zs
// Block.addToolLootModifier(name as string, tool as IItemStack, matchComponents as bool, modifier as ILootModifier);
myBlock.addToolLootModifier(myString, myIItemStack, myBool, myILootModifier);

Parameters:

name Type: string - The name of the loot modifier.
tool Type: IItemStack - The tool the block was broken with.
matchComponents Type: bool - Whether to consider components or not when trying to match the tool.
modifier Type: ILootModifier - The loot modifier to add to the block.