mojira.dev
MC-100762

You cannot detect survival enchantments with commands

If you try to use command/command blocks to test if a player is holding an enchanted item, if the item was enchanted using any survival method, it cannot find the player. It will only work if the item was obtained though the "give" command with the enchantment directly on the item.

https://youtu.be/p-hsGlxnUFM

Attachments

Comments 3

Please provide exact commands used here.

/testfor @p {SelectedItem:{tag:{ench:[{id:16,lvl:2}]}}}

You need to specify data types, otherwise (wrong) types will be assumed:

/testfor @p {SelectedItem:{tag:{ench:[{id:16s,lvl:2s}]}}}

BluePsychoRanger

(Unassigned)

Unconfirmed

Minecraft 1.9.2

Retrieved