Creating Creator Templates
The project creator is based on templates containing Apache Velocity files and properties put together in a JSON descriptor file.
The built-in templates are hosted on this GitHub repository. Feel free to use them as reference for your making your own.
This documentation will explain the essentials about how to make a project template.
Template Repositories
A template repository contains one or more descriptors and Velocity templates. You can configure repositories in the
plugin settings. By default, only the Built In repository is there, you can add as many as you want.

A repository provider is what reads the descriptor and the Velocity templates that the creator will use. Currently, four providers available:
builtinwhich is specifically made for the default templatesremotedownloads a zip from a URL and then reads its contents like thearchiveprovider doeslocalreads templates from a flat directoryarchivereads templates contained in a ZIP archive
Each provider has a configuration, like the URL of the remote ZIP file, or the flat directory to use as a root.
The remote provider has a version placeholder $version which will be replaced with the latest descriptor
format version supported by the plugin. The goal is to allow users to host templates for multiple
versions without requiring them to update the URL manually whenever the descriptor format version gets bumped, while
allowing users on older versions of the plugin to still be able to access older templates.
The plugin supports all format versions up to its latest one, so templates written for an older format version keep
working without changes. You only need to publish your templates under a new version (for example in a new v4 branch)
when you want to use features added in that version, or if you want your $version URL to keep resolving for users of
newer plugin versions. If a template uses a format version the plugin does not support, the creator shows an
“Invalid template version” error listing the supported versions instead of the template.

This is what the Built-In template repo would look like using the remote provider. You can do something similar if
you host your templates in a GitHub repository. Note that we prepend the branch name with a v.
Template Descriptors
The template descriptor is a JSON file of a specific format version containing the properties exposed to the Velocity
templates and to the user in the creator UI. The descriptor file name must end with .mcdev.template.json, and in fact
can be named just that.
For a complete reference see the descriptor class sources.
Format Versions
The descriptor’s version is the format version the template is written for. The latest format version is 4, and
the plugin supports versions 1 to 4. Use the lowest version that has all the features your template needs, so it
works with as many plugin versions as possible.
| Version | Added |
|---|---|
1 |
The initial format |
2 |
The gradle_plugin and paper_versions property types, forceValue, visibility for property groups, the extractPaperApiVersion derivation, and the add_gradle_run and add_maven_run finalizers |
3 |
The fetchPaperDependencyVersionForMcVersion derivation for string properties, producing the Paper API dependency version for Minecraft 26.1+ |
4 |
The fabric_game_version property type, and the run_npm_package, generate_files and replace_in_file finalizers |
Template Label and Group
The template label can be provided in multiple ways, evaluated in this order:
- the
labelproperty in the descriptor is used, if it exists - the name of the file, without its
.mcdev.template.jsonending, if not blank - the name of the directory containing the template
The group is an optional string value set in the descriptor’s group property.
The label and group will be used as a translation key if localization files are present.
Template Properties
Properties are objects defined in the properties array. They are accessible to all Velocity templates and some strings
in the same descriptor.
The main values of a property object are:
- a
namethat will be the variable name you will use in the Velocity templates - a
typedefined in the plugin.xml (look forcreatorPropertyType) - an optional
labelstring, if absent it will be thenameof the property, useful when you are using localization files - an optional
orderinteger, defining where to place the property’s UI in the creator, overriding the definition order - an optional
defaultvalue, its actual value depends completely on the property type - an optional
visibleboolean, defaulting totrue - an optional
forceValueobject, used to specify when a property’s value should be force-set and non-editable by a user. Currently only supported bybooleanandgradle_pluginproperty types - an optional
editableboolean, defaulting totrue - an optional
rememberboolean, defaulting totrue - an optional
optionsobject or array of arbitrary values the property type willdeserialize
Property types have an associated Java type that will be the type of the Velocity template variable, and will provide their own UI in the creator. Most of the custom types are located in the model package.
They may perform specific validation upon their value and prevent proceeding with project creation if it fails. Some types also support custom validation rules.
The common types you will use are:
booleanintegerstring, supporting custom regex validationclass_fqnof type ClassFqn, which validates that its value is a valid fully qualified class nameinline_string_listof type StringList, for a comma-separated list of stringsmaven_artifact_versionof type SemanticVersion, supports bothoptionsfor hardcoded choices and versions defined in remotes pom.xmlgradle_pluginof type GradlePluginSelectorCreatorProperty.Holder, for enabling/disabling Gradle plugins and selecting remote-fetched versionsbuild_system_coordinatesof type BuildSystemCoordinates, providing standard Maven coordinates’groupId,artifactIdandversionjdkof type CreatorJdk, providing a JDK dropdown that can be filtered down with a minimum version defined in another property
There are also platform-specific types fetching versions from the platform’s servers, such as:
paper_versions(since format version 2) of type SemanticVersion, listing the Minecraft release versions Paper is available forfabric_game_version(since format version 4) of type SemanticVersion, listing the Minecraft versions supported by Fabric (1.14.4 and later, plus the latest snapshot), defaulting to the latest stable one. Unlikefabric_versions, it only selects the game version, which is useful when the rest of the project is generated by the Fabric CLI throughrun_npm_package
Properties are set up in the order they are declared, and are generally only able to access properties defined before them.
Options
string and maven_artifact_version properties support options, that is a hardcoded array or object of strings.
If it is an array the value is used as both the actual value and the label.
If it is an object, the key is the actual value and the value is the label.
Inheritance and Derivation
Inheritance and derivation are ways to depend upon previously defined properties to automatically set a property’s value.
Inheritance is simple, set inheritFrom to the name of the property you want to inherit from.
The property’s value will be updated every time the parent property changes until this property is modified,
at which point the inheritance will stop and the value won’t be updated automatically anymore.
Derivation allows for more complex use cases where you define one or more parents and a method, available methods
depend on the property type. A method might require parameters.
You can also specify with whenModified whether the derivation should stop when the property’s value is modified
manually (like inheritance does.) true means inheritance stops.
Alternatively, for simple cases, you can use a switch-like construct with select, an array of simple objects.
Each object has a value and a condition. They are evaluated in order of appearance. Once a condition is true the
value is used as the result of the derivation.
Validation
string properties support custom validation through a validator. The value is a regular expression tested against
the property’s value.
Template Files
Template files are declared in the files array. Each object in this array must contain a template and destination
string. Both are paths relative to the template root (the directory of the descriptor.) This means you can have multiple
templates in subdirectories accessing common files in their parent directory. They are also evaluated like a Velocity
template, and have access to all the properties of the template.
A file can also have a condition string deciding if it should be included in the created project. It is evaluated like
a Velocity condition, that is close to the regular Java condition syntax, and has access to all template properties.
Additionally, there are two boolean values openInEditor (defaults to false) and reformat (defaults to true) that
you can set for each file.
Template Finalizers
Template finalizers are actions performed sequentially once the project is fully created and opened in the IDE.
The existing finalizers are:
import_gradle_project, imports the Gradle project.add_gradle_run, adds a Gradle run configuration namedname, running the Gradle tasks provided in itstasksarray.run_gradle_tasks, executes Gradle tasks provided in itstasksarray.import_maven_project, imports the Maven project.add_maven_run, adds a Maven run configuration namedname, running the Maven goals provided in itsgoalsarray.git_add_all, adds all the existing files of the project to the Git repo.run_npm_package, runs a command from an npm package, see below.generate_files, generates files from templates, see below.replace_in_file, replaces text in a file of the project, see below.
The run configuration finalizers also accept a select boolean, to make the new run configuration the selected one.
Otherwise, it is only selected if no other run configuration is.
Finalizers can also have a condition, which works the same way as in files.
Finalizers run in the order they are declared, so a finalizer can rely on the files created or modified by the previous
ones. For instance, import_gradle_project should come after any finalizer generating the Gradle build files.
Run npm Package
Available since format version 4, run_npm_package runs a command from an npm package, such as a project generator.
This lets a template delegate creating the project to a platform’s official tooling, and then adjust the result with
the other finalizers.
Packages are installed in an npm environment maintained by the plugin, separate from the user’s global npm installation, and are updated every time they are run. Npm must be installed on the user’s machine: the creator shows a field to choose the npm executable, and prevents creating the project if none can be found. Because the package’s code will run on the user’s machine, the creator also shows a warning naming the package and the command it will run, along with who published it on the npm registry.
The package comes from exactly one of:
package, the name of a package on the npm registry, with an optionalversion, an exact version or dist-tag defaulting tolatestrepository, the URL of a git repository with the package at its root, which is cloned and then built by running thepackage.jsonscripts listed in its optionalbuildarray
What to run is exactly one of:
command, the name of one of the executables declared in the package’sbinscript, a JavaScript file of the package, relative to its root, run with Node.js
The other values are all optional:
args, an array of arguments passed to the command. Each argument is evaluated as a Velocity template, and arguments that end up blank are left outworkingDirectory, the directory to run the command in, relative to the project directory, which it defaults to. It is evaluated as a Velocity template, and must be inside the project directoryinput, text written to the command’s standard input, evaluated as a Velocity template
For example, the built-in Fabric template generates its project with the Fabric CLI:
{
"type": "run_npm_package",
"package": "@fabricmc/cli",
"command": "fabric",
"args": [
"init",
"--defaultOptions",
"--name=$MOD_NAME",
"--modid=$MOD_ID",
"--version=$MC_VERSION",
"--option=kotlin=$LANGUAGE.equals('Kotlin')",
"."
]
}
Generate Files
Available since format version 4, generate_files generates the files in its files array. They work exactly like the
descriptor’s files, except they are generated at this point of the finalization instead of before it.
This is useful to add files to, or overwrite files of, a project created by a previous finalizer such as
run_npm_package.
{
"type": "generate_files",
"files": [
{
"template": "../licenses/${LICENSE.id}.txt.ft",
"destination": "LICENSE"
}
]
}
Replace in File
Available since format version 4, replace_in_file replaces all occurrences of find in a file with replace.
fileis relative to the project directory and is evaluated as a Velocity templatefindis used as is. If the optionalregexboolean istrue, it is a regular expressionreplaceis evaluated as a Velocity template, and is always inserted literally, even whenregexistrue
A warning is logged if the file does not exist or the text was not found, but project creation carries on.
{
"type": "replace_in_file",
"file": "src/main/resources/fabric.mod.json",
"find": "\"license\"\\s*:\\s*\"[^\"]*\"",
"regex": true,
"replace": "\"license\": \"${LICENSE.id}\""
}