3

Curious about load priority

B1BU 4/27/21 6:42 am
4.3k
4/30/2021 3:40 am
I started using a shared "main" folder on my datapacks. All of them have the same folder, so the game only loads it once.

The problem is: if I ever update it, which datapack will the game load first? Ideally it'd load the most recent one. But if for example, it loaded them in alphabetical order, an older version would be loaded first and the more recent one would be ignored

How could I deal with this issue?

One idea I had was to have a different datapack for the main folder, like a library needed for the datapacks to run, but I don't think people would like to go through all of this trouble for a datapack
Posted by
B1BU
Level 51 : Grandmaster Sweetheart Nerd
65

  Have something to say?

JoinSign in

2

SUPERIONtheKnight
04/30/2021 2:59 am
Level 30 : Artisan System
history
Great question! The answer is that they run in whatever order you like! The typical use case for the /datapack command is the following: /datapack enable <name>
However you can add additional arguments to the end of the command to set the datapacks priorities! So for example, maybe I want the datapack "food" to run before the datapack "vanilla". To do so, I just type the following:
/datapack enable food before vanilla
A more generic look at the command where <existing> is a datapack that's already loaded:
/datapack enable <name> (before|after) <existing>
Or, we can do something else which seems to be what you are asking for! We can do the following as well:
/datapack enable <name> (first|last)
It should be noted that this can also be changed by whoever is using the datapack at will. Furthermore I'm not sure if other datapacks can change this or not(They probably can). This is why I recommend being careful if you plan to use this functionality as the load order could change depending on what I just mentioned.

Also from what I have tested, the game seems to prefer whichever datapack is lowest in the list. So if I had two datapacks that use the same namespace "apples", the datapack that loads "after" or "last" will run while the other does not.

You can read more about the /datapack command here which is where I got this info: https://minecraft.fandom.com/wiki/Commands/datapack

Hope this helps! :)
3
B1BU
04/30/2021 3:40 am
He/They • Level 51 : Grandmaster Sweetheart Nerd
I had given up on the idea i had and decided on another solution but your explanation actually helps me with this new solution. That's really cool
2

Welcome