I am creating a set of command blocks which allow my survival players to trade a normal item frame for an invisible item frame. Here is what I have so far:
The first command block removes an item frame from the players inventory. The command block is set to impulse, unconditional, needs redstone. Players push a button to activate this command block.
clear @p item_frame 1
The second command block gives an invisible item frame to the player. This command block is set to chain, conditional, always active.
/give @p minecraft:item_frame{EntityTag:{Invisible:1}, display:{Name:'{"text":"Invisible Item Frame"}'}}
These two command blocks actually work fairly well. However, the first command block does not distinguish between an invisible item frame and a normal item frame. If a player has an invisible item frame in their inventory, it may be cleared and then immediately replaced, which makes it appear as though the command block is doing nothing.
I want the first command to accept only normal item frames. I have tried two codes:
clear @p item_frame{EntityTag:{Invisible:0}} 1
and
clear @p item_frame{display:{Name:'{"text":""}'}} 1
Neither of these codes work.
How do I write the code so that it only accepts items frames that are visible or item frames without a custom name?