实验性实验性damage此物品当前的损坏值。
物品当前耐久度为 maxDurability - damage。
当被设置为 负数,Infinity,NaN 等值时,值为 0。
Returns the current damage level of this particular item.
无法在只读模式下修改此属性,详见 WorldBeforeEvents。
只读 实验性is只读 实验性max只读 实验性type静态 只读 实验性component实验性可选unbreakingEnchantmentLevel: number耐久魔咒等级,在计算损坏概率时受到此参数的影响。
传入的 unbreakingEnchantmentLevel 参数必须介于 [0, 3]。
Unbreaking factor to consider in factoring the damage chance. Incoming unbreaking parameter must be within the range [0, 3].
使用时的最大损坏概率。
返回根据 damageRange 属性生成的最大损坏概率,
附带一个耐久附魔等级作为可选参数。
Returns the maximum chance that this item would be damaged using the damageRange property, given an unbreaking enchantment level.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
实验性返回用于计算物品损失耐久的概率范围。最终物品损失耐久的概率将落在此范围中。
A range of numbers that is used to calculate the damage chance for an item. The damage chance will fall within this range.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
表示物品耐久组件。当出现在物品上时,表示该物品可以在使用中受到损坏。 注意,只能在数驱物品上获取和使用该组件。
When present on an item, this item can take damage in the process of being used. Note that this component only applies to data-driven items.
示例: giveHurtDiamondSword.ts