Package me.gamercoder215.mobchip.combat
Class CombatEntry
java.lang.Object
me.gamercoder215.mobchip.combat.CombatEntry
Represents a Combat Entry stored in the Entity's
EntityCombatTracker
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCombatEntry
(@NotNull Mob owner, EntityDamageEvent.DamageCause cause, int ticks, float health, float damage) Constructs a new CombatEntry with no fall damage.CombatEntry
(@NotNull Mob owner, EntityDamageEvent.DamageCause cause, int ticks, float health, float damage, float fall) Constructs a new CombatEntry with no Combat Location.CombatEntry
(@NotNull Mob owner, EntityDamageEvent.DamageCause cause, int ticks, float health, float damage, float fall, @Nullable CombatLocation combatLocation) Constructs a new CombatEntry with no attacker.CombatEntry
(@NotNull Mob owner, EntityDamageEvent.DamageCause cause, int ticks, float health, float damage, float fall, @Nullable CombatLocation combatLocation, @Nullable Entity attacker) Constructs a new CombatEntry. -
Method Summary
Modifier and TypeMethodDescriptionstatic CombatEntry.Builder
builder()
Creates a new Builder for aCombatEntry
.Deprecated.As of Minecraft 1.20, no longer stored in CombatEntrygetCause()
Fetches the cause of the damage in this CombatEntry.int
Deprecated.As of Minecraft 1.20, no longer stored in CombatEntryfloat
Fetches how much damage this Entity took.float
Fetches the last amount of distance the Entity fell in this CombatEntry.float
Fetches how much health the entity has had after taking damage.float
Deprecated.As of Minecraft 1.20, no longer stored in CombatEntryFetches the type of preparation this CombatEntry was for.getOwner()
Fetches the owner of this CombatEntry.boolean
Whether this CombatEntry contains an Entity Attacker.boolean
Whether this CombatEntry has a CombatLocation.
-
Constructor Details
-
CombatEntry
public CombatEntry(@NotNull @NotNull Mob owner, @NotNull EntityDamageEvent.DamageCause cause, int ticks, float health, float damage) throws IllegalArgumentException Constructs a new CombatEntry with no fall damage.- Parameters:
owner
- Owner of this CombatEntrycause
- DamageCause of this CombatEntryticks
- Number of ticks this CombatEntry has been in combathealth
- Health of the Entity at the time of this CombatEntry before takinggetDamage()
damage
- Damage the Entity took in this CombatEntry- Throws:
IllegalArgumentException
- if DamageCause or Owner is null, or ticks/health/damage is less than 0
-
CombatEntry
public CombatEntry(@NotNull @NotNull Mob owner, @NotNull EntityDamageEvent.DamageCause cause, int ticks, float health, float damage, float fall) throws IllegalArgumentException Constructs a new CombatEntry with no Combat Location.- Parameters:
owner
- Owner of this CombatEntrycause
- DamageCause of this CombatEntryticks
- Number of ticks this CombatEntry has been in combathealth
- Health of the Entity at the time of this CombatEntry before takinggetDamage()
damage
- Damage the Entity took in this CombatEntryfall
- Last amount of distance the Entity fell in this CombatEntry- Throws:
IllegalArgumentException
- if DamageCause or Owner is null, or ticks/health/damage/fall is less than 0
-
CombatEntry
public CombatEntry(@NotNull @NotNull Mob owner, @NotNull EntityDamageEvent.DamageCause cause, int ticks, float health, float damage, float fall, @Nullable @Nullable CombatLocation combatLocation) throws IllegalArgumentException Constructs a new CombatEntry with no attacker.- Parameters:
owner
- Owner of this CombatEntrycause
- DamageCause of this CombatEntryticks
- Number of ticks this CombatEntry has been in combathealth
- Health of the Entity at the time of this CombatEntry before takinggetDamage()
damage
- Damage the Entity took in this CombatEntryfall
- Last amount of distance the Entity fell in this CombatEntrycombatLocation
- Location of this CombatEntry- Throws:
IllegalArgumentException
- if DamageCause or Owner is null, or ticks/health/damage/fall is less than 0
-
CombatEntry
public CombatEntry(@NotNull @NotNull Mob owner, @NotNull EntityDamageEvent.DamageCause cause, int ticks, float health, float damage, float fall, @Nullable @Nullable CombatLocation combatLocation, @Nullable @Nullable Entity attacker) throws IllegalArgumentException Constructs a new CombatEntry.- Parameters:
owner
- Owner of this CombatEntrycause
- DamageCause of this CombatEntryticks
- Number of ticks this CombatEntry has been in combathealth
- Health of the Entity at the time of this CombatEntry before takinggetDamage()
damage
- Damage the Entity took in this CombatEntryfall
- Last amount of distance the Entity fell in this CombatEntrycombatLocation
- Location of this CombatEntryattacker
- Entity that attacked the Entity in this CombatEntry- Throws:
IllegalArgumentException
- if DamageCause or Owner is null, or ticks/health/damage/fall is less than 0
-
-
Method Details
-
getCause
Fetches the cause of the damage in this CombatEntry.- Returns:
- DamageCause of this CombatEntry
-
getCombatTime
Deprecated.As of Minecraft 1.20, no longer stored in CombatEntryFetches how longgetOwner()
was in combat, in ticks.- Returns:
- Duration of Combat, in ticks
-
getOwner
Fetches the owner of this CombatEntry.- Returns:
- CombatEntry Owner
-
getDamage
public float getDamage()Fetches how much damage this Entity took.- Returns:
- Damage taken before dying
-
getHealthBeforeDamage
Deprecated.As of Minecraft 1.20, no longer stored in CombatEntryFetches the health of this Entity would have had before taking damage.- Returns:
- Health of entity before damage
-
getHealthAfterDamage
public float getHealthAfterDamage()Fetches how much health the entity has had after taking damage.- Returns:
- Health of entity after damage
-
getLocation
Fetches the type of preparation this CombatEntry was for. May be null.
Developers should checkhasLocation()
before calling this method.- Returns:
- CombatLocation found, or null if it does not exist
-
hasLocation
public boolean hasLocation()Whether this CombatEntry has a CombatLocation.- Returns:
- true if CombatLocation exists, else false
-
getAttacker
Deprecated.As of Minecraft 1.20, no longer stored in CombatEntryFetches the Attacker of this CombatEntry. May be null.
Developers should checkhasAttacker()
before calling this method.- Returns:
- Entity that attacked the Mob that owns this Combat Entry, or null if not found
-
hasAttacker
public boolean hasAttacker()Whether this CombatEntry contains an Entity Attacker.- Returns:
- true if Entity Attacker exists, else false
-
getFallDistance
public float getFallDistance()Fetches the last amount of distance the Entity fell in this CombatEntry.
This may returnFloat.MAX_VALUE
if the Damage Cause isEntityDamageEvent.DamageCause.VOID
- Returns:
- Fall Distance
-
builder
Creates a new Builder for aCombatEntry
.- Returns:
- Builder Class
-