I'm currently looking for a way to give the attacked various effects during attacks (like a witherskeleton). With bows and crossbows you can give soaked arrows with user-defined effects (slowness, poisoning).
However, this is not the case with melee weapons (sword, ax), so I'm looking for a way now. I play on the Java Edition 1.16 and know my way around command blocks (relatively good) and functions (not so good yet).
Maybe you can help me.
Enchantment or Throwing Potions🤷♂️
It's actually relatively easy to implement. However, you have to use datapacks.
First, an advancement is used to test whether someone hits someone. When that happens, the advancement performs a function which can give the hitting player an effect directly via @s. The beaten entity can be recognized via the NBT tag HurtTime.
In my example Datapack, I even worked with different levels of enchantment.
https://drive.google.com/...sp=sharing
Advancement structure
In the second column you can specify detect_hit: detect with the path to your function. This is the same one you would use in the / function command.
In the 13th column you can define the NBT data of the weapon, which must be used so that the function is carried out. If you want to use the function for a certain item, such as all stone axes, you can write to me again and I can send you the appropriate file.
kurwo nie wiem