In a procedure, how do I check if an item is in the main hand?

Started by The_CAT_9801 on

Topic category: Help with modding (Java Edition)

Last seen on 21:23, 22. Mar 2024
Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In a procedure, how do I check if an item is in the main hand?

I am making a mod with a spear in it that you can dash into enemies with when pressing C, but I can't figure out how to make it so that it only works when I have the spear in my MAIN HAND.

This is how I want the keybind to work:

  1. Key is pressed
  2. Player dashes forward
  3. Enemy player dashed at takes damage
  4. Player stops dashing

If anybody could help that would be great!

Thanks!

Last seen on 23:48, 26. Apr 2024
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There are 2 blocks that…
Mon, 03/18/2024 - 16:35

There are 2 blocks that refer to the Main-Hand specifically (there also exists the same blocks for the off-hand if wanted)