Record Class ConstantValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.ints.ConstantValue
- All Implemented Interfaces:
ContextIntProvider, Validatable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ConstantValue> static final com.mojang.serialization.MapCodec<ConstantValue> private final intThe field for thevaluerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionConstantValue(int value) Creates an instance of aConstantValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<ConstantValue> codec()final booleanIndicates whether some other object is "equal to" this one.intgetIntUnsafe(LootContext random) final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.voidvalidate(ValidationContext context) intvalue()Returns the value of thevaluerecord component.Methods inherited from interface ContextIntProvider
getInt
-
Field Details
-
value
private final int valueThe field for thevaluerecord component. -
MAP_CODEC
-
INLINE_CODEC
-
-
Constructor Details
-
ConstantValue
public ConstantValue(int value) Creates an instance of aConstantValuerecord class.- Parameters:
value- the value for thevaluerecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceContextIntProvider
-
validate
- Specified by:
validatein interfaceValidatable
-
getIntUnsafe
- Specified by:
getIntUnsafein interfaceContextIntProvider
-
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 with thecomparemethod from their corresponding wrapper classes. -
value
public int value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-