Minecraft datapack bootstrap, based on MSpaceDev (https://mspacedev.github.io/) works for HermitCraft / Xisumavoid's Vanilla Tweeks
This datapack provides some tags for executing functions:
- #main:init which is triggered on reload
- #main:tick which is executed each tick
- #main:second which is executed every second (20 ticks)
- #main:hook-newplayer which is executed for every new player on a server
There is 4 tags for detecting players who sneak:
- #main:hook-sneak-begin is triggered when a player start to sneak
- #main:hook-sneak-tick is triggered each tick when a player is sneaking
- #main:hook-sneak-second is triggered each tick when a player is sneaking
- #main:hook-sneak-end is triggered when a player has stopped sneaking
There is 4 tags for detecting players who are in water:
- #main:hook-swim-begin is triggered when a player is in the water
- #main:hook-swim-tick is triggered each tick when a player is in the water
- #main:hook-swim-second is triggered each second when a player is in the water
- #main:hook-swim-end is triggered when a player wasn't in the water anymore
There is 2 tags for detecting players deaths
- #main:hook-death is triggered when a player died
- #main:hook-respawn is triggered when a player respawn
- In your datapack, create a folder named "main" and a subfolder named "tags"
- create a json file named after the tag you want to use, eg. "hook-swim-tick"
- In this case, the folder structure will be datapacks/ < your datapack > /data/main/tags/hook-swim-tick.json
- Put the following code to call your function:
{
"values": [
"<your namespace>:<your function>"
]
}
This datapack use a scoreboard named mcr_versions to store the versions of all my datapacks. For eg. this datapack is refered as #mcr_bootstrap
If you want to use tags from a specific version, you can check the installed bootstrap version :
execute if score #mcr_bootstrap mcr_versions matches 2.. run function <your namespace>:<you function>
You can also use a tag hook named init.X where X is the minimum version of the bootstrap you need, and it will be triggered only if you have the correct version of the datapack