Testing For Right Click In A Procedure

Started by gegb1912 on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Testing For Right Click In A Procedure

Hello!  I was wondering if it is possible to detect if a player had right-clicked inside of a procedure.  I have a custom item, the Zombie Sword, which whenever you right-click with it, I want it to heal you for a small amount (this is not what I need help with), but I want it to be on a cooldown, so you cant just have infinite health.  I don't really know how to do this though, because if I make the procedure run whenever a player right clicks, there will be no cooldown, but if I make the procedure run whenever the tool is in your hand, it will be always healing you, not just when you right-click.  I looked around briefly and didn't find anything, so I made this forum post.  Sorry if its painfully obvious or a duplicate.

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes it is, just check for…
Thu, 06/04/2020 - 18:10

Yes it is, just check for the keybind (this is an example, I am not spoon feeding😭);

Minecraft.getInstance().gameSettings.keyBindUseItem.isPressed()

For the other stuff, just do timers and such.

Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I was talking about…
Thu, 06/04/2020 - 19:04

I was talking about procedures... Like the block code things.  I wasn't aware that you could use actual code with MCreator.  Where would I put this?  I've been using block code up until now (it was painful).