Minecraft – Prevent Players From Stealing From Item Frames

minecraft-commandsminecraft-java-edition

How can I have item frames right in front of a player, and still keep them from stealing the items from the item frame(s)?
[I don't want to have to use the /clear command to just clear the item from the player's inventory when they obtain it.]

Best Answer

You can set Invulnerable to true to prevent an item frame from both providing the player with an item as well as preventing the player from breaking the item frame by punching it.

/entitydata @e[type=ItemFrame,c=1] {Invulnerable:1b}