Creating a DataPack
A DataPack in Kore represents a Minecraft datapack that contains custom game data and resources.
To create a DataPack, use the dataPack
function:
This will generate the datapack with the given name in the out
folder by default. If generate()
is not called, the datapack will not be generated.
Check the Generation section for more information.
Changing Output Folder
To change the output folder, use the path
property:
Adding Icon
To add an icon to the datapack, use the iconPath
property:
Configuration
See Configuration
Pack Metadata
The dataPack
function generates a pack.mcmeta
file containing metadata about the datapack.
Configure this metadata using the pack
block:
format
- The datapack format version.description
- A text component for the datapack description.supportedFormats
- The supported format versions.
Filters
Filters are used to filter out certain files from the datapack. For now, you can only filter out block files.
For example, to filter out all .txt
files:
This will filter out all block files that start with stone
.
Content
The main content of the datapack is generated from the various builder functions like biome
, lootTable
, etc.
For example:
This demonstrates adding a custom recipe to the datapack.
Generation
To generate the datapack, call the generate()
function:
This will generate the datapack with the given name in the out
folder by default.
To change the output folder, use the path
property:
Zip Generation
To generate a zip file of the datapack, use the generateZip
function:
Jar Generation
To generate a JAR file for your datapack, use the generateJar
function. This function packages the datapack into a JAR file which can then be used directly with your Minecraft installation or distributed for others to use.
By calling generateJar()
, the generated JAR file will be placed in the default output folder. If you wish to specify a different location, use the path
property:
You can also configure the JAR generation for different mod loaders such as Fabric, Forge, Quilt, and NeoForge.
This will add metadata to the JAR file that is specific to the mod loader.
You will be able to include your datapack as a mod for your mod loader and simplify the installation process for users.
Below are examples of how to set up these mod loaders:
Fabric
To configure Fabric mod loader, use the fabric
block inside the generateJar
function:
This sets the Fabric version, and includes contact information and the author's name.
Forge
To configure Forge mod loader, use the forge
block:
This sets the mod authors, credits, and dependencies for Forge.
Quilt
To configure Quilt mod loader, use the quilt
block:
This sets the metadata such as contact information and contributors for Quilt.
NeoForge
To configure NeoForge mod loader, use the neoForge
block:
This sets the authors, credits, and dependencies for NeoForge.
Merging with existing datapacks
To merge the generated datapack with an existing datapack, use the DSL with the function mergeWithDatapacks
:
If a zip is provided, it will be considered as a datapack and merged with the generated datapack.
It will unzip the zip in a temporary folder of your system and merge it with the generated datapack, this will not remove the temporary folder.
Checking for compatibility
When merging with other datapacks, Kore will check if the pack format is the same. If it is not, it will print a warning message.
Example:
This will print out the following message:
It also checks for supportedFormats
and warns if the other pack is not supported.
Tags
When merging with other datapacks, Kore will merge the tags minecraft/tags/function/load.json
and minecraft/tags/functions/tick.json
.
Example:
The resulting load.json
file will contain: