Class CriticalHitEvent


public class CriticalHitEvent extends PlayerEvent
This event is fired whenever a player attacks an Entity in EntityPlayer#attackTargetEntityWithCurrentItem(Entity).

This event is not Cancelable.

This event has a result. Event.HasResult
DEFAULT: means the vanilla logic will determine if this a critical hit.
DENY: it will not be a critical hit but the player still will attack
ALLOW: this attack is forced to be critical
This event is fired on the MinecraftForge.EVENT_BUS.
  • Field Details

    • damageModifier

      private float damageModifier
    • oldDamageModifier

      private final float oldDamageModifier
    • target

      private final Entity target
    • vanillaCritical

      private final boolean vanillaCritical
  • Constructor Details

    • CriticalHitEvent

      public CriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical)
  • Method Details

    • getTarget

      public Entity getTarget()
      The Entity that was damaged by the player.
    • setDamageModifier

      public void setDamageModifier(float mod)
      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.
    • getDamageModifier

      public float getDamageModifier()
      The damage modifier for the hit.
      This is by default 1.5F for ciritcal hits and 1F for normal hits .
    • getOldDamageModifier

      public float getOldDamageModifier()
      The orignal damage modifier for the hit wthout any changes.
      This is 1.5F for ciritcal hits and 1F for normal hits .
    • isVanillaCritical

      public boolean isVanillaCritical()
      Returns true if this hit was critical by vanilla