Package net.minecraft.world.damagesource
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 p_270454_, float p_270889_) DamageType(String p_270473_, float p_270700_, DamageEffects p_270105_) DamageType(String p_270099_, DamageScaling p_270717_, float p_270846_) DamageType(String p_270743_, DamageScaling p_270585_, float p_270555_, DamageEffects p_270608_) 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
public DamageType(String p_270743_, DamageScaling p_270585_, float p_270555_, DamageEffects p_270608_) -
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
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
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
-