How do I make my ''ranged item' lose 1 durability when I hit (left-click) someone with it?

Started by DashSuperCraft on

Topic category: Help with MCreator software

Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make my ''ranged item' lose 1 durability when I hit (left-click) someone with it?

Hello! I know the title sounds weird, but hear me out!

Today, I made a new sword, which is a little special.

-On right-click, it shoots a fireball that creates a small explosion and damages any mob/player, at the cost of 10 durability (that's why it's a ranged item; ammunition is the fireball) 

- The sword is also intended for closed-ranged combat, but the problem is when I hit (left-click) another entity (mob or player), the sword doesn't lose durability, and I'm wondering how I could make it lose 1 durability on hit. 

 

Help would be appreciated, thanks!

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try this (keep in mind Event…
Tue, 06/22/2021 - 16:14

Try this (keep in mind Event/target entity was swapped with Sourceentity, you can find it in Minecraft components)
procedure

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oof, can't edit the post. I…
Tue, 06/22/2021 - 16:16

Oof, can't edit the post. I think off-hand check is bad because if you have two of these swords it will damage both. But I don't have any quick idea atm to check which hand attacked

Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for replying!…
Tue, 06/22/2021 - 16:27

Thanks for replying! Unfortunately, I tried that procedure, but it didn't work. Durability stays the same on the sword.