Record Class ValueCheckCondition
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.predicates.ValueCheckCondition
- All Implemented Interfaces:
Predicate<LootContext>, LootContextUser, LootItemCondition, Validatable
public record ValueCheckCondition(NumberProvider value, IntRange range)
extends Record
implements LootItemCondition
LootItemCondition that checks if a number provided by a
NumberProvider is within an IntRange.-
Nested Class Summary
Nested classes/interfaces inherited from interface LootItemCondition
LootItemCondition.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ValueCheckCondition> private final IntRangeThe field for therangerecord component.private final NumberProviderThe field for thevaluerecord component.Fields inherited from interface LootItemCondition
CODEC, DIRECT_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionValueCheckCondition(NumberProvider value, IntRange range) Creates an instance of aValueCheckConditionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<ValueCheckCondition> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static LootItemCondition.BuilderhasValue(NumberProvider value, IntRange range) range()Returns the value of therangerecord component.booleantest(LootContext context) 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.value()Returns the value of thevaluerecord component.Methods inherited from interface LootContextUser
getReferencedContextParams
-
Field Details
-
value
The field for thevaluerecord component. -
range
The field for therangerecord component. -
MAP_CODEC
-
-
Constructor Details
-
ValueCheckCondition
Creates an instance of aValueCheckConditionrecord class.- Parameters:
value- the value for thevaluerecord componentrange- the value for therangerecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceLootItemCondition
-
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
-
test
- Specified by:
testin interfacePredicate<LootContext>
-
hasValue
-
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). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
range
Returns the value of therangerecord component.- Returns:
- the value of the
rangerecord component
-