Testing For Right Click In A Procedure

Started by gegb1912 on Thu, 06/04/2020 - 17:35

Topic category: Help with modding (Java Edition)

Last seen on 23:32, 2. Oct 2020
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Testing For Right Click In A Procedure
Thu, 06/04/2020 - 17:35

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.

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

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

Last seen on 23:32, 2. Oct 2020
Joined May 2019
Points:

User statistics:

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