Minecraft – How to /clear a specific spawn egg in from the inventory

minecraft-commandsminecraft-java-edition

I want to remove a specific spawn egg from a player's inventory but instead the two commands removes every spawn eggs. The first one remove every one while the second one removes nothing (but the command block says that it is correct):

/clear @a spawn_egg 0 5

/clear @a spawn_egg 52 5

How can I do to remove only the specific spawn egg of the creeper without removing all of them?

Best Answer

Try doing this: /clear (username) spawn_egg (item data) (amount)

For example, "/clear player123 spawn_egg 52 43" would clear 43 spider eggs from player123's inventory.

However, it is different if you have Essentials/EssentialsX installed.
I'm not entirely sure how to clear specific items, but I'm pretty sure "/clear player123 spawn_egg:52 43" would clear 43 spider eggs from player123.

Have a great day, I hope this helped! :)