en

util Module

Class

ToolTier

ESM-import allowed.

Member

WOODEN

Belongs to: ToolTier
type: any

GOLD

Belongs to: ToolTier
type: any

STONE

Belongs to: ToolTier
type: any

IRON

Belongs to: ToolTier
type: any

DIAMOND

Belongs to: ToolTier
type: any

NETHERITE

Belongs to: ToolTier
type: any

tierId

Belongs to: ToolTier
type: any

Method

Constructor

Belongs to: ToolTier
return type: void
parameters:

name type comment
tierId any 工具分级ID

ArmorTier

ESM-import allowed.

Member

LEATHER

Belongs to: ArmorTier
type: any

CHAIN

Belongs to: ArmorTier
type: any

IRON

Belongs to: ArmorTier
type: any

GOLD

Belongs to: ArmorTier
type: any

DIAMOND

Belongs to: ArmorTier
type: any

NETHERITE

Belongs to: ArmorTier
type: any

OTHER

Belongs to: ArmorTier
type: any

tierId

Belongs to: ArmorTier
type: any

Method

Constructor

Belongs to: ArmorTier
return type: void
parameters:

name type comment
tierId any 防具分级ID

ToolType

ESM-import allowed.

Member

NONE

Belongs to: ToolType
type: any

SWORD

Belongs to: ToolType
type: any

SHOVEL

Belongs to: ToolType
type: any

PICKAXE

Belongs to: ToolType
type: any

AXE

Belongs to: ToolType
type: any

HOE

Belongs to: ToolType
type: any

SHEARS

Belongs to: ToolType
type: any

typeId

Belongs to: ToolType
type: any

Method

Constructor

Belongs to: ToolType
return type: void
parameters:

name type comment
typeId any 工具种类ID

CreativeInventoryType

ESM-import allowed.

Member

CONSTRUCTOR

Belongs to: CreativeInventoryType
type: any

NATURE

Belongs to: CreativeInventoryType
type: any

EQUIPMENT

Belongs to: CreativeInventoryType
type: any

ITEM

Belongs to: CreativeInventoryType
type: any

typeId

Belongs to: CreativeInventoryType
type: any

Method

Constructor

Belongs to: CreativeInventoryType
return type: void
parameters:

name type comment
typeId any 创造物品栏分类ID

ArmorType

ESM-import allowed.

Member

HELMET

Belongs to: ArmorType
type: any

CHESTPLATE

Belongs to: ArmorType
type: any

LEGGINGS

Belongs to: ArmorType
type: any

BOOTS

Belongs to: ArmorType
type: any

typeId

Belongs to: ArmorType
type: any

Method

Constructor

Belongs to: ArmorType
return type: void
parameters:

name type comment
typeId any 防具种类ID

BlockItemUtil

ESM-import allowed.

Method

registerSimpleItem

注册一个简单的自定义物品
Belongs to: BlockItemUtil
return type: void
parameters:

name type comment
id string 物品ID
name string 物品ID
type CreativeInventoryType 创造物品栏分类
textureName string 贴图名称,在材质包中可以指定
textureSize number 贴图大小,单位为像素,如为非正方形则以长边为准
stackSize number 最大堆叠
canOnOffhand boolean 是否可以装备在副手

registerFoodItem

注册一个食品物品
Belongs to: BlockItemUtil
return type: void
parameters:

name type comment
id string 物品ID
name string 物品ID
type CreativeInventoryType 创造物品栏分类
textureName string 贴图名称,在材质包中可以指定
textureSize number 贴图大小,单位为像素,如为非正方形则以长边为准
stackSize number 最大堆叠
canOnOffhand boolean 是否可以装备在副手
consumeTime number 食用耗时
isDrink boolean 是否是饮品,为false则为食品,如true则为饮品(药水等)
canAlwaysEat boolean 是否能满饥饿度了还吃
restoreFood number 恢复的饥饿值
restoreSaturation number 恢复的饱食度

registerToolItem

注册一个工具物品
Belongs to: BlockItemUtil
return type: void
parameters:

name type comment
id string 物品ID
name string 物品ID
type CreativeInventoryType 创造物品栏分类
textureName string 贴图名称,在材质包中可以指定
textureSize number 贴图大小,单位为像素,如为非正方形则以长边为准
stackSize number 最大堆叠
canOnOffhand boolean 是否可以装备在副手
toolType ToolType 工具种类
toolTier ToolTier 工具分级
durability number 最大耐久
damageOnAttackEntity boolean 是否因伤害实体而减少耐久
damageOnBreakBlock boolean 是否因破坏方块而减少耐久

registerArmorItem

注册一个防具自定义物品
Belongs to: BlockItemUtil
return type: void
parameters:

name type comment
id string 物品ID
name string 物品ID
type CreativeInventoryType 创造物品栏分类
textureName string 贴图名称,在材质包中可以指定
textureSize number 贴图大小,单位为像素,如为非正方形则以长边为准
stackSize number 最大堆叠
canOnOffhand boolean 是否可以装备在副手
armorType ArmorType 防具种类
armorTier ArmorTier 防具等级
durability number 防具耐久
armorPoint number 防具提供的盔甲点数

© PowerNukkitX Dev team