Bindings (Import Existing Datapacks)
The bindings module isexperimental. APIs and generated output may change without notice.
The bindings module lets you import existing datapacks and generates Kotlin types so you can reference functions, resources, and tags safely in your code.
Add the module
If you are working in a multi-module setup:
Quick start
Using generated bindings
When you import a datapack, Kore generates a data object with a name derived from the datapack's name (e.g., VanillaRefresh).
Accessing resources
Resources are organized by namespace and type. If a datapack has only one namespace, resources are accessible directly:
If the datapack uses multiple namespaces, they are nested:
Tags
Tags are also imported and can be used wherever a tag of that type is expected:
Pack metadata
The generated object also contains information about the original datapack:
Generated structure
For each imported datapack, a Kotlin file is generated containing:
- A
data objectnamed after the datapack. - Nested
data objects for each namespace (if multiple). - Nested
enums orobjects for each resource type:Functions: All.mcfunctionfiles.Advancements: All advancements.LootTables: All loot tables.Recipes: All recipes.Tags: All tags, further nested by type (Blocks,Items,Functions, etc.).Worldgen: All worldgen resources, further nested by type (Biomes,Structures, etc.).
Subfolders in the datapack are preserved as nested objects.
Explore without generating
You can explore the content of a datapack programmatically without generating any code.
Download sources
GitHub
Downloads a repository or a specific asset from a release.
Patterns:
user.repo: Latest commit on the default branch.user.repo:tag: Specific tag, branch, or commit.user.repo:tag:asset.zip: Specific asset from a release.
Modrinth
Downloads the latest or a specific version of a Modrinth project.
Patterns:
slug: Latest stable version.slug:version: Specific version ID or number.
CurseForge
Downloads from CurseForge. Requires the CURSEFORGE_API_KEY environment variable.
Patterns:
projectId: Latest file for the project.projectId:fileId: Specific file.slug: Project slug.slug:fileId: Specific file for a project slug.URL: Full CurseForge project URL.
URL / local path
Patterns:
https://example.com/pack.zip./path/to/pack(Local folder)./path/to/pack.zip(Local zip)
Configuration
Global configuration
Defined in the configuration {} block:
| Property | Default | Description |
|---|---|---|
outputPath |
build/generated/kore/imported |
Directory where Kotlin files will be generated. |
packagePrefix |
kore.dependencies |
Base package for all generated bindings. |
generateSingleFile |
true |
If true, generates one Kotlin file per datapack. |
skipCache |
false |
If true, re-downloads even if already in cache. |
debug |
false |
Prints extra information during the process. |
Per-datapack configuration
Defined in the block following a source:
Cache
Downloaded files are cached in ~/.kore/cache/datapacks to speed up subsequent runs. Use skipCache = true in the global configuration or delete the cache folder to force a re-download.
Troubleshooting
- Rate Limits: GitHub API is limited for unauthenticated calls.
- CurseForge API: Ensure your API key is valid and has permissions for the project.
- Invalid resources: If a resource type is unknown to Kore, it will be skipped to avoid generating invalid code.
