Use primitive type for exhaustion and put nullable on same line in DamageTypeRegistryEntry

This commit is contained in:
Chaosdave34 2024-12-23 18:08:27 +01:00
parent 5570b7bac8
commit 904dc9e86e
2 changed files with 11 additions and 13 deletions

View file

@ -31,7 +31,7 @@ public interface DamageTypeRegistryEntry {
* *
* @return the exhaustion * @return the exhaustion
*/ */
Float exhaustion(); float exhaustion();
/** /**
* Provides the {@link DamageScaling} for this damage type. * Provides the {@link DamageScaling} for this damage type.
@ -45,16 +45,14 @@ public interface DamageTypeRegistryEntry {
* *
* @return the damage effect * @return the damage effect
*/ */
@Nullable @Nullable DamageEffect damageEffect();
DamageEffect damageEffect();
/** /**
* Provides the {@link DeathMessageType} for this damage type. * Provides the {@link DeathMessageType} for this damage type.
* *
* @return the death message type * @return the death message type
*/ */
@Nullable @Nullable DeathMessageType deathMessageType();
DeathMessageType deathMessageType();
@ApiStatus.Experimental @ApiStatus.Experimental
@ApiStatus.NonExtendable @ApiStatus.NonExtendable
@ -77,7 +75,7 @@ public interface DamageTypeRegistryEntry {
* @see DamageType#getExhaustion() * @see DamageType#getExhaustion()
*/ */
@Contract(value = "_ -> this", mutates = "this") @Contract(value = "_ -> this", mutates = "this")
Builder exhaustion(Float exhaustion); Builder exhaustion(float exhaustion);
/** /**
* Sets the {@link DamageScaling} for this damage type. * Sets the {@link DamageScaling} for this damage type.

View file

@ -12,7 +12,7 @@ import static io.papermc.paper.registry.data.util.Checks.asConfigured;
public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry { public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry {
protected @Nullable String messageId; protected @Nullable String messageId;
protected @Nullable Float exhaustion; protected float exhaustion;
protected @Nullable DamageScaling damageScaling; protected @Nullable DamageScaling damageScaling;
protected @Nullable DamageEffects damageEffects; protected @Nullable DamageEffects damageEffects;
protected @Nullable DeathMessageType deathMessageType; protected @Nullable DeathMessageType deathMessageType;
@ -39,8 +39,8 @@ public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry {
} }
@Override @Override
public Float exhaustion() { public float exhaustion() {
return asConfigured(exhaustion, "exhaustion"); return exhaustion;
} }
@Override @Override
@ -71,7 +71,7 @@ public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry {
} }
@Override @Override
public Builder exhaustion(Float exhaustion) { public Builder exhaustion(float exhaustion) {
this.exhaustion = exhaustion; this.exhaustion = exhaustion;
return this; return this;
} }
@ -100,20 +100,20 @@ public class PaperDamageTypeRegistryEntry implements DamageTypeRegistryEntry {
return new DamageType( return new DamageType(
asConfigured(this.messageId, "messsageId"), asConfigured(this.messageId, "messsageId"),
asConfigured(this.damageScaling, "scaling"), asConfigured(this.damageScaling, "scaling"),
asConfigured(this.exhaustion, "exhaustion"), this.exhaustion,
this.damageEffects, this.damageEffects,
this.deathMessageType); this.deathMessageType);
} else if (this.damageEffects != null) { } else if (this.damageEffects != null) {
return new DamageType( return new DamageType(
asConfigured(this.messageId, "messsageId"), asConfigured(this.messageId, "messsageId"),
asConfigured(this.damageScaling, "scaling"), asConfigured(this.damageScaling, "scaling"),
asConfigured(this.exhaustion, "exhaustion"), this.exhaustion,
this.damageEffects); this.damageEffects);
} else { } else {
return new DamageType( return new DamageType(
asConfigured(this.messageId, "messsageId"), asConfigured(this.messageId, "messsageId"),
asConfigured(this.damageScaling, "scaling"), asConfigured(this.damageScaling, "scaling"),
asConfigured(this.exhaustion, "exhaustion") this.exhaustion
); );
} }
} }