Local Variable Bug

Works as designed
Issue description

I tried to create a growing Crystal...

The Crystal should grow after a set amount of ticks (time)

Here is the procedure I created for it:


Note: The diamond block is just for debugging purposes, the "send to chat to all players" is also for debugging purposes. 


I activated the procedure via "update tick" in my Crystal Block:

Update Tick

Note: The procedure is called CrystalT1Tick.


But it doesn't work while testing... as you can see:

Not working

The Variable doesn't add up... 

I think the local Variable doesn't save itself after the procedure worked its code all the way trough.

What do you think? Is this a Bug or is it my fault?

Issue comments

Does the Crystal grow?

Try to put an higher number than 10 to the "if" condition because 10 ticks is half a second (1 second =20 ticks)

(I don't know if this is the solution)

Local variables are local per event execution. Each tick update is a new execution. You need to use a global variable to achieve the desired effect. Unfortunately, global variables are global for the whole world.

The concept of global variables tied to a location which I think you would like is planned for MCreator 2.x.x.

Thank you for the quick response... I now understand how the local variables are working in this MCreator Version...

Is there a way to create a delay in another way? Perhaps a line of Code I could use for the desired effect? 

In the older Versions of MCreator I worked with really really low possibilities (like 0.05%) per "Update Tick" to get an delayed effect. But this method is obviously not good for processing machines like self made furnaces, because it is still random...


Minecraft is single threaded so actual delays are unfortunately not possible.

You can still use random in this version. You can find random generator under the math section.