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

Started by DashSuperCraft on Tue, 06/22/2021 - 15:33

Topic category: Help with MCreator software

Last seen on 18:25, 3. Jul 2021
Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I make my ''ranged item' lose 1 durability when I hit (left-click) someone with it?
Tue, 06/22/2021 - 15:33

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!

Last seen on 16:56, 28. Jul 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 16:56, 28. Jul 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 18:25, 3. Jul 2021
Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.