Pleasee, help! Im trying to create a sword that when it hits an entity, it gives the wither effect.
The method I'm using is: having a scoreboard with the objective "hit", a sword with a custom tag, and then using the following input
execute at @a[nbt={SelectedItem:{tag:{"minecraft:custom_data":{praga:1b}}}},scores={hit=1..}] at @s run effect give @e[distance=..2,nbt={HurtTime:10s}] minecraft:wither 10 10
configs are: Always active, repeat, uncondicional
This is the sword:
give @p netherite_sword[custom_name='{"bold":false,"color":"black","italic":true,"obfuscated":false,"strikethrough":false,"text":"Decadência","underlined":false}',lore=['{"color":"dark_purple","text":"Contém a praga"}'],custom_data={praga:1b},enchantments={levels:{"minecraft:knockback":2,"minecraft:looting":3,"minecraft:sharpness":8,"minecraft:sweeping_edge":3,"minecraft:mending":1,"minecraft:unbreaking":3},show_in_tooltip:false}] 1
If I test to detect it by the tag, it works just fine, but in the command block where gives the effect, it wont reconize the specific item, so works even if I'm using nothing.
Im also, trying to get particles effect when holding it, and obsviously the same thing happens, it works, but it works with whatever, not just the sword.
heres the input
/execute at @a[nbt={SelectedItem:{tag:{"minecraft:custom_tag":{praga:1b}}}}] run particle minecraft:enchant ~ ~1 ~ 0.5 0.5 0.5 0.1 1 normal @a
Your commands are close, but your NBT path is a little off. Try these commands:
/execute at @a[nbt={SelectedItem:{components:{"minecraft:custom_data":{praga:1b}}}}] run effect give @e[distance=..5,nbt={HurtTime:10s}] minecraft:wither 10 10
/execute at @a[nbt={SelectedItem:{components:{"minecraft:custom_data":{praga:1b}}}}] run particle minecraft:enchant ~ ~1 ~ 0.5 0.5 0.5 0.1 1 normal @a
Pleasee, help! Im trying to create a sword that when it hits an entity, it gives the wither effect.
The method I'm using is: having a scoreboard with the objective "hit", a sword with a custom tag, and then using the following input
execute at @a[nbt={SelectedItem:{tag:{"minecraft:custom_data":{praga:1b}}}},scores={hit=1..}] at @s run effect give @e[distance=..2,nbt={HurtTime:10s}] minecraft:wither 10 10
configs are: Always active, repeat, uncondicional
This is the sword:
give @p netherite_sword[custom_name='{"bold":false,"color":"black","italic":true,"obfuscated":false,"strikethrough":false,"text":"Decadência","underlined":false}',lore=['{"color":"dark_purple","text":"Contém a praga"}'],custom_data={praga:1b},enchantments={levels:{"minecraft:knockback":2,"minecraft:looting":3,"minecraft:sharpness":8,"minecraft:sweeping_edge":3,"minecraft:mending":1,"minecraft:unbreaking":3},show_in_tooltip:false}] 1
If I test to detect it by the tag, it works just fine, but in the command block where gives the effect, it wont reconize the specific item, so works even if I'm using nothing.
Im also, trying to get particles effect when holding it, and obsviously the same thing happens, it works, but it works with whatever, not just the sword.
heres the input
/execute at @a[nbt={SelectedItem:{tag:{"minecraft:custom_tag":{praga:1b}}}}] run particle minecraft:enchant ~ ~1 ~ 0.5 0.5 0.5 0.1 1 normal @a
i'm on 1.20.6 java
Hello,
Your commands are close, but your NBT path is a little off. Try these commands:
Hope this helps!
PS. In 1.21 enchantments are now data-driven, so you could make a custom enchantment that applies these effects without the need for commands at all. https://www.minecraft.net/en-us/article/minecraft-java-edition-1-21#:~:text=Enchantments%20are%20now%20set%20through%20data
-TechnoBro03
I'm still learning these things and you really saved me, thank you so much!!