Options
All
  • Public
  • Public/Protected
  • All
Menu

Object containing additional parameters and functions used by Core Engine to work with the tool

Hierarchy

  • ToolParams

Indexable

[key: string]: any

Any other user-defined methods and properties

Index

Properties

blockMaterials?: {}

List of block material names that can be broken by this instrument. Defined by ToolAPI.registerTool

Type declaration

  • [key: string]: boolean
brokenId?: number

Numeric id of the item that replaces tool item when it's broken. By default it is 0 (the tool disappears)

damage?: number

Base damage of the instrument, is added to the material damage to calculate the tool's final damage. Default is 0

isNative?: boolean

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

isWeapon?: boolean

If true, breaking blocks with this tool makes it break 2x faster, otherwise attacking mobs breaks tool 2x faster

toolMaterial?: ToolMaterial

Properties of the tool material. Defined by ToolAPI.registerTool

Methods

  • Function used to recalculate block destroy time based on some custom logic

    Parameters

    • tool: ItemInstance

      tool item

    • coords: ItemUseCoordinates

      coordinates where the block is being broken

    • block: Tile

      the 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

    • Optional enchantData: EnchantData

      tool's enchant data

    Returns number

  • 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

    Parameters

    • enchantData: EnchantData

      tool's enchant data

    • item: ItemInstance

      tool item

    • Optional coords: ItemUseCoordinates

      coordinates where the block is being broken. Passed only if the block is destroyed

    • Optional block: Tile

      destroyed block data. Passed only if the block is destroyed

    Returns void

  • onAttack(item: ItemInstance, victim: number, attacker: number): boolean
  • Function that is called when players attacks some entity with the tool

    Parameters

    • item: ItemInstance

      tool item

    • victim: number

      unique numeric id of the entity that is attacked

    • attacker: number

    Returns boolean

    true if default damage should not be applied to the instrument, false otherwise

  • Function that is called when the instrument is broken

    Parameters

    Returns boolean

    true if default breaking behavior (replacing by brokenId item) should not be applied

  • Function that is called when the block is destroyed

    Parameters

    Returns boolean

    true if default damage should not be applied to the instrument, false otherwise

  • Function that is called when the block that has a destroy function is destroyed

    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

Generated using TypeDoc