How to set a variable constantly

Started by MultipleGaming on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to set a variable constantly

How do I constantly start setting a variable forever while the player is in the world? I'd think you'd use a while true block but when I tried to do that once my game instantly crashed upon loading into the world. The thing I want to do is to make a variable to shorten the Look X position [player] with raytrace distance... block because it's laggy to scroll to the bottom of the entity data tab and get the block from there.

 

(Just want something to make it easier to make stuff)

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your game crashed when you…
Sun, 04/06/2025 - 20:59

Your game crashed when you used a while loop because the game needs to finish a while loop before it can do anything else.

The easiest solution is probably to execute the procedure every tick? That is, set the global trigger to "On player tick update." I think that should do what you want it to.