Why does this completely ignore the wait 100 ticks

Started by Superkota on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why does this completely ignore the wait 100 ticks

Event trigger - triggered by external call
or when (global trigger): No additional trigger

if: Item in main hand of Event/target entity = (item)

do: Play sound (sound) at x y z
      Wait 100 ticks then on server side
      do: Call procedure (this procedure)

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your message doesn't exactly…
Tue, 05/13/2025 - 14:36

Your message doesn't exactly make it clear what specifically is happening, and what you want to happen, and what triggers the procedure.

However, I know that there is a very common misconception about what the wait procedure block does.

A lot of people think it completely pauses the procedure and stops it from being called again.

What it actually does is that it simply makes a delay on what is inside of it, but if the procedure is called every tick, it will still run every tick, but it will start and end 100 ticks after it should.

To summarize, the wait block is not a timer, it is simply a delay in the current instance of the procedure, but further instances of the procedure can still be started before the delay ends. If you want a procedure to only run once every 100 ticks, look into a potion effect-based timer, a variable-based timer, or an nbt-based timer instead.

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sorry for the confusion, i…
Tue, 05/13/2025 - 15:01

sorry for the confusion, i want the sound to play once every 5 seconds while im holding the item, and the trigger is "item in hand tick"

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would recommend replacing…
Tue, 05/13/2025 - 15:42

I would recommend replacing the wait block with an nbt timer.

Basically an if condition that checks if an nbt tag on the player (you could call it timer) is greater than or equal to 100, if it is, play the sound and reset the nbt tag to 0. If it is not, set the nbt tag to itself plus 1.

That should work a lot more effectively than the current procedure.

Also, you won't need to call the procedure again at the end.