Record Class TargetedConditionalEffect<T>
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.TargetedConditionalEffect<T>
- All Implemented Interfaces:
Validatable
public record TargetedConditionalEffect<T>(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional<LootItemCondition> requirements)
extends Record
implements Validatable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EnchantmentTargetThe field for theaffectedrecord component.private final TThe field for theeffectrecord component.private final EnchantmentTargetThe field for theenchantedrecord component.private final Optional<LootItemCondition> The field for therequirementsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionTargetedConditionalEffect(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional<LootItemCondition> requirements) Creates an instance of aTargetedConditionalEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaffected()Returns the value of theaffectedrecord component.static <S> com.mojang.serialization.Codec<TargetedConditionalEffect<S>> codec(com.mojang.serialization.Codec<S> effectCodec) effect()Returns the value of theeffectrecord component.Returns the value of theenchantedrecord component.final booleanIndicates whether some other object is "equal to" this one.static <S> com.mojang.serialization.Codec<TargetedConditionalEffect<S>> equipmentDropsCodec(com.mojang.serialization.Codec<S> effectCodec) 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
-
enchanted
The field for theenchantedrecord component. -
affected
The field for theaffectedrecord component. -
effect
The field for theeffectrecord component. -
requirements
The field for therequirementsrecord component.
-
-
Constructor Details
-
TargetedConditionalEffect
public TargetedConditionalEffect(EnchantmentTarget enchanted, EnchantmentTarget affected, T effect, Optional<LootItemCondition> requirements) Creates an instance of aTargetedConditionalEffectrecord class.- Parameters:
enchanted- the value for theenchantedrecord componentaffected- the value for theaffectedrecord componenteffect- the value for theeffectrecord componentrequirements- the value for therequirementsrecord component
-
-
Method Details
-
codec
public static <S> com.mojang.serialization.Codec<TargetedConditionalEffect<S>> codec(com.mojang.serialization.Codec<S> effectCodec) -
equipmentDropsCodec
public static <S> com.mojang.serialization.Codec<TargetedConditionalEffect<S>> equipmentDropsCodec(com.mojang.serialization.Codec<S> 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). -
enchanted
Returns the value of theenchantedrecord component.- Returns:
- the value of the
enchantedrecord component
-
affected
Returns the value of theaffectedrecord component.- Returns:
- the value of the
affectedrecord component
-
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
-