ItemRegistry
Index
Functions
addArmorMaterial
Creates new armor material with specified parameters.
Parameters
name: string
new (or existing) material name
material: ArmorMaterial
material properties
Returns void
addToolMaterial
Registers new tool material in ToolAPI. Some of the tool materials are already registered: wood, stone, iron, golden and diamond
Parameters
name: string
new (or existing) material name
material: ToolMaterial
material properties
Returns void
createArmor
Creates armor item from given description. Automatically generates item id from given string id.
Parameters
stringID: string
item string id
params: ArmorDescription
item and armor parameters
Returns ItemArmor
item class instance
createFood
Parameters
stringID: string
params: FoodDescription
Returns ItemFood
createItem
Creates item from given description. Automatically generates item id from given string id.
Parameters
stringID: string
item string id.
params: ItemDescription
item description
Returns ItemBase
item class instance
createTool
Creates tool item and registers it in ToolAPI. Automatically generates item id from given string id.
Parameters
stringID: string
item string id
params: ToolDescription
object with item parameters and tool material
optionaltoolData: ToolParams
tool parameters and functions
Returns ItemTool
item class instance
getArmorMaterial
Parameters
name: string
Returns ArmorMaterial
armor material by name.
getInstanceOf
Parameters
itemID: string | number
Returns Nullable<ItemBase>
instance of item class if the item was added by BlockEngine, null otherwise.
getItemRarityColor
Parameters
itemID: number
Returns string
chat color for rare items.
getRarity
Parameters
itemID: number
Returns number
EnumRarity
value for the item.
getRarityColor
Parameters
rarity: number
one of
EnumRarity
values
Returns string
chat color for rarity.
getToolMaterial
Parameters
name: string
Returns ToolMaterial
tool material by name registered in ToolAPI.
getType
Parameters
id: number
Returns block | item
item type
getVanillaStringID
Parameters
id: number
Returns string
item string id in the game (in snake_case format).
isBlock
Parameters
id: number
block id
Returns boolean
true if a block identifier was given, false otherwise.
isItem
Parameters
id: number
item id
Returns boolean
true if an item identifier was given, false otherwise.
isVanilla
Parameters
id: number
Returns boolean
whether the item is an item from the original game.
registerItem
registerItemFuncs
Registers all item functions from given object.
Parameters
itemID: string | number
itemFuncs: ItemBehavior
object which implements
ItemBehavior
interface
Returns void
setRarity
Sets item rarity.
Parameters
id: string | number
item id
rarity: number
one of
EnumRarity
valuesoptionalpreventNameOverride: boolean
prevent registration of name override function
Returns void
Module for advanced item definition.