Compatibility
Minecraft: Java Edition
Platforms
Supported environments
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Creators
Details
Version Detector is an API for datapacks to detect what version they're running.
It doesn't do much on its own, but can be useful for other datapacks.
This pack uses the fact that Minecraft completely removes functions with invalid syntax when loading a datapack, for example "execute if entity @e[type=pillager]" is invalid syntax in 1.13, because Pillagers don't exist yet, causing the whole function to get removed in 1.13, but the function will load successfully and will exist in 1.14 and later because there is no more invalid syntax because Pillagers were added, and the command was written correctly. Each function sets a number in a scoreboard objective to a number and runs the next function, which has a different syntax to the previous one, for example "execute if entity @e[type=bee]" instead of "execute if entity @e[type=pillager]" when moving from the 1.14 function to the 1.15 function, checking for a different feature. If at any point the chain stops, the number stops changing, which matches your version of Minecraft.
The ID is stored in a score for "MinecraftVersion" in the "VersionInfo" objective. It goes from 0 (1.13) up to whatever the latest detectable version is, which is 16 (25w04a) right now.
List of versions detected, in order from oldest to newest, starting at ID 0 (1.13) and going up:
- 1.13.x
- 1.14.x
- 1.15.x
- 1.16.x
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20 - 1.20.1
- 1.20.2
- 1.20.3 - 1.20.4
- 1.20.5
- 1.21 - 1.21.1
- 1.21.2 - 1.21.3
- 1.21.4
- Snapshot 25w02a
- Snapshot 25w03a
- Snapshot 25w04a and newer