Build output and IR
Inspect the datapack
mcfpp build writes files to targetPath. This example uses name = "hello" and targetPath = "build":
build/
├── hello/
│ ├── pack.mcmeta
│ └── data/
│ ├── hello/function/
│ └── minecraft/tags/function/
├── bin.mclib
└── module.jsonhello/ is the datapack loaded by Minecraft. bin.mclib and module.json support library export. They remain outside the datapack directory. The target version selects the pack format and generated commands.
The compiler starts with project functions, load and tick tags, and explicit resources. It retains library functions and resources used by those references. Dynamic function targets retain the families they can select.
Resources from dataPath remain part of the user's declared output. The link report explains where files came from and why they remain.
Export readable compiler records
IR means intermediate representation. These text records connect source code, generated commands, and final output.
Select MCFPP → Dump IR in IDEA, or run:
mcfpp build --dump-irThe command creates three files:
| File | Content |
|---|---|
build/ir/01-compiled.ir | Typed basic blocks, instructions, source locations, and commands for compiled functions |
build/ir/02-optimized.ir | Results after entry functions and runtime initialization are arranged |
build/ir/03-linked.ir | Retained resources, omitted resources, and reference sources |
A basic block is a sequence of instructions. Some functions generate Minecraft commands directly. Their records identify that path and contain the actual commands.
Select an IR path in the console to open it. You can also choose another directory:
mcfpp build --dump-ir=inspectionRelative directories start at the build output root. This example writes to build/inspection/.
Follow a small example
func add(a: int, b: int): int {
return a + b
}
func main() {
external count: int = 2
print(add(count, 3))
}- Run Dump IR.
- Find
addandmainin01-compiled.ir. - Compare entry functions and initialization in
02-optimized.ir. - Check library retention reasons in
03-linked.ir. - Open
main.mcfunctionin the datapack to inspect the final commands.
The compiler selects internal function names. Use source locations and call relationships to follow the result.