Skip to main content
Generalization and changed the example to be minimal and reproducible.
Source Link
One 2 Many
  • 12.9k
  • 9
  • 52
  • 91

Testforblock finds an Why is my item I have summoned, butwith enchantments not one I madebeing detected?

I'm using the following command in a command blockI want to test for an enchanted diamond sword when it is held in a chest next to the player's hand. I tried this command block:

/testforblock ~1 ~ ~execute minecraft:chestif -1entity @p[nbt={ItemsSelectedItem:[{id:minecraft:diamond_sword,tag:{enchEnchantments:[{id:2"minecraft:sharpness",lvl:4}]}}]}]

It detectsFor some reason, this isn't detecting a Sharpness sword that I usedmade using an anvil. However, when I /give to get that already had Feather Falling 4, but it doesn't detectmyself a Feather FallingSharpness sword that I made using the anvil. Neither are named and are identical otherwise.

Is there some tag that differentiates the two? How would I get mywith this command block to accept both?, this item is detected:

give @s minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:4}]}

(Feather Falling was just one I picked while What is differentiating my /given sword with the anvil-created sword, and how can I getmake the anvil-created sword be detected by the command down)?

Testforblock finds an item I have summoned, but not one I made

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block:

/testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]}

It detects a sword that I used /give to get that already had Feather Falling 4, but it doesn't detect a Feather Falling sword that I made using the anvil. Neither are named and are identical otherwise.

Is there some tag that differentiates the two? How would I get my command block to accept both?

(Feather Falling was just one I picked while I get the command down)

Why is my item with enchantments not being detected?

I want to test for an enchanted diamond sword when it is held in the player's hand. I tried this command:

execute if entity @p[nbt={SelectedItem:{id:minecraft:diamond_sword,tag:{Enchantments:[{id:"minecraft:sharpness",lvl:4}]}}}]

For some reason, this isn't detecting a Sharpness sword that I made using an anvil. However, when I /give myself a Sharpness sword with this command, this item is detected:

give @s minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:4}]}

What is differentiating my /given sword with the anvil-created sword, and how can I make the anvil-created sword be detected by the command?

Formatting
Source Link
Skylinerw
  • 12.7k
  • 1
  • 23
  • 36

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block /testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]} It

/testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]}

It detects a sword that I used /give/give to get that already had feather fallingFeather Falling 4, but it doesn't detect a feather fallingFeather Falling sword that I made using the anvil. Neither are named and are identical otherwise. Is

Is there some tag that differentiates the two? How would I get my command block to accept both?

(feather fallingFeather Falling was just one I picked while I get the command down)

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block /testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]} It detects a sword that I used /give to get that already had feather falling 4, but it doesn't detect a feather falling sword that I made using the anvil. Neither are named and are identical otherwise. Is there some tag that differentiates the two? How would I get my command block to accept both?

(feather falling was just one I picked while I get the command down)

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block:

/testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]}

It detects a sword that I used /give to get that already had Feather Falling 4, but it doesn't detect a Feather Falling sword that I made using the anvil. Neither are named and are identical otherwise.

Is there some tag that differentiates the two? How would I get my command block to accept both?

(Feather Falling was just one I picked while I get the command down)

added 99 characters in body
Source Link
khanzarate
  • 372
  • 1
  • 6

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block /testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]} It detects a sword that I used /give to get that already had feather falling 4, but it doesn't detect a feather falling sword that I made using the anvil. Neither are named and are identical otherwise. Is there some tag that differentiates the two? How would I get my command block to accept both?

(feather falling was just one I picked while I get the command down)

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block /testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]} It detects a sword that I used /give to get that already had feather falling 4, but it doesn't detect a feather falling sword that I made using the anvil. Neither are named and are identical otherwise.

(feather falling was just one I picked while I get the command down)

I'm using the following command in a command block to test for an enchanted diamond sword in a chest next to the command block /testforblock ~1 ~ ~ minecraft:chest -1 {Items:[{id:minecraft:diamond_sword,tag:{ench:[{id:2,lvl:4}]}}]} It detects a sword that I used /give to get that already had feather falling 4, but it doesn't detect a feather falling sword that I made using the anvil. Neither are named and are identical otherwise. Is there some tag that differentiates the two? How would I get my command block to accept both?

(feather falling was just one I picked while I get the command down)

Source Link
khanzarate
  • 372
  • 1
  • 6
Loading