Can you tell me how to make it so that when I hold down the Right mouse button, the procedure works 1 time?

Started by Loriuz on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you tell me how to make it so that when I hold down the Right mouse button, the procedure works 1 time?
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Basically, you need a switch…
Sat, 11/04/2023 - 15:39

Basically, you need a switch that you can turn on or off so the game can keep track of whether the player's already right clicked and is holding down the button, or if they're not currently holding down the button. 

To do this, you'll want to make a player-persistent logic variable. (You can find variables in the right hand side of the main workspace; a player persistent variable is a variable specific to each player that doesn't reset on death.) When the player right clicks with your item, run the procedure, and then set the variable to true. When they're no longer using the item, set the variable back to false. Then, only run the procedure if the variable equals false. This way, once the procedure has run once, the variable will change, and it will then have to reset before it can run again.

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry, I'm new to MCreator,…
Sat, 11/04/2023 - 16:17

Sorry, I'm new to MCreator, how do I determine that an item is not being used?