Record Class ConditionalEffect<T>
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.ConditionalEffect<T>
- All Implemented Interfaces:
Validatable
public record ConditionalEffect<T>(T effect, Optional<LootItemCondition> requirements)
extends Record
implements Validatable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TThe field for theeffectrecord component.private final Optional<LootItemCondition> The field for therequirementsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionConditionalEffect(T effect, Optional<LootItemCondition> requirements) Creates an instance of aConditionalEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.mojang.serialization.Codec<ConditionalEffect<T>> codec(com.mojang.serialization.Codec<T> effectCodec) effect()Returns the value of theeffectrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatches(LootContext context) Returns the value of therequirementsrecord component.final StringtoString()Returns a string representation of this record class.voidvalidate(ValidationContext context)
-
Field Details
-
effect
The field for theeffectrecord component. -
requirements
The field for therequirementsrecord component.
-
-
Constructor Details
-
ConditionalEffect
Creates an instance of aConditionalEffectrecord class.- Parameters:
effect- the value for theeffectrecord componentrequirements- the value for therequirementsrecord component
-
-
Method Details
-
codec
public static <T> com.mojang.serialization.Codec<ConditionalEffect<T>> codec(com.mojang.serialization.Codec<T> effectCodec) -
matches
-
validate
- 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). -
effect
Returns the value of theeffectrecord component.- Returns:
- the value of the
effectrecord component
-
requirements
Returns the value of therequirementsrecord component.- Returns:
- the value of the
requirementsrecord component
-