Class CriticalHitEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.living.LivingEvent
net.minecraftforge.event.entity.player.PlayerEvent
net.minecraftforge.event.entity.player.CriticalHitEvent
This event is fired whenever a player attacks an Entity in
EntityPlayer#attackTargetEntityWithCurrentItem(Entity).
This event is not
This event has a result.
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
This event is not
Cancelable.This event has a result.
Event.HasResultDEFAULT: 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.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.player.PlayerEvent
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.ItemCraftedEvent, PlayerEvent.ItemPickupEvent, PlayerEvent.ItemSmeltedEvent, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.PlayerChangedDimensionEvent, PlayerEvent.PlayerChangeGameModeEvent, PlayerEvent.PlayerLoggedInEvent, PlayerEvent.PlayerLoggedOutEvent, PlayerEvent.PlayerRespawnEvent, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.TabListNameFormat, PlayerEvent.VisibilityNested classes/interfaces inherited from class net.minecraftforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEvent, LivingEvent.LivingVisibilityEventNested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing, EntityEvent.SizeNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate floatprivate final floatprivate final Entityprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionCriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical) -
Method Summary
Modifier and TypeMethodDescriptionfloatThe damage modifier for the hit.
This is by default 1.5F for ciritcal hits and 1F for normal hits .floatThe orignal damage modifier for the hit wthout any changes.
This is 1.5F for ciritcal hits and 1F for normal hits .The Entity that was damaged by the player.booleanReturns true if this hit was critical by vanillavoidsetDamageModifier(float mod) This set the damage multiplier for the hit.Methods inherited from class net.minecraftforge.event.entity.player.PlayerEvent
getPlayerMethods inherited from class net.minecraftforge.event.entity.living.LivingEvent
getEntityLivingMethods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntityMethods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
-
Field Details
-
damageModifier
private float damageModifier -
oldDamageModifier
private final float oldDamageModifier -
target
-
vanillaCritical
private final boolean vanillaCritical
-
-
Constructor Details
-
CriticalHitEvent
public CriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical)
-
-
Method Details
-
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
-