I'm trying to add enchantment on an item stack to place on a mob that is spawning into the world
ItemStack helmet = new ItemStack(Items.DIAMOND_HELMET);
ItemStack chestplate = new ItemStack(Items.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Items.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Items.DIAMOND_BOOTS);
// Get the enchantment reference
RegistryEntry.Reference<Enchantment> enchantmentReference = mob.getWorld().getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(Enchantments.VANISHING_CURSE);
// Apply enchantments to each armor piece using EnchantmentHelper
EnchantmentHelper.set(helmet, enchantmentReference); // incorrect
mob.equipStack(EquipmentSlot.HEAD, helmet);
mob.equipStack(EquipmentSlot.CHEST, chestplate);
mob.equipStack(EquipmentSlot.LEGS, leggings);
mob.equipStack(EquipmentSlot.FEET, boots);