Trying to apply random enchantments with levels to summoned mob?

Help | Java 1.19

I'm currently trying to make a datapack for 1.19 which has a small chance of summoning zombies that wear netherite armor, but I'm not sure how to go about getting the proper enchantments onto their armor/weapons. I've already gotten the random chance of the armor spawning to work, but not the enchantments yet. I've tried using the same formatting from enchanting items with levels in loot tables, but it doesn't seem to work. Any ideas on how I could do this?

Posted Jul 11, 2022, 4:52 AM UTC

13
ExpertCoder14Command Experienced•

What do you have so far? We work best with your initial code, so we can tweak it to get what we're looking for.

Try to show us the least you can for us to understand what you're working with. This is called a minimal reproducible example.

1
commit_fork_socketOPCommand Rookie•

https://www.dropbox.com/sh/ojoontfpqsdj5ps/AAA2cVVLRaHmnMcxEjmylAASa?dl=1 this is what I've got so far, but I was wondering if it could work to simply have the netherite replacement happen only on zombies that get diamond armor, and then take all of their nbt data or if that wouldn't work.

1
GalSergeyCommand Experienced•

Create a loot table with the desired items, use the "minecraft:enchant_with_levels" function to enchant an item with random enchantments.

1