Record Class TimeCheck
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.predicates.TimeCheck
- All Implemented Interfaces:
Predicate<LootContext>, LootContextUser, LootItemCondition, Validatable
public record TimeCheck(Holder<WorldClock> clock, Optional<Long> period, IntRange value)
extends Record
implements LootItemCondition
A LootItemCondition that checks the
against an
invalid reference
day time
IntRange after applying an optional modulo division.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Holder<WorldClock> The field for theclockrecord component.static final com.mojang.serialization.MapCodec<TimeCheck> The field for theperiodrecord component.private final IntRangeThe field for thevaluerecord component.Fields inherited from interface LootItemCondition
CODEC, DIRECT_CODEC, TYPED_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclock()Returns the value of theclockrecord component.com.mojang.serialization.MapCodec<TimeCheck> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.period()Returns the value of theperiodrecord component.booleantest(LootContext context) static TimeCheck.Buildertime(Holder<WorldClock> clock, IntRange value) 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
-
clock
The field for theclockrecord component. -
period
-
value
The field for thevaluerecord component. -
MAP_CODEC
-
-
Constructor Details
-
TimeCheck
Creates an instance of aTimeCheckrecord class.- Parameters:
clock- the value for theclockrecord componentperiod- the value for theperiodrecord componentvalue- the value for thevaluerecord 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>
-
time
-
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). -
clock
Returns the value of theclockrecord component.- Returns:
- the value of the
clockrecord component
-
period
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-