Why is this command deleting all entities?

Why is this command deleting all entities? - Unrecognizable woman holding paw of dog

I'm trying to remove a specific, named, item if it is dropped on the floor. I have the following on my command block:

kill @e[type=Item] {Item:{tag:{display:{Name:"RedFlag"}}}

But it's removing all items, not just the one I want. What am I doing wrong?

I also tried

kill @e[type=Item] {Item:{id:"red_flower",Damage:2}}

But that didn't work either, it's still removing all items, even things that aren't red flowers!



Best Answer

Maybe you can do it by using the new /execute command;

  1. Give the item you want to remove a scoreboard objective: /scoreboard objectives add RedFlag dummy RedFlag
  2. Set the score for the item to 1: /scoreboard players set @e[type=Item,r=5] RedFlag 1
  3. Than use this command: /execute @e[score_RedFlag=1,score_RedFlag_min=1,type=Item] ~ ~ ~ kill @e[r=0,type=Item]

Maybe if you use this it will work.




Pictures about "Why is this command deleting all entities?"

Why is this command deleting all entities? - Side view of young woman in hoodie sitting on floor near sofa and playing with obedient brown Labrador while resting during free time
Why is this command deleting all entities? - Crop hacker silhouette typing on computer keyboard while hacking system
Why is this command deleting all entities? - Full body optimistic young female with curly hair smiling and teaching Beagle dog beg command on sunny summer day in countryside



What command removes all entities in Minecraft?

One of the most popular and fastest ways to clear items is the kill command. First, type /kill @e[type=item] in the chat and press enter to remove all dropped items in your Minecraft world instantly.

What is the command to remove entities?

The kill command or \u201c/kill @e[type=item]\u201d can remove all the dropped items in the Minecraft world instantly. You'll need operator status and cheats to be enabled to use the kill command. If you want to clear all the dropped items within a specific radius, use the \u201c/kill @e[type=item, r=x]\u201d command.

How do I remove all entities from the world?

The following list contains all the names of all entities in their various forms. The conventional names are taken from the normal minecraft wiki....Entity Names.Conventional NameCode Name (MCP 1.8)Entity Id (1.13+)ArrowArrowarrowMooshroomMooshroommooshroomMagma CubeMagmaCubemagma_cubeZombieZombiezombie97 more rows



Why Sudo Is The Best Command in Minecraft




More answers regarding why is this command deleting all entities?

Answer 2

Very few data tags can be used to select entities, and the format you are trying is not how it works. Try:

/entitydata @e[type=Item,c=1] {CustomName:"killitem"}

and then

/kill@e[name=killitem]

The selector c=1 in the first command could be changed to match the amount of items you want to name.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Ivan Babydov, Ivan Babydov, Anete Lusina, Blue Bird