In the datapack generator, you can add normal minecraft commands as usual, but there are some additional features added to this generator, that can make things much easier.
Note: this datapack generator is still in beta, and there are plans to add more features to the generator in the future.
#:load & #:tick
You can easily add a file to minecraft’s load and tick functions, simply by adding #:load or #:tick to the top of the file. This method also has an alias: #:init for #:load, and #:run for #:tick.
Running a function from another file, in a minecraft datapack, has never been easier. Simply add /filePath at the start of any line.
That seems easy, but you can also do more with this. You can also backtrack files. ../parentFolder/anotherFolder/filePath.
This method is not limited to just the beginning of the line. You can also use these relative paths in minecraft execute commands. execute if something run /filepath. Notice, I did not have to add the word function. While adding function is optional, it is assumed that is what you are doing with these relative paths, so it is added automatically.
basically, /filepath, after the datapack is compiled and generated, is turned into function datapackName:main/path/to/file.
0init & 0run
When the code editor first loads up, you may have noticed these 2 files: 0init and 0run. These are the default load and tick files, that minecraft will run first. You can use these files, to load other function files in a specific order. while #:init and #:run are useful for adding the files quickly when order doesn’t matter, using 0init or 0run is useful if you need things to load in a specific order.
You may also notice some other files added to the datapack.
Remember, this is still in it’s beta version. Remember, I have ideas for more features. Those files are for a future idea, to store data to a player, without creating more scoreboard objectives. Because I can simplify things with this datapack generator, in the future you may see player attached variables, that do not create new minecraft scoreboard objectives. Reducing scoreboard objectives, can reduce how many objectives, your datapack users will have to see on there minecraft world. This system, also creates a new armorstand to represent each player, and makes sure the chunk with the armorstands is forceloaded. Using armor stands may also add offline support for modifying player data.