Record Class TargetedConditionalEffect<T>
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.TargetedConditionalEffect<T>
public record TargetedConditionalEffect<T>(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional<LootItemCondition> requirements)
extends Record
-
Field Summary
Modifier and TypeFieldDescriptionprivate final EnchantmentTarget
The field for theaffected
record component.private final T
The field for theeffect
record component.private final EnchantmentTarget
The field for theenchanted
record component.private final Optional
<LootItemCondition> The field for therequirements
record component. -
Constructor Summary
ConstructorDescriptionTargetedConditionalEffect
(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional<LootItemCondition> requirements) Creates an instance of aTargetedConditionalEffect
record class. -
Method Summary
Modifier and TypeMethodDescriptionaffected()
Returns the value of theaffected
record component.static <S> com.mojang.serialization.Codec
<TargetedConditionalEffect<S>> codec
(com.mojang.serialization.Codec<S> p_344749_, LootContextParamSet p_345115_) effect()
Returns the value of theeffect
record component.Returns the value of theenchanted
record component.final boolean
Indicates whether some other object is "equal to" this one.static <S> com.mojang.serialization.Codec
<TargetedConditionalEffect<S>> equipmentDropsCodec
(com.mojang.serialization.Codec<S> p_345181_, LootContextParamSet p_345924_) final int
hashCode()
Returns a hash code value for this object.boolean
matches
(LootContext p_346180_) Returns the value of therequirements
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
enchanted
The field for theenchanted
record component. -
affected
The field for theaffected
record component. -
effect
The field for theeffect
record component. -
requirements
The field for therequirements
record component.
-
-
Constructor Details
-
TargetedConditionalEffect
public TargetedConditionalEffect(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional<LootItemCondition> requirements) Creates an instance of aTargetedConditionalEffect
record class.- Parameters:
enchanted
- the value for theenchanted
record componentaffected
- the value for theaffected
record componenteffect
- the value for theeffect
record componentrequirements
- the value for therequirements
record component
-
-
Method Details
-
codec
public static <S> com.mojang.serialization.Codec<TargetedConditionalEffect<S>> codec(com.mojang.serialization.Codec<S> p_344749_, LootContextParamSet p_345115_) -
equipmentDropsCodec
public static <S> com.mojang.serialization.Codec<TargetedConditionalEffect<S>> equipmentDropsCodec(com.mojang.serialization.Codec<S> p_345181_, LootContextParamSet p_345924_) -
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)
. -
enchanted
Returns the value of theenchanted
record component.- Returns:
- the value of the
enchanted
record component
-
affected
Returns the value of theaffected
record component.- Returns:
- the value of the
affected
record component
-
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
-