Datensatzklasse BossDefinition
java.lang.Object
java.lang.Record
de.delinkedde.mobarenareborn.boss.BossDefinition
- Datensatzkomponenten:
id- the stable, normalised identifierentityType- the underlying entity type to spawndisplayName- the MiniMessage name shown on the boss barhealthMultiplier- the factor applied to the scaled mob health for this bossdamageMultiplier- the factor applied to the scaled mob damage for this bossphases- the combat phases, ordered as configured
public record BossDefinition(@NotNull String id, @NotNull EntityType entityType, @NotNull String displayName, double healthMultiplier, double damageMultiplier, @NotNull List<BossPhase> phases, @Nullable String reward, @NotNull List<String> drops)
extends Record
A data-driven boss definition loaded from
bosses.yml.
A boss is a vanilla EntityType with multiplied health and damage and a list of
health-gated phases. The phase that is active for a given remaining-health
fraction is resolved by phaseFor(double).
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungBossDefinition(@NotNull String id, @NotNull EntityType entityType, @NotNull String displayName, double healthMultiplier, double damageMultiplier, @NotNull List<BossPhase> phases, @Nullable String reward, @NotNull List<String> drops) Canonical constructor; defensively copies the phase list. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungdoubleGibt den Wert für die DatensatzkomponentedamageMultiplierzurück.@NotNull StringGibt den Wert für die DatensatzkomponentedisplayNamezurück.drops()Gibt den Wert für die Datensatzkomponentedropszurück.@NotNull EntityTypeGibt den Wert für die DatensatzkomponenteentityTypezurück.final booleanGibt an, ob ein anderes Objekt diesem gleich ("equal to") ist.static @NotNull BossDefinitionfromSection(@NotNull String id, @NotNull ConfigurationSection section) Parses a boss definition from a configuration section.final inthashCode()Gibt einen Hashcodewert für diese Objekt zurück.doubleGibt den Wert für die DatensatzkomponentehealthMultiplierzurück.@NotNull Stringid()Gibt den Wert für die Datensatzkomponenteidzurück.phaseFor(double fraction) Resolves the phase active for the given remaining-health fraction.phases()Gibt den Wert für die Datensatzkomponentephaseszurück.@Nullable Stringreward()Gibt den Wert für die Datensatzkomponenterewardzurück.final StringtoString()Gibt eine Zeichenfolgendarstellung dieser Datensatzklasse zurück.
-
Konstruktordetails
-
BossDefinition
public BossDefinition(@NotNull @NotNull String id, @NotNull @NotNull EntityType entityType, @NotNull @NotNull String displayName, double healthMultiplier, double damageMultiplier, @NotNull @NotNull List<BossPhase> phases, @Nullable @Nullable String reward, @NotNull @NotNull List<String> drops) Canonical constructor; defensively copies the phase list.- Parameter:
id- the identifierentityType- the entity typedisplayName- the boss-bar namehealthMultiplier- the health factordamageMultiplier- the damage factorphases- the phases
-
-
Methodendetails
-
phaseFor
Resolves the phase active for the given remaining-health fraction.The active phase is the one with the smallest threshold that is still at or above the fraction (so the boss advances to the next phase as it loses health). When the fraction is above every threshold, the highest-threshold phase is returned.
- Parameter:
fraction- the remaining-health fraction (0..1)- Gibt zurück:
- the active phase, or empty if no phases are defined
-
fromSection
@NotNull public static @NotNull BossDefinition fromSection(@NotNull @NotNull String id, @NotNull @NotNull ConfigurationSection section) Parses a boss definition from a configuration section.- Parameter:
id- the boss identifier (normalised to lower case)section- the configuration section- Gibt zurück:
- the parsed definition
- Löst aus:
IllegalArgumentException- if the entity type is invalid
-
toString
Gibt eine Zeichenfolgendarstellung dieser Datensatzklasse zurück. Die Darstellung enthält den Namen der Klasse, gefolgt vom Namen und Wert jeder der Datensatzkomponenten. -
hashCode
public final int hashCode()Gibt einen Hashcodewert für diese Objekt zurück. Der Wert wird vom Hashcode jeder der Datensatzkomponenten abgeleitet. -
equals
Gibt an, ob ein anderes Objekt diesem gleich ("equal to") ist. Die Objekte sind gleich, wenn das andere Objekt der gleichen Klasse angehört und alle Datensatzkomponenten gleich sind. Referenzkomponenten werden verglichen mitObjects::equals(Object,Object); primitive Komponenten werden verglichen mit "==". -
id
Gibt den Wert für die Datensatzkomponenteidzurück.- Gibt zurück:
- Wert der Datensatzkomponente
id
-
entityType
Gibt den Wert für die DatensatzkomponenteentityTypezurück.- Gibt zurück:
- Wert der Datensatzkomponente
entityType
-
displayName
Gibt den Wert für die DatensatzkomponentedisplayNamezurück.- Gibt zurück:
- Wert der Datensatzkomponente
displayName
-
healthMultiplier
public double healthMultiplier()Gibt den Wert für die DatensatzkomponentehealthMultiplierzurück.- Gibt zurück:
- Wert der Datensatzkomponente
healthMultiplier
-
damageMultiplier
public double damageMultiplier()Gibt den Wert für die DatensatzkomponentedamageMultiplierzurück.- Gibt zurück:
- Wert der Datensatzkomponente
damageMultiplier
-
phases
Gibt den Wert für die Datensatzkomponentephaseszurück.- Gibt zurück:
- Wert der Datensatzkomponente
phases
-
reward
Gibt den Wert für die Datensatzkomponenterewardzurück.- Gibt zurück:
- Wert der Datensatzkomponente
reward
-
drops
Gibt den Wert für die Datensatzkomponentedropszurück.- Gibt zurück:
- Wert der Datensatzkomponente
drops
-