Topic category: Help with Minecraft modding (Java Edition)
I'm trying to summon a basic piglin/pillager with a crossbow that has a custom enchantment. I already know the enchantment works because I can give them the special crossbow by throwing it at them, but I want to be able to use a command to summon them with the special crossbow as a spawn egg. Like this: "/give @p piglin_spawn_egg{EntityTag:{id:"minecraft:piglin",HandItems:[{id:"minecraft:crossbow",tag:{Enchantments:[{id:thundering,lvl:2}]},Count:1},{}]}}" I can't get the highlighted part to work properly. The name of the mod is Illaging and the enchantment is called thundering. How do I format it properly so it summons a piglin with the crossbow enchanted properly? I've already tried illaging:thundering,lvl:2 but that doesnt work either.
I got it, turns out you need to put quotations around your enchantment, like this: "/give @p piglin_spawn_egg{EntityTag:{id:"minecraft:piglin",HandItems:[{id:"minecraft:crossbow",tag:{Enchantments:[{id:"illaging:thundering",lvl:2}]},Count:1},{}]}}"
As a tip, anytime you see the word "id" in a command, you're going to need quotes for whatever is after it.