Record Class DamageType
java.lang.Object
java.lang.Record
net.minecraft.world.damagesource.DamageType
public record DamageType(String msgId, DamageScaling scaling, float exhaustion, DamageEffects effects, DeathMessageType deathMessageType)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Holder<DamageType>> private final DeathMessageTypeThe field for thedeathMessageTyperecord component.static final com.mojang.serialization.Codec<DamageType> private final DamageEffectsThe field for theeffectsrecord component.private final floatThe field for theexhaustionrecord component.private final StringThe field for themsgIdrecord component.private final DamageScalingThe field for thescalingrecord component.static final StreamCodec<RegistryFriendlyByteBuf, Holder<DamageType>> -
Constructor Summary
ConstructorsConstructorDescriptionDamageType(String msgdId, float exhaustion) DamageType(String msgdId, float exhaustion, DamageEffects effects) DamageType(String msgdId, DamageScaling scaling, float exhaustion) DamageType(String msgdId, DamageScaling scaling, float exhaustion, DamageEffects effects) DamageType(String msgId, DamageScaling scaling, float exhaustion, DamageEffects effects, DeathMessageType deathMessageType) Creates an instance of aDamageTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedeathMessageTyperecord component.effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.floatReturns the value of theexhaustionrecord component.final inthashCode()Returns a hash code value for this object.msgId()Returns the value of themsgIdrecord component.scaling()Returns the value of thescalingrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
msgId
The field for themsgIdrecord component. -
scaling
The field for thescalingrecord component. -
exhaustion
private final float exhaustionThe field for theexhaustionrecord component. -
effects
The field for theeffectsrecord component. -
deathMessageType
The field for thedeathMessageTyperecord component. -
DIRECT_CODEC
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
DamageType
-
DamageType
-
DamageType
-
DamageType
-
DamageType
public DamageType(String msgId, DamageScaling scaling, float exhaustion, DamageEffects effects, DeathMessageType deathMessageType) Creates an instance of aDamageTyperecord class.- Parameters:
msgId- the value for themsgIdrecord componentscaling- the value for thescalingrecord componentexhaustion- the value for theexhaustionrecord componenteffects- the value for theeffectsrecord componentdeathMessageType- the value for thedeathMessageTyperecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
msgId
Returns the value of themsgIdrecord component.- Returns:
- the value of the
msgIdrecord component
-
scaling
Returns the value of thescalingrecord component.- Returns:
- the value of the
scalingrecord component
-
exhaustion
public float exhaustion()Returns the value of theexhaustionrecord component.- Returns:
- the value of the
exhaustionrecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-
deathMessageType
Returns the value of thedeathMessageTyperecord component.- Returns:
- the value of the
deathMessageTyperecord component
-