I tried using /kill @e[type=item_frame]
. However, it kills every item frame. So my question is, how can I kill only one item frame?
2 Answers
You can add a scoreboard tag to the item frame when you spawn it in, so your kill function looks like this:
kill @e[type=item_frame,tag=killable]
with killable being the tag. If a player is running the command/you aren't spawning it in you can kill one within a certain radius:
kill @e[type=item_frame,distance=..1]
which will kill any item frames within one block.
Edit: I saw your other question and here's the summon command you would use:
summon minecraft:item_frame -1242 58 219 {Facing:2,Tags["killable"]}
Edit 2: I just remembered that a tag is not unique: if you have multiple entities tagged as 'killable' it will kill all of them. Instead, use a customName:
summon minecraft:item_frame -1242 58 219 {Facing:2,CustomName:"killableFrame"}
kill @e[name=killableFrame]
-
Thanks Nik3141 but there is a problem if i summon an item frame using the command
/summon minecraft:item_frame -1242 58 219 {Facing:2,CustomName:"killableFrame"}
when i do :kill @e[name=killableFrame]
it says: any entity found Apr 19, 2019 at 19:36 -
I've never heard of 'any entity found' so you should un-accept my answer so other people will come to see if they can answer it. Sorry.– Nik3141Apr 19, 2019 at 19:45
You can get right in front of the item frame, type /kill and press space then press tab. You should see the item frame's uuid pop up. Then execute the command. The item frame will disappear and a message will say "Killed Item Frame".