Package me.gamercoder215.mobchip.combat
Class CombatEntry.Builder
java.lang.Object
me.gamercoder215.mobchip.combat.CombatEntry.Builder
- Enclosing class:
CombatEntry
Builder class for a
CombatEntry
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new CombatEntry.setAttacker
(@Nullable Entity attacker) Sets the Entity that attacked the Entity that owns this CombatEntry.Sets the cause of this CombatEntry.setCombatDuration
(int ticks) Sets the duration of this CombatEntry.setDamage
(float damage) Sets the damage taken by the Entity.setFallDistance
(float fall) Sets the fall distance of the Entity.setHealthBeforeDamage
(float health) Sets the health of the Entity before taking damage.setLocation
(@Nullable CombatLocation location) Sets the CombatLocation of this CombatEntry.Sets the owner of this CombatEntry.
-
Method Details
-
setOwner
@NotNull public @NotNull CombatEntry.Builder setOwner(@NotNull @NotNull Mob owner) throws IllegalArgumentException Sets the owner of this CombatEntry.- Parameters:
owner
- Owner of this CombatEntry- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if owner is null
-
setCause
@NotNull public @NotNull CombatEntry.Builder setCause(@NotNull EntityDamageEvent.DamageCause cause) throws IllegalArgumentException Sets the cause of this CombatEntry.- Parameters:
cause
- Cause of this CombatEntry- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if cause is null
-
setCombatDuration
@NotNull public @NotNull CombatEntry.Builder setCombatDuration(int ticks) throws IllegalArgumentException Sets the duration of this CombatEntry.- Parameters:
ticks
- Duration of this CombatEntry- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if ticks is less than 0
-
setHealthBeforeDamage
@NotNull public @NotNull CombatEntry.Builder setHealthBeforeDamage(float health) throws IllegalArgumentException Sets the health of the Entity before taking damage.- Parameters:
health
- Health of the Entity before taking damage- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if health is less than 0
-
setDamage
@NotNull public @NotNull CombatEntry.Builder setDamage(float damage) throws IllegalArgumentException Sets the damage taken by the Entity.- Parameters:
damage
- Damage taken by the Entity- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if damage is less than 0
-
setLocation
@NotNull public @NotNull CombatEntry.Builder setLocation(@Nullable @Nullable CombatLocation location) Sets the CombatLocation of this CombatEntry.- Parameters:
location
- CombatLocation of this CombatEntry- Returns:
- this class, for chaining
-
setFallDistance
@NotNull public @NotNull CombatEntry.Builder setFallDistance(float fall) throws IllegalArgumentException Sets the fall distance of the Entity.- Parameters:
fall
- Fall distance of the Entity- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException
- if fall is less than 0
-
setAttacker
Sets the Entity that attacked the Entity that owns this CombatEntry.- Parameters:
attacker
- Entity that attacked the Entity that owns this CombatEntry- Returns:
- this class, for chaining
-
build
Builds a new CombatEntry.- Returns:
- new CombatEntry
- Throws:
IllegalStateException
- if owner or cause is null, or ticks/health/damage/fall is less than 0
-