How do I delete dropped items that contain a specific tag



  • https://youtu.be/VSijbIlVHmI I'm working on a medkit in Minecraft and I want it to work when I drop it. I need help on detecting dropped items with a specific tag. The base of the medkit is going to be a target block but I want for it to only work when I drop the item with the tag and not when I drop a normal item.



  • To select entities with the 'REPLACEME' tag:

    /execute at @e[type=item,nbt={Item:{tag:{tag:"REPLACEME"}}}] run COMMANDHERE

    It doesn't have to be a target block as long as it has the correct NBT tag.

    Replace 'REPLACEME' with the tag - in your case, 'medkit' - and 'COMMANDHERE' with whatever you want to happen after it's dropped. Note you are executing at the entity, not as it, so any commands run will be run from the command block but at the location of the dropped entity. If you instead want things to happen to the entity, use as.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2