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.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
.-
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
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.CanUpdate, EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCriticalHitEvent(Player player, Entity target, float damageModifier, boolean vanillaCritical)
-
Method Summary
Modifier and TypeMethodDescriptionfloat
The damage modifier for the hit.
This is by default 1.5F for ciritcal hits and 1F for normal hits .float
The 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.boolean
Returns true if this hit was critical by vanillavoid
setDamageModifier(float mod)
This set the damage multiplier for the hit.Methods inherited from class net.minecraftforge.event.entity.player.PlayerEvent
getPlayer
Methods inherited from class net.minecraftforge.event.entity.living.LivingEvent
getEntityLiving
Methods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntity
Methods 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
-
-
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
-