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

net.minestom.server.item.enchant.ConditionalEffect 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 ConditionalEffect(
        @NotNull E effect,
        @Nullable DataPredicate requirements
) implements Enchantment.Effect {

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy