Record Class Sum
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.Sum
- All Implemented Interfaces:
LootContextUser, NumberProvider, Validatable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<Sum> private final List<NumberProvider> The field for thesummandsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSum(List<NumberProvider> summands) Creates an instance of aSumrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<Sum> codec()final booleanIndicates whether some other object is "equal to" this one.floatgetFloat(LootContext context) intgetInt(LootContext context) final inthashCode()Returns a hash code value for this object.static Sumsum(NumberProvider... summands) summands()Returns the value of thesummandsrecord component.final StringtoString()Returns a string representation of this record class.voidvalidate(ValidationContext context) Validate that this object is used correctly according to the given ValidationContext.Methods inherited from interface LootContextUser
getReferencedContextParams
-
Field Details
-
summands
The field for thesummandsrecord component. -
MAP_CODEC
-
-
Constructor Details
-
Sum
Creates an instance of aSumrecord class.- Parameters:
summands- the value for thesummandsrecord component
-
-
Method Details
-
sum
-
codec
- Specified by:
codecin interfaceNumberProvider
-
getInt
- Specified by:
getIntin interfaceNumberProvider
-
getFloat
- Specified by:
getFloatin interfaceNumberProvider
-
validate
Description copied from interface:LootContextUserValidate that this object is used correctly according to the given ValidationContext.- Specified by:
validatein interfaceLootContextUser- Specified by:
validatein interfaceValidatable
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
summands
Returns the value of thesummandsrecord component.- Returns:
- the value of the
summandsrecord component
-