How do you know if a player has an item in the armor slot?

By
5

I want to know how to recognize in minecraft whether a player has an item in the armor slot, but not visually but with a command or tags.

MC. Version 1.13 would be nice.

By

Just to info it is about an in-path Elytra system.

: D

Ta

This should solve your problem:

tag @a [tag = hasChestplate] remove hasChestplate
tag @a [nbt = {Inventory: [{Slot: 102b, id: "minecraft: iron_chestplate"}]}] add hasChestplate
tag @a [nbt = {Inventory: [{slot: 102b, id: "minecraft: diamond_chestplate"}]}] add hasChestplate
tag @a [nbt = {Inventory: [{Slot: 102b, id: "minecraft: leather_chestplate"}]}] add hasChestplate
tag @a [nbt = {Inventory: [{slot: 102b, id: "minecraft: chainmail_chestplate"}]}] add hasChestplate
tag @a [nbt = {Inventory: [{Slot: 102b, id: "minecraft: golden_chestplate"}]}] add hasChestplate
say @a [tag = hasChestplate]

This checks if a player wears a breastplate. If you need more help, just let me know!

By

Is this as a datapack or how do I have to do in command blocks?

By

Or. MC version

Ta

These are just commands, if you want to make them a datapack then you just have to copy them into a .mcfunction, if you want them as command blocks, you have to put them one after another in a chain of command-lines.

This is in the current version: Minecraft 1.13