Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers
Event IEventManager
IBlockEvent IEventCancelable IEventHasResult IEventPositionable IMinecartEvent IPotionBrewEvent IProcessableEvent IProjectileImpactEvent IEntityEvent IExplosionEvent ILivingEvent IPlayerEvent ITickEvent AnimalTameEvent ArrowLooseEvent ArrowNockEvent BlockBreakEvent BlockHarvestDropsEvent BlockNeighborNotifyEvent BlockPlaceEvent ClientTickEvent CommandEvent CriticalHitEvent CropGrowPostEvent CropGrowPreEvent EnchantmentLevelSetEvent EnderTeleportEvent EntityJoinWorldEvent EntityLivingAttackedEvent EntityLivingDamageEvent EntityLivingDeathEvent EntityLivingDeathDropsEvent EntityLivingEquipmentChangeEvent EntityLivingFallEvent EntityLivingHealEvent EntityLivingHurtEvent EntityLivingJumpEvent EntityLivingSpawnEvent EntityLivingUpdateEvent EntityMountEvent EntityStruckByLightningEvent EntityTravelToDimensionEvent ExplosionDetonateEvent ExplosionStartEvent FarmlandTrampleEvent ItemExpireEvent ItemFishedEvent ItemTossEvent LivingDestroyBlockEvent LivingEntityUseItemEvent LivingExperienceDropEvent LivingKnockBackEvent LootingLevelEvent MinecartCollisionEvent MinecartInteractEvent MobGriefingEvent PlayerAdvancementEvent PlayerAnvilRepairEvent PlayerAnvilUpdateEvent PlayerAttackEntityEvent PlayerBonemealEvent PlayerBreakSpeedEvent PlayerBrewedPotionEvent PlayerChangedDimensionEvent PlayerCloneEvent PlayerCloseContainerEvent PlayerCraftedEvent PlayerDeathDropsEvent PlayerDestroyItemEvent PlayerFillBucketEvent PlayerInteractBlockEvent PlayerInteractEntityEvent PlayerInteractEvent PlayerItemPickupEvent PlayerLeftClickBlockEvent PlayerLoggedInEvent PlayerLoggedOutEvent PlayerOpenContainerEvent PlayerPickupItemEvent PlayerPickupXpEvent PlayerRespawnEvent PlayerRightClickItemEvent PlayerSetSpawnEvent PlayerSleepInBedEvent PlayerSmeltedEvent PlayerTickEvent PlayerUseHoeEvent PlayerVisibilityEvent PortalSpawnEvent PotionBrewPostEvent PotionBrewPreEvent ProjectileImpactArrowEvent ProjectileImpactFireballEvent ProjectileImpactThrowableEvent RenderTickEvent ServerTickEvent SleepingLocationCheckEvent SleepingTimeCheckEvent WorldTickEvent

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

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.

Event Class

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.

Event interface extensions

CriticalHit Events implement the following interfaces and are able to call all of their methods/getters/setters as well:

ZenGetters/ZenSetters

The following information can be retrieved from the event:

ZenGetterZenSetterReturn Type
ZenGetter
target
ZenSetter
Return Type
IEntity
ZenGetter
oldDamageModifier
ZenSetter
Return Type
float
ZenGetter
damageModifier
ZenSetter
damageModifier
Return Type
float
ZenGetter
isVanillaCrit
ZenSetter
Return Type
boolean

ZenMethods

  • event.deny() sets the result to deny.
  • event.allow() sets the result to allow.
  • event.default() sets the result to default.

ZenGetters/ZenSetters/ZenMethods from extensions

ZenGetterZenSetterType
ZenGetter
player
ZenSetter
Type
IBlockPos