高级运用
最后更新于
这有帮助吗?
请看 虽然咕咕咕了
导包
该函数用于计算材料名称
此函数需要返回 string
类的 thisMaterial
String 类型的 itemName
例子
游戏中 :
导包
此函数可以使特性或附魔不能同存
此函数需要返回 bool
String 类型的 otherTrait
例子1
String 类型的 enchantmentDefinition
例子2
导包
可以在工具装配台看到额外信息
此函数需要返回 string[]
例子 :
导包
破坏方块时调用
此函数不需要返回值
函数写法 :
导包
方块被破坏之前调用
此函数不需要返回值
函数写法 :
导包
方块被破坏之后调用
此函数不需要返回值
boolean 类型的 wasEffective
函数写法 :
导包
方块被破坏且将要生成掉落物时调用
此函数不需要返回值
函数写法 :
导包
此函数每 Tick 都会调用
此函数不需要返回值
int 类型的 itemSlot
boolean 类型的 isSelected
函数写法 :
导包
实体受到伤害后调用
此函数不需要返回值
float 类型的 damageDealt
boolean 类型的 wasCritical
boolean 类型的 wasHit
函数写法 :
导包
即将对实体造成伤害之前调用, 在此函数调用时所有的伤害都计算完毕 (简单来说就是最后一步)
此函数不需要返回值
float 类型的 damage
boolean 类型的 isCritical
函数写法 :
导包
此函数不需要返回值
函数写法 :
导包
此函数不需要返回值
函数写法 :
导包
对实体造成伤害之前调用以确定此次攻击是否暴击,返回值为 false
并不会取消已经是暴击的伤害
此函数需要返回一个 bool
函数写法 :
导包
攻击一个实体时调用,但在造成伤害和计算暴击加成之前调用, 此函数用于计算暴击伤害的加成
此函数需要返回一个 float 以确定伤害加成
float 类型的 originalDamage
float 类型的 currentDamage
boolean 类型的 isCritical
函数写法 :
导包
攻击实体后调用, 以修改实体受到的击退
此函数需要返回一个 float 以确定击退距离
float 类型的 damage
float 类型的 knockback
float 类型的 newKnockback
boolean 类型的 isCritical
函数写法 :
导包
工具降低耐久度之前调用
此函数需要返回一个 int 以确定工具耐久
int 类型的 damage
int 类型的 newDamage
函数写法 :
导包
工具提高耐久度之前调用
此函数需要返回一个 int 以确定工具耐久
int 类型的 damage
int 类型的 newDamage
函数写法 :
导包
此函数不需要返回值
int 类型的 amount
函数写法 :
类的 thisTrait
类的 thisTrait
类的 thisTrait
类的 item
类的 tag
游戏中 :
类的 thisTrait
类的 tool
类型的 event
类的 thisTrait
类的 tool
类型的 event
类的 thisTrait
类的 tool
类的 world
类的 blockstate
类的 pos
类的 miner
类的 thisTrait
类的 tool
类型的 event
类的 thisTrait
类的 tool
类的 world
类的 entity
(实际使用时这个对象可能是为 , , 只是被自动转型为 , 可以 instanceof 判断之后就向下强转)
类的 thisTrait
类的 tool
类的 attacker
类的 target
类的 thisTrait
类的 tool
类的 attacker
类的 target
玩家阻挡攻击时调用, 否则调用 函数
类的 thisTrait
类的 tool
类的 attacker
类型的 event
玩家未阻挡攻击时调用, 否则调用 函数
类的 thisTrait
类的 tool
类的 player
类的 attacker
类型的 event
类的 thisTrait
类的 tool
类的 attacker
类的 target
类的 thisTrait
类的 tool
类的 attacker
类的 target
类的 thisTrait
类的 tool
类的 attacker
类的 target
类的 thisTrait
类的 tool
类的 entity
类的 thisTrait
类的 tool
类的 entity
使用材料修复工具前调用, 请勿与 函数混淆, 如果不止一次修复这个物品,此函数将被调用多次
类的 thisTrait
类的 tool