Skip to content

Commit 7a7911e

Browse files
author
wipodev
committed
feat(create): integrate version-aware pack.mcmeta generation into project creation
Added automatic rendering of pack.mcmeta from version data using Jinja2. Introduced unified version metadata mapping for all Minecraft versions (1.19.2–1.21.10), including pack_format, forge_gradle range, Java version, and other build parameters. The create command now renders build.gradle, gradle.properties, MainMod.java, and pack.mcmeta using version-specific templates from evermod-templates.
1 parent f03b741 commit 7a7911e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/evermod/commands/create.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run():
4141
return
4242
mod_dir.mkdir(parents=True, exist_ok=True)
4343

44-
templates_dir, src_main_java, src_main_java_mod = create_mod_structure(mod_dir, package_parts)
44+
templates_dir, src_main_java, src_main_java_mod, src_main_resources = create_mod_structure(mod_dir, package_parts)
4545

4646
context = version_info.copy()
4747
context.update({
@@ -57,6 +57,7 @@ def run():
5757
(templates_dir / "template.build.gradle.j2", mod_dir / "build.gradle"),
5858
(templates_dir / "template.gradle.properties.j2", mod_dir / "gradle.properties"),
5959
(templates_dir / "template.MainMod.java.j2", src_main_java_mod / "MainMod.java"),
60+
(templates_dir / "template.pack.mcmeta.j2", src_main_resources / "pack.mcmeta"),
6061
]:
6162
render_template(tpl, context, output)
6263

src/evermod/commands/create_helper/structure_builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ def create_mod_structure(mod_dir: Path, package_parts: list[str]):
1616
templates_dir = get_templates_dir()
1717

1818
for tpl_file, dst_file in [
19-
("mods.toml", src_main_resources / "mods.toml"),
20-
("pack.mcmeta", src_main_metainf / "pack.mcmeta"),
19+
("mods.toml", src_main_metainf / "mods.toml"),
2120
("LICENSE.txt", mod_dir / "LICENSE.txt"),
2221
]:
2322
shutil.copy2(templates_dir / tpl_file, dst_file)
2423

25-
return templates_dir, src_main_java, src_main_java_mod
24+
return templates_dir, src_main_java, src_main_java_mod, src_main_resources

0 commit comments

Comments
 (0)