Minecraft Item frame entitydata

minecraft-java-edition

The setup I have is a command that will test all item frames @e[type=ItemFrame] and if an item is placed into it, I want the item to receive an enchantment, but I want it to allow any item and use only one command. Is this an option?

Best Answer

If the enchantment is fine to be on any item, a simple /entitydata will do. Note that any enchantments that were previously on the item will be erased.

/entitydata @e[type=ItemFrame] {Item:{tag:{ench:[{id:16,lvl:1}]}}}