The coordinates can be added as target selector arguments, i.e. inside the @e[...]
, using the x
, y
, and z
arguments, combined with r
to set a maximum radius. Note that Tilde notation is not allowed for this, you need the absolute coordinates.
Placing an enchanted item in an Item Frame has to be done all at once, since the entitydata is running on the Item Frame, not on the item that is in it. This is done by setting the Item
tag of the item frame to a valid compound NBT structure for an item, such as
{id:"minecraft:stone_sword",tag:{ench:[{id:16,lvl:1}]}}
for a Sharpness I Stone Sword.
Overall, the command you want to be running might look like:
entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=2] {Item:{id:"minecraft:stone_sword",tag:{ench:[{id:16,lvl:1}]}}}
Be careful regarding the closing parentheses.
Items don't, by default, have any identifying feature that would separate them from another item of the same type. You can swap the position of two levers around in your inventory and your inventory will be in the exact same state.
If you want to test that a specific lever is in the frame, you'll need to make something about it unique. For example, you could give the item you want to test for unique Lore:
/give @p lever 1 0 {display:{Lore:["Key"]}}
And then test for it like this;
/testfor @e[type=ItemFrame,x=-322,y=57,z=-61,r=0] {Item:{id:minecraft:lever,tag:{display:{Lore:["Key"]}}},ItemRotation:5b}
Best Answer
As Skylinerw said, item frames cannot be made invisible.
However, you just want to make a floating item. You can summon an item that won't despawn which players can't pick up. On top of that, you can use the
NoGravity
tag which will allow the item to float in mid-air. Combining these 3 abilities, you can summon the item using this command:If you do not like that the item is spinning around, you can use a second method where an invisible armor stand has the item in his head slot using this command: