1

I'm wondering if there's a way to /replaceitem the same amount as a previous execute if command,

so basically I am trying to make my own blocks in a datapack that is craftable, so I've made crafting recipes that makes spawn eggs, then I want to replace them with a spawn egg that spawns an entity with a tag so I can set a block there,

but the problem is that if I just have one command like

execute if entity @a[nbt={SelectedItem:{id:"minecraft:villager_spawn_egg",Count:1b}}] run replaceitem entity @a weapon.mainhand minecraft:villager_spawn_egg{isplacer:1b} 1

that just checks if the player's active slot has a spawn egg and then replaces it with one with a tag on it, it will always replace it with 1, so if you have for example 64 spawn eggs without tag, you would still just get one with a tag,

is there any way to di this without having 64 different commands for each amount* PS: sorry for my English it's not my primary language

2
  • This should be possible using the /loot command. This was actually already asked here, but the answers there aren't really good, so I'll write a new answer over there and only then close this one as duplicate. Jan 27, 2020 at 18:14
  • It's actually not possible, because of the bug MC-138299. To make it work with /loot, you would need to create a loot table, which is not only a lot of effort, but also would still require you to specify all 64 variants (unless you want it to be a random amount). Jan 28, 2020 at 3:33

0