Pack validation
A typo in a function id doesn't stop a datapack from loading: the game skips the command and the feature silently does nothing. Kore catches it when the pack is written:
Validation is on by default and runs after the optimization passes, in every output path. An error throws a PackValidationException listing every problem, the rest is logged. pack.validate() returns the Diagnostic list instead, without logging or throwing.
Check someone else's pack
The same rules run on a pack that wasn't built with Kore, a folder or a .zip:
It also takes a Path or, for the browser, a Map<String, String> of path to content, and a settings lambda.
The rules
Every rule has three modes, ERROR, WARNING or OFF, and starts in its Default one. A rule at OFF doesn't run, see the opt-in rules.
| Id | Default | Catches |
|---|---|---|
command-syntax |
error | A command the game can't parse, or a last line ending with \ |
invalid-json |
error | A JSON file the game skips, trailing comma included (external packs only) |
invalid-path |
error | A namespace or path with a character outside a-z 0-9 _ . - (and / in a path) |
macro |
error | A $ line without $(variable), or a macro function called without one of its variables |
pack-mcmeta |
error | A pack.mcmeta the game can't read |
undeclared-symbol |
warning | A scoreboard objective, team or bossbar that is used and never created |
undefined-reference |
error | A function, tag, advancement, predicate, loot table, item modifier or recipe the pack never defines |
unknown-command |
off | A command word the game doesn't have, at the start of a line or after run |
unknown-vanilla-id |
off | A minecraft: block, item, entity type, mob effect or tag of them the game doesn't have |
undefined-reference only checks the namespaces the pack owns (it defines a function or a non-tag resource there), so another pack, a library tag or minecraft is never reported.
Macro line without a variable
Add the variable ("\$say hi \$(name)") or drop the $. The opposite mistake, say $(name), is a warning.
Bad command syntax
The command is read against the command tree of Minecraft 26.3. An unknown command word is left to unknown-command, since mods add commands, but a leading / is always reported.
Objective never created
It stays silent for a kind the pack never creates at all, and for macro names.
pack.mcmeta
Declare "min_format": 121, "max_format": 121. A Kore pack writes this file for you.
Opt-in rules
An off rule runs once it has a mode:
Fix the word, or keep unknown-command off on a modded server (# kore:ignore unknown-command silences one line). unknown-vanilla-id reads an id only where the registry is certain: setblock, give, summon, selector types, tags, loot tables and recipes.
Settings
- Only an
ERRORfails the build. - A mode replaces only the diagnostics at the default severity of their check:
this[CommandSyntaxCheck] = Severity.WARNINGkeeps itsINFOabout a pack of another version anINFO. For an off rule that is every diagnostic. externalNamespacesis for a library you override, else its namespace looks owned.knownPacksalso counts their objectives, teams and bossbars as declared, like the packs ofmergeWithPacks, whose own files aren't checked. A pack imported with bindings is one.- A check that throws becomes one warning (
check crashed: ...) and the build goes on.
Silencing a problem
suppress(...) works whatever the file starts with. A JSON file takes suppress(...) only, since it can't hold a comment. On an external pack, # kore:ignore and # kore:ignore-file work in .mcfunction files the same way.
Write your own check
The PackIndex gives the functions (their lines are those of the written file), the JSON resources, isDefined(kind, id) and isMissing(ResourceKinds.PREDICATE, "my_pack:is_night"), true only for an id of an owned namespace that the pack never defines. # kore:ignore no-todo-lines works on it too.
Limits
- Registries are read only by
unknown-vanilla-id, so@e[typ=pig]passes. - Permission levels aren't read.
op Stevepasses. - Text components are read only for the
run_commandof click events and dialog actions. - Overlays of an external pack are checked only when they apply to Minecraft 26.3.
- A pack for other versions (no 121 in its
pack.mcmetaformats) gets no command syntax check, only anINFO.
What to read next
- Configuration - every option of the
configuration { }block - Optimization - the passes that run just before validation
- Macros -
$(variable)lines
