All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minestom.server.item.enchant.TargetedConditionalEffect Maven / Gradle / Ivy

There is a newer version: 7320437640
Show newest version
package net.minestom.server.item.enchant;

import net.minestom.server.condition.DataPredicate;
import net.minestom.server.utils.nbt.BinaryTagSerializer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public record TargetedConditionalEffect(
        @NotNull Enchantment.Target enchanted,
        @Nullable Enchantment.Target affected,
        @NotNull E effect,
        @Nullable DataPredicate requirements
) implements Enchantment.Effect {

    public static  @NotNull BinaryTagSerializer> nbtType(@NotNull BinaryTagSerializer effectType) {
        return BinaryTagSerializer.object(
                "enchanted", Enchantment.Target.NBT_TYPE, TargetedConditionalEffect::enchanted,
                "affected", Enchantment.Target.NBT_TYPE.optional(), TargetedConditionalEffect::affected,
                "effect", effectType, TargetedConditionalEffect::effect,
                "requirements", DataPredicate.NBT_TYPE.optional(), TargetedConditionalEffect::requirements,
                TargetedConditionalEffect::new
        );
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy