World tick update speed issue

Started by Orandza on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
World tick update speed issue

So as far as I know, each second in game should be equal to 20 ticks. When using on world update tick trigger for procedures, however, it feels as if ticks happen significantly more often than one would expect. I tested the exact amount and it appears that world tick update is almost 8 times faster than other kinds of tick updates. What's even weirder, however, is that I am pretty sure that this wasn't the case when I tested this in the past. I remember testing world tick update and it only seemed about 4 times faster comapred to other tick updates, yet now it's almost 8 times fastr. Why does this happen? I even designed one of my mod's counters around this and I noticed it started counting down way too quickly recently, and I hvae no idea why this is happening. Does a PC's performance affect the world tick update speed?(although I've been on the same PC with the exact same performance the entire time, don't see why this should happen) Was there a Minecraft or Mcreator update that changed the world update tick speed? And is there any workaround for this? I need my counters to be at least almost completely accurate and I don't want them to randomly get messed up, so I wish to know what's going on exactly. 

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, I've just discovered…
Tue, 05/28/2024 - 09:52

Yeah, I've just discovered how to use counters like that, and I've noticed the same thing.. With mine, it's somewhere in between 4x and 8x slower.. 

Let me know if you find any help on this.

Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(for anyone who finds this…
Fri, 10/18/2024 - 03:37

(for anyone who finds this post in search of answers)


What I've found is the On world tick update global trigger, in singleplayer at least (haven't tested multiplayer) is called every frame, which is why if it's running at 8 times faster, you're probably running at ~160fps, and so is the procedure. Which, would be fine if the value wasn't so variable, and inconsistent between computers.

I recently discovered a neat little workaround. Make a Global logic Variable (i recommend the name 'worldTickAllowed') with scope GLOBAL_WORLD. Then, make another procedure and use the On player tick update global trigger. In it, make sure to set the global logic variable to true. In your On world tick update global trigger procedure, make an if block with the conditions that that global variable is true, and in the if block make sure to set the global variable to false. Then, put everything you want to run at 20fps, in the if block.

Images

 

This works because the On world tick update procedure can only work if the global variable is true, but it also turns it off when it runs, so theoretically it should only work once before it cuts itself off. However, it is turned on by the On player tick update procedure, of which runs at 20fps, therefore limiting the On world tick update procedure to 20fps.

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's genius! Thanks.
Thu, 10/24/2024 - 00:04

That's genius! Thanks.