mojira.dev
MC-85345

SelectedItem not working with Enchantments Proproperly

When trying to detect if a item has a enchant using the SelectedItem nbt tag, you can detect items with enchants when naturally adding the enchant using a crafting table or using the give command with the enchant already on it. If you give yourself the item and then use the /enchant command, then the SelectedItem nbt tag doesn't pick up that the item has a enchantment on it.

Steps to Reproduce
1.Put down a command block with this command:

/testfor @p {SelectedItem:{tag:{ench:[{id:33,lvl:1}]}}}

2. Put a button on the command block & put a comparator detecting if the command block has a output or not.

3. Use this command.

/give @p iron_pickaxe 1 0 {ench:[{id:33,lvl:1}]}

Click the button while holding the pickaxe to see if the comparator activated. (This should work.)

4. Use this command.

/give @p iron_pickaxe 1 0

Hold the item in your hand & do this command.

/enchant @p 33 1

Click the button and see if the comparator activated or not. (This should not work.)

Linked issues

Comments 1

You need to put s after each TAG_Short value. It then works fine for me.

AoElite

(Unassigned)

Unconfirmed

Minecraft 1.8.8, Minecraft 15w32b

Retrieved