How do I Get the damage of the item in the player's main hand?

Started by platrbx on

Topic category: Help with modding (Java Edition)

Last seen on 09:13, 19. Jan 2024
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I Get the damage of the item in the player's main hand?

Hello! Im trying to get the damage of an item in your main hand (eg. diamond sword = 7.)

I've tried these solutions but neither of them work:

Get damage of | Item in main hand of | Event target entity | Result: 0 Damage

Get max possible damage of | Item in main hand of | Event target entity | Result Huge number

Im using 2023.1

Last seen on 00:22, 12. Mar 2024
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yea so I've been making a…
Tue, 09/26/2023 - 12:53

Yea so I've been making a dash mechanic to my mod that does however much attack damage the item in main hand of the entity (player) is (e.g. Diamond sword = 7), but that requires you to do the procedure condition "entity attacked", but I need player tick update so doesn't work for me. platrbx if you were wondering how this works, basically you make a new procedure, go to the conditions, and select Entity Attacked. then you go down to the "provided dependencies" on the bottom right corner, and the word "amount" should be in that list, double click that and it should show up in your code. 

If this helps your problem, great, if not just ask.