CriticalHitEvent
Link to criticalhitevent
The CriticalHit Event is fired whenever a player attacks another creature. It has a result which determines whether or not default crit behaviour occurs:
- allow: the attack is forced to be a critical
- deny: the attack is prevented from being a critical
- default: the attack uses default Vanilla behaviour to determine if it's a crit.
You can also adjust the damage modifier for the critical hit.
Notes
Link to notes
event.oldDamageModifier
contains the original damage modifier of the event, while event.isVanillaCrit
is a boolean value that determines whether or not this is actually already a critical hit.
Класс события
Link to класс-события
You will need to cast the event in the function header as this class:
crafttweaker.event.CriticalHitEvent
You can, of course, also import the class before and use that name then.
Наследование от интерфейсов событий
Link to наследование-от-интерфейсов-событий
CriticalHit Events implement the following interfaces and are able to call all of their methods/getters/setters as well:
ZenGetters
Link to zengetters
Следующая информация может быть получена от события:
ZenGetter | ZenSetter | Возвращаемый тип |
---|---|---|
ZenGetter target | ZenSetter | Возвращаемый тип IEntity |
ZenGetter oldDamageModifier | ZenSetter | Возвращаемый тип float |
ZenGetter damageModifier | ZenSetter damageModifier | Возвращаемый тип float |
ZenGetter isVanillaCrit | ZenSetter | Возвращаемый тип boolean |
ZenMethods
Link to zenmethods
event.deny()
sets the result to deny.event.allow()
sets the result to allow.event.default()
sets the result to default.