Help with loading far away random chunks using commands
I'm making a working Tardis in Minecraft using datapack dimensions. Part of that is the ability to send the Tardis exterior anywhere in the world (And eventually in the Nether and End too). The
/spreadplayerscommand works great for moving the armour stand that summons the exterior, but only in the spawn chunks. I've found that when I send the stand more than 500 blocks away from spawn it goes into unloaded chunks, where Minecraft commands can't track it. I had also found the
/forceloadcommand, which would be a way to get the exterior to work, however to get the exact chunk loaded, I assume I need
/execute at @e[tag=dw.TARDIS.location run forceload ~ ~The problem seems to be a catch 22. If I send the armour stand far away (Which I want to do, because the whole point of a Tardis is to explore distant places, not to move around within eyesight) then I need to force load the chunk before the stand can arrive. To force load the chunk I need the armour stand to already be there.
I just added new way to work out the new location, where 2 armour stands are moved around 0,0, their x and z cords are saved to a scoreboard, then individually multiplied and divided through 3 prime numbers, both x values are then added together, multiplied and divided again and then I do the same with the z values. The end result is fairly large positive and negative random numbers.
Is it possible to use these numbers with a
/forceloadcommand to load the chunk before moving the armour stand, is there another way of doing it without the command, or even some way to get Minecraft to keep track of a specific armour stand outside of loaded chunks? Any help would be appreciated.
You can keep track of a single entity even if they are unloaded by using
execute as run function.
Even if the entity goes to unloaded chunks, you can target it by using
@swhile inside the function. This makes it so you can teleport it and run forceload or whatever else you need at the entity.
Here is https://gaming.stackexchange.com/questions/392044/teleport-to-scaled-coordinates/392048#392048 that uses that artifact.