Interface CombatTracker
Represents entity's combat tracker
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCombatEntry
(CombatEntry combatEntry) Adds a new entry the pool of combat entries, updating the entity's combat state.Calculates the fall location type from the current entity's location.Calculates the most significant fall damage entry.int
Gets the last or current combat duration.Gets the list of recorded combat entries.Constructs a death message based on the current combat history.Gets the entity behind this combat tracker.boolean
Checks whether the entity is in combat, i.e.boolean
Checks whether the entity has started recording damage, i.e.void
Resets entity's combat state, clearing combat history.void
setCombatEntries
(List<CombatEntry> combatEntries) Sets the entity's combat history.
-
Method Details
-
getEntity
LivingEntity getEntity()Gets the entity behind this combat tracker.- Returns:
- the entity behind this combat tracker
-
getCombatEntries
List<CombatEntry> getCombatEntries()Gets the list of recorded combat entries.The returned list is a copy, so any modifications to its contents won't affect this entity's combat history.
- Returns:
- the list of combat entries
- See Also:
-
setCombatEntries
Sets the entity's combat history.Note that overriding the entity's combat history won't affect the entity's current or new combat state. Reset the current combat state and register new combat entries instead if you want the new history to affect the combat state.
- Parameters:
combatEntries
- combat entries- See Also:
-
computeMostSignificantFall
@Nullable CombatEntry computeMostSignificantFall()Calculates the most significant fall damage entry.- Returns:
- the most significant fall damage entry
-
isInCombat
boolean isInCombat()Checks whether the entity is in combat, i.e. has taken damage from an entity since the combat tracking has begun.- Returns:
- whether the entity is in combat
-
isTakingDamage
boolean isTakingDamage()Checks whether the entity has started recording damage, i.e. its combat tracking is active.- Returns:
- whether the entity has started recording damage
-
getCombatDuration
int getCombatDuration()Gets the last or current combat duration.- Returns:
- the combat duration
- See Also:
-
addCombatEntry
Adds a new entry the pool of combat entries, updating the entity's combat state.- Parameters:
combatEntry
- combat entry
-
getDeathMessage
Component getDeathMessage()Constructs a death message based on the current combat history.- Returns:
- a death message
-
resetCombatState
void resetCombatState()Resets entity's combat state, clearing combat history. -
calculateFallLocationType
@Nullable FallLocationType calculateFallLocationType()Calculates the fall location type from the current entity's location.- Returns:
- the fall location type
-