ToolAPI.ToolParams
Hierarchy
- Scriptable
- ToolParams
Index
Properties
optionalblockMaterials
List of block material names that can be broken by this instrument. Defined by ToolAPI.registerTool,
Type declaration
[key string]: boolean
optionalbrokenId
Numeric ID of the item that replaces tool item when it's broken. By default the tool disappears.
optionalcalcDestroyTime
Function used to recalculate block destroy time based on some custom logic.
Type declaration
Parameters
tool: ItemInstance
Tool item.
coords: ItemUseCoordinates
Coordinates where the block is being broken.
block: Tile
Block that is being broken.
timeData: { base: number; devider: number; modifier: number }
Some time properties that can be used to calculate destroy time for the tool and block.
base: number
Base destroy time of the block.
devider: number
Tool material devider.
modifier: number
Divider applied due to efficiency enchantment.
defaultTime: number
Default block destroy time, calculated as
base / divider / modifier.optionalenchantData: EnchantData
Tool's enchant data.
Returns number
optionaldamage
Base damage of the instrument, is added to the material damage to calculate the tool's final damage.
optionalisNativeinternal
If true, the tool is vanilla Minecraft tool. Generally used within
Core Engine code and should not be used within mods until you really
know what you're doing.
optionalisWeapon
If true, breaking blocks with this tool makes it break 2x faster, otherwise attacking mobs breaks tool 2x faster.
optionalmodifyEnchant
Function that is used to change enchant data object before all the calculations. Can be used to add some enchantment properties, such as silk touch, efficiency, unbreaking or fortune.
Type declaration
Parameters
enchantData: EnchantData
Tool's enchant data.
item: ItemInstance
Tool item.
optionalcoords: ItemUseCoordinates
Coordinates where the block is being broken. Passed only if the block is destroyed.
optionalblock: Tile
Destroyed block data. Passed only if the block is destroyed.
Returns void
optionalonAttack
Function that is called when players attacks some entity with the tool.
Type declaration
Parameters
item: ItemInstance
Tool item.
victim: number
Unique numeric ID of the entity that is attacked.
attacker: number
Entity UID of the player that attacked victim.
Returns boolean
optionalonBroke
Function that is called when the instrument is broken.
Type declaration
Parameters
item: ItemInstance
Tool item.
Returns boolean
optionalonDestroy
Function that is called when the block is destroyed.
Type declaration
Parameters
item: ItemInstance
Tool item.
coords: ItemUseCoordinates
Coordinates where the block is destroyed.
block: Tile
Block that is destroyed.
player: number
Entity UID of the player that destroyed the block.
Returns boolean
optionalonMineBlock
Function that is called when the block that has a destroy function is destroyed.
Type declaration
Parameters
coords: ItemUseCoordinates
Coordinates where the block is destroyed.
carried: ItemInstance
An item in player's hand.
fullTile: Tile
Block that was destroyed.
blockSource: BlockSource
BlockSource object of the world where the block was destroyed.
player: number
Entity UID of the player that destroyed the block.
Returns void
optionaltoolMaterial
Properties of the tool material. Defined by ToolAPI.registerTool,
Object containing additional parameters and functions used by Core Engine to work with the tool.