Hi, so I was looking for a way to /tp my unloaded horse back home without going there myself, (and not type the coords by hand) but couldn't find anyone doing this,
so I made a datapack witch loads chunks around a certain set of XZcoordinates, and thought maybe I should share this with you guys.
This datapack is designed for temporary loading. I mean this does work forever, but to keep a certain chunk loaded, /forceload should do.)
How to use:
1, install datapack
2, run /function chunk_loader:init
3, add a line of "function chunk_loader:main" in your main loop function, or just put it in a looping command block.
4, run /scoreboard players set ChunkLoader_100*Coordinate ChunkLoad_X 12345
5, run /scoreboard players set ChunkLoader_100*Coordinate ChunkLoad_Z -98765
6, and the chunks around X)123.4, Z)987.6 will be loaded until the above scores are changed.(the 2nd decimal isn't used)
7, now you can /tp your beloved horse, left at 123.4,70,987.6, back home.
please keep in mind:
- can only load 1 target area at once.
- use absolute values for target X,Zcoords.
- this thing works only for coords +-999,999,999.
- you can't auto-fill "ChunkLoader_100*Coordinate" as this is a name for an unexisting player. (I named it like this so I can always remember to 100* the coords. God bless.)
- takes at least 17 ticks(or the time it took for the "main" function to run 17 times) to load target area.
- when trying to load an area, also loads some other chunks on the way, up to16 other coords, for a few seconds.
- adds 18 annoying function commands to your game.
- adds 5 annoying scoreboard objectives to your game.
what it actually does:
runs /spreadplayers with invisible armorstand for each digit until it reaches destination.
you might want to:
- write a function to toggle this thing on and off. (ex. instead of just putting "function chunk_loader:main" in your loop, add "execute if XX run")
- rewrite some lines to change the-extremely-long-player-name. (it is mentioned only in "main" and "looper_1")
- or write a function to always /scoreboard players operation ChunkLoader_100*Coordinate (XorZ) = (WhateverObjectives)
- delete some of the lines, as this datapack includes a few lines just there to sit. (put there for the sake of safety, and to run tests without crashing my game).
Any feedbacks and bug reports are very welcome, as I am using this myself on my realms server. Thank you.