Record Class ConditionalEffect<T>
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.ConditionalEffect<T>
public record ConditionalEffect<T>(T effect, Optional<LootItemCondition> requirements)
extends Record
-
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> p_342730_, LootContextParamSet p_343196_) static com.mojang.serialization.Codec<LootItemCondition> conditionCodec(LootContextParamSet p_345298_) 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 p_343487_) Returns the value of therequirementsrecord component.final StringtoString()Returns a string representation of this record class.
-
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
-
conditionCodec
public static com.mojang.serialization.Codec<LootItemCondition> conditionCodec(LootContextParamSet p_345298_) -
codec
public static <T> com.mojang.serialization.Codec<ConditionalEffect<T>> codec(com.mojang.serialization.Codec<T> p_342730_, LootContextParamSet p_343196_) -
matches
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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
-