Started by
akisephila
on
Topic category: Help with Minecraft modding (Java Edition)
I have a block which spawns mobs around it each time it randomly ticks. But it's also supposed to only do this three times, via using several blocks and replacing itself with the next stage after spawning entities three times, using a local variable that goes up every time it activates. If block at xyz = Spawner1, replace block at xyz with Spawner2, If block at xyz = Spawner2, replace block at xyz with Spawner3
However, this does not work. I have no idea why.
Here's a screenshot of the full procedure each of the spawner blocks uses (Except for the last stage, because that is when the spawner is set to deactivate)
Edited by akisephila on Wed, 07/07/2021 - 02:05
Think I know the problem.
The variable resets everything the procedure is ran because the local variable doesn't exist until the procedure is ran and after the procedure has run its course, it drops the variable. This is why Global variables exist separate from Local.
Save the variable as an NBT tag on the block then make the block keep NBT tags when its replaced so you can keep calling from it.
Ah, ok. Thanks so much!