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
Modifier and TypeFieldDescriptionprivate final T
The field for theeffect
record component.private final Optional
<LootItemCondition> The field for therequirements
record component. -
Constructor Summary
ConstructorDescriptionConditionalEffect
(T effect, Optional<LootItemCondition> requirements) Creates an instance of aConditionalEffect
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.mojang.serialization.Codec
<ConditionalEffect<T>> codec
(com.mojang.serialization.Codec<T> p_345918_, LootContextParamSet p_344884_) static com.mojang.serialization.Codec
<LootItemCondition> conditionCodec
(LootContextParamSet p_345335_) effect()
Returns the value of theeffect
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
matches
(LootContext p_344977_) Returns the value of therequirements
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
effect
The field for theeffect
record component. -
requirements
The field for therequirements
record component.
-
-
Constructor Details
-
ConditionalEffect
Creates an instance of aConditionalEffect
record class.- Parameters:
effect
- the value for theeffect
record componentrequirements
- the value for therequirements
record component
-
-
Method Details
-
conditionCodec
public static com.mojang.serialization.Codec<LootItemCondition> conditionCodec(LootContextParamSet p_345335_) -
codec
public static <T> com.mojang.serialization.Codec<ConditionalEffect<T>> codec(com.mojang.serialization.Codec<T> p_345918_, LootContextParamSet p_344884_) -
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 theeffect
record component.- Returns:
- the value of the
effect
record component
-
requirements
Returns the value of therequirements
record component.- Returns:
- the value of the
requirements
record component
-