net.minestom.server.item.enchant.TargetedConditionalEffect 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 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
);
}
}