The dimension loading commands can be targeted to only run when a specific dimension load, by specifying the command like this:
worldprimer-dim-command <dim id> <the actual command>.
So for example:
worldprimer-dim-command 1 say The End dimension has loaded!
If you just give a command without the prefix, then it will be run every time ANY dimension loads, for example:
say Some dimension has loaded!
As of version 0.3.0, there is now also another dimension loading command variant, which can run the command on a specific number of dimension loads, or on any multiple of the given value.
Note: This variant requires the option enableDimensionLoadTracking to be enabled!
The syntax for these is:
worldprimer-dim-command-nth <dim id> <load count> <the actual command>
So to only run a command when the Nether loads for the very first time, you could use:
worldprimer-dim-command-nth -1 1 say The Nether has loaded for the first time!
Or when the End loads for the 6th time:
worldprimer-dim-command-nth 1 6 say The End has loaded for the sixth time!
To run a command on any multiple of the given value, prefix the value with a ‘%’:
worldprimer-dim-command-nth 1 %5 say The End has loaded a multiple of 5 times!
There is also support for substituting the dimension id, or the current world spawn coordinates into the commands.
The substitution strings are: {DIMENSION}, {SPAWNX}, {SPAWNY} and {SPAWNZ}. They also support simple addition and subtraction of constant numeric values.
So for example, you can now do this in postWorldCreationCommands, to make the player spawn in a 5x5x3 room underground:
gameRule spawnRadius 0 (this sets the spawn fuzz to 0, so the player fill spawn exactly in the center of that small room, and not randomly somewhere around that spot, on the surface)
setworldspawn {SPAWNX} 7 {SPAWNZ} (moves the world spawnpoint down to y = 7)
fill {SPAWNX}-2 7 {SPAWNZ}-2 {SPAWNX}+2 9 {SPAWNZ}+2 minecraft:air (makes a 5x5x3 room of air inside the ground, or whatever happens to be at that spot)