MCCriticalHitEvent

This class was added by a mod with mod-id crafttweaker. So you need to have this mod installed if you want to use this feature.

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.

script.zs
crafttweaker.api.event.entity.player.MCCriticalHitEvent

Constructors

script.zs
new crafttweaker.api.event.entity.player.MCCriticalHitEvent(handler as function.Consumer<crafttweaker.api.event.entity.player.MCCriticalHitEvent>);
ParameterTypeDescription
Parameter
handler
Type
function.Consumer<crafttweaker.api.event.entity.player.MCCriticalHitEvent>
Description
No description provided

Methods

getDamageModifier

The damage modifier for the hit.
This is by default 1.5F for ciritcal hits and 1F for normal hits .

Returns float

script.zs
myMCCriticalHitEvent.getDamageModifier();

getEntityPlayer

Returns crafttweaker.api.entity.player.MCPlayerEntity

script.zs
myMCCriticalHitEvent.getEntityPlayer();

getOldDamageModifier

The orignal damage modifier for the hit wthout any changes.
This is 1.5F for ciritcal hits and 1F for normal hits .

Returns float

script.zs
myMCCriticalHitEvent.getOldDamageModifier();

getPlayer

Returns: Player

Returns crafttweaker.api.entity.player.MCPlayerEntity

script.zs
myMCCriticalHitEvent.getPlayer();

hasResult

Determines if this event expects a significant result value. Note: Events with the HasResult annotation will have this method automatically added to return true.

Returns boolean

script.zs
myMCCriticalHitEvent.hasResult();

isCancelable

Determine if this function is cancelable at all. Returns: If access to setCanceled should be allowed Note: Events with the Cancelable annotation will have this method automatically added to return true.

Returns boolean

script.zs
myMCCriticalHitEvent.isCancelable();

isCanceled

Determine if this event is canceled and should stop executing. Returns: The current canceled state

Returns boolean

script.zs
myMCCriticalHitEvent.isCanceled();

isVanillaCritical

Returns true if this hit was critical by vanilla

Returns boolean

script.zs
myMCCriticalHitEvent.isVanillaCritical();

setCanceled

script.zs
myMCCriticalHitEvent.setCanceled(cancel as boolean);
ParameterTypeDescription
Parameter
cancel
Type
boolean
Description
No description provided

setDamageModifier

This set the damage multiplier for the hit. If you set it to 0, then the particles are still generated but damage is not done.

script.zs
myMCCriticalHitEvent.setDamageModifier(mod as float);
ParameterTypeDescription
Parameter
mod
Type
float
Description
No description provided