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<DamageType>
private final DeathMessageType
The field for thedeathMessageType
record component.private final DamageEffects
The field for theeffects
record component.private final float
The field for theexhaustion
record component.private final String
The field for themsgId
record component.private final DamageScaling
The field for thescaling
record component. -
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 aDamageType
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedeathMessageType
record component.effects()
Returns the value of theeffects
record component.final boolean
Indicates whether some other object is "equal to" this one.float
Returns the value of theexhaustion
record component.final int
hashCode()
Returns a hash code value for this object.msgId()
Returns the value of themsgId
record component.scaling()
Returns the value of thescaling
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
msgId
The field for themsgId
record component. -
scaling
The field for thescaling
record component. -
exhaustion
private final float exhaustionThe field for theexhaustion
record component. -
effects
The field for theeffects
record component. -
deathMessageType
The field for thedeathMessageType
record component. -
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 aDamageType
record class.- Parameters:
msgId
- the value for themsgId
record componentscaling
- the value for thescaling
record componentexhaustion
- the value for theexhaustion
record componenteffects
- the value for theeffects
record componentdeathMessageType
- the value for thedeathMessageType
record 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 themsgId
record component.- Returns:
- the value of the
msgId
record component
-
scaling
Returns the value of thescaling
record component.- Returns:
- the value of the
scaling
record component
-
exhaustion
public float exhaustion()Returns the value of theexhaustion
record component.- Returns:
- the value of the
exhaustion
record component
-
effects
Returns the value of theeffects
record component.- Returns:
- the value of the
effects
record component
-
deathMessageType
Returns the value of thedeathMessageType
record component.- Returns:
- the value of the
deathMessageType
record component
-