net.minestom.server.item.enchant.ConditionalEffect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
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
);
}
}