Damage an Ranged item when its used like a melee weapon

Started by JPZamps on

Topic category: Help with modding (Java Edition)

Last seen on 18:50, 24. Jul 2024
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Damage an Ranged item when its used like a melee weapon

I'm trying to make a ranged item, like a spear that can be thrown or used for melee combat, i want to take damage(durability) when they're used in melee mode, i can see to find a way to make this so now is kind of indestructible item

Any ways to make that work? 

 

Last seen on 18:06, 24. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There should just be an…
Mon, 10/09/2023 - 19:01

There should just be an option when making a ranged item to add melee damage. If there isn't, you could also make a procedure with the 'when attacked' global trigger that checks if the item in the main hand of the source entity, (the one attacking), is your custom item, and, if it is, deals damage to the item in the source entity's main hand.