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
-
public class CriticalHitEvent extends PlayerEvent
This event is fired whenever a player attacks an Entity in EntityPlayer#attackTargetEntityWithCurrentItem(Entity).
This event is notCancelable
.
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 theMinecraftForge.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.Visibility
-
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.EnteringChunk, EntityEvent.EntityConstructing, EntityEvent.Size
-
-
Field Summary
Fields Modifier and Type Field Description private float
damageModifier
private float
oldDamageModifier
private Entity
target
private boolean
vanillaCritical
-
Constructor Summary
Constructors Constructor Description CriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getDamageModifier()
The damage modifier for the hit.
This is by default 1.5F for ciritcal hits and 1F for normal hits .float
getOldDamageModifier()
The orignal damage modifier for the hit wthout any changes.
This is 1.5F for ciritcal hits and 1F for normal hits .Entity
getTarget()
The Entity that was damaged by the player.boolean
isVanillaCritical()
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
-
-
-
-
Field Detail
-
damageModifier
private float damageModifier
-
oldDamageModifier
private final float oldDamageModifier
-
target
private final Entity target
-
vanillaCritical
private final boolean vanillaCritical
-
-
Constructor Detail
-
CriticalHitEvent
public CriticalHitEvent(PlayerEntity player, Entity target, float damageModifier, boolean vanillaCritical)
-
-
Method Detail
-
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
-
-