BlockBehavior
Hierarchy
- BlockItemBehavior
- BlockBehavior
Implemented by
Index
Methods
optionalgetDrop
Method used to get drop from the block
Parameters
coords: ItemUseCoordinates
block coords
block: Tile
block id and data
diggingLevel: number
tool mining level
enchant: EnchantData
tool enchant data
item: ItemStack
item instance
region: BlockSource
BlockSource object
Returns ItemInstanceArray[]
drop items array
optionalonAnimateTick
Method which enables animation update callback for the block and called on it. Occurs more often then random tick callback and only if the block is not far away from player.
Parameters
x: number
x coord of the block
y: number
y coord of the block
z: number
z coord of the block
id: number
block id
data: number
block data
Returns void
optionalonBreak
Method called when the block is destroyed by explosion or environment.
Parameters
coords: Vector
block coords
block: Tile
block id and data
region: BlockSource
BlockSource object
Returns void
optionalonClick
Method called when player clicks on the block.
Parameters
coords: ItemUseCoordinates
coords of the block
item: ItemStack
item in player hand
block: Tile
block id and data
player: number
player uid
Returns void
optionalonDestroy
Method called when block is destroyed by player
Parameters
coords: Vector
block coords
block: Tile
block id and data
region: BlockSource
BlockSource object
player: number
player uid
Returns void
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, andvec
are the coords for the item to be dropped atitem: ItemStack
item that was dispensed
region: WorldRegion
BlockSource object
slot: number
numeric id of the slot from which the item was dispensed
Returns void
optionalonEntityInside
Method called on entity being inside the block. Can be used to create portals.
Parameters
coords: Vector
coords of the block
block: Tile
block id and data
entity: number
entity uid
Returns void
optionalonEntityStepOn
Method called on entity step on the block.
Parameters
coords: Vector
coords of the block
block: Tile
block id and data
entity: number
entity uid
Returns void
optionalonItemUse
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
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
optionalonNeighbourChange
Method called on neighbour blocks updates
Parameters
coords: Vector
coords of the block
block: Tile
block id and data
changeCoords: Vector
region: BlockSource
BlockSource object
Returns void
optionalonPlace
Method used to determine where block is placed in the world
Parameters
coords: ItemUseCoordinates
click position in the world
item: ItemStack
item in the player hand
block: Tile
block that was touched
player: number
player uid
region: BlockSource
BlockSource object
Returns any
coordinates where to actually place the block, or void for default placement
optionalonRandomTick
Method which enables random tick callback for the block and called on it.
Parameters
x: number
x coord of the block
y: number
y coord of the block
z: number
z coord of the block
block: Tile
block id and data
region: BlockSource
BlockSource object
Returns void
Block functions