Перейти к основному содержанию

BlockItemBehavior

Common functions for blocks and items

Hierarchy

Implemented by

Index

Methods

optionalonDispense

  • Method called when the item was dispensed.


    Parameters

    • coords: ItemUseCoordinates

      full coords object, where the main coords are the position of the dispenser block, relative ones are the position of the block to which the dispenser is pointed, and vec are the coords for the item to be dropped at

    • item: ItemStack

      item that was dispensed

    • region: WorldRegion

      BlockSource object

    • slot: number

      numeric id of the slot from which the item was dispensed

    Returns void

optionalonItemUse

  • onItemUse(coords: ItemUseCoordinates, item: ItemStack, block: Tile, player: number): void
  • Method called when player clicks on block with the item.


    Parameters

    • coords: ItemUseCoordinates

      object of touch coordinates with side information and relative coordinates set.

    • item: ItemStack

      item that was in the player's hand when he touched the block

    • block: Tile

      block that was touched

    • player: number

      player entity uID

    Returns void

optionalonNameOverride

  • onNameOverride(item: ItemInstance, translation: string, name: string): string
  • Method to get displayed item name.


    Parameters

    • item: ItemInstance

      item stack information

    • translation: string

      translated item name

    • name: string

      original item name

    Returns string

    new name that will be displayed

Page Options