From 92785e88abc5b9077e7b6bd1027a4db48385e5a1 Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Sun, 26 May 2024 10:09:53 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 + README.md | 3 ++ build.py | 52 +++++++++++++++++++ .../recipes/copper_button_create.json | 12 +++++ .../crafting/recipes/copper_chain_create.json | 20 +++++++ .../recipes/copper_lantern_create.json | 20 +++++++ fabric.mod.json | 22 ++++++++ pack.mcmeta | 6 +++ 8 files changed, 137 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 build.py create mode 100644 data/crafting/recipes/copper_button_create.json create mode 100644 data/crafting/recipes/copper_chain_create.json create mode 100644 data/crafting/recipes/copper_lantern_create.json create mode 100644 fabric.mod.json create mode 100644 pack.mcmeta diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4e11e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +_build + diff --git a/README.md b/README.md new file mode 100644 index 0000000..d31b374 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Create + ExtendedCopper Compatibility + +This datapack ensures compatibility between the Create and ExtendedCopper mod. diff --git a/build.py b/build.py new file mode 100644 index 0000000..022d9de --- /dev/null +++ b/build.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +from json import load +from os import chdir +from pathlib import Path +from shutil import copy +from shutil import copytree +from shutil import make_archive +from shutil import rmtree + + +project_dir = Path(".").resolve() +build_root_dir = project_dir / "_build" + +fabric_mod_json_path = project_dir / "fabric.mod.json" +source_files = [ + fabric_mod_json_path, + project_dir / "pack.mcmeta", + project_dir / "data" +] + + +def get_build_name(mod_info: dict) -> str: + return f"{mod_info['id'].replace('_', '-')}-{mod_info['version']}-mc{mod_info['depends']['minecraft']}" + + +if __name__ == "__main__": + # load mod info + with fabric_mod_json_path.open("r") as f: + mod_info = load(f) + # get build name + build_name = get_build_name(mod_info) + # clear/create required directories + build_tmp_dir = build_root_dir / build_name + if build_tmp_dir.exists(): + rmtree(build_tmp_dir) + build_tmp_dir.mkdir(parents=True) + # copy source files + for s in source_files: + if s.is_dir(): + copytree(s, build_tmp_dir / s.name) + else: + copy(s, build_tmp_dir / s.name) + # create jar archive + chdir(build_root_dir) + make_archive(build_name, "zip", build_tmp_dir.name) + output_file = Path(build_name + ".zip").rename(build_name + ".jar").resolve() + chdir(project_dir) + # cleanup + rmtree(build_tmp_dir) + # done + print("Done. The resulting jar file is at ", output_file) diff --git a/data/crafting/recipes/copper_button_create.json b/data/crafting/recipes/copper_button_create.json new file mode 100644 index 0000000..0012575 --- /dev/null +++ b/data/crafting/recipes/copper_button_create.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "create:copper_nugget" + } + ], + "result": { + "item": "extendedcopper:copper_button", + "count": 1 + } +} diff --git a/data/crafting/recipes/copper_chain_create.json b/data/crafting/recipes/copper_chain_create.json new file mode 100644 index 0000000..6e49728 --- /dev/null +++ b/data/crafting/recipes/copper_chain_create.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "N", + "I", + "N" + ], + "key": { + "I": { + "item": "minecraft:copper_ingot" + }, + "N": { + "item": "create:copper_nugget" + } + }, + "result": { + "item": "extendedcopper:copper_chain", + "count": 1 + } +} diff --git a/data/crafting/recipes/copper_lantern_create.json b/data/crafting/recipes/copper_lantern_create.json new file mode 100644 index 0000000..f9b16dd --- /dev/null +++ b/data/crafting/recipes/copper_lantern_create.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "XXX", + "X#X", + "XXX" + ], + "key": { + "#": { + "item": "minecraft:torch" + }, + "X": { + "item": "create:copper_nugget" + } + }, + "result": { + "item": "extendedcopper:copper_lantern", + "count": 1 + } +} diff --git a/fabric.mod.json b/fabric.mod.json new file mode 100644 index 0000000..df0d5cf --- /dev/null +++ b/fabric.mod.json @@ -0,0 +1,22 @@ +{ + "schemaVersion": 1, + "id": "create_expandedcopper_compat", + "version": "1.0.0", + "name": "Create ExpandedCopper Compatibility", + "description": "Adds compatibility between the Create and ExtendedCopper mods.", + "authors": [ + "ChaoticByte" + ], + "contact": { + "sources": "https://github.com/ChaoticByte/create-expandedcopper-compat", + "issues": "https://github.com/ChaoticByte/create-expandedcopper-compat/issues" + }, + "license": "MIT", + "environment": "*", + "depends": { + "minecraft": "1.20.1", + "fabric-resource-loader-v0": "*", + "create": "0.5.x", + "extendedcopper": "1.4.x" + } +} \ No newline at end of file diff --git a/pack.mcmeta b/pack.mcmeta new file mode 100644 index 0000000..6c85505 --- /dev/null +++ b/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 15, + "description": "This datapacks adds compatibility between the Create and ExtendedCopper mods" + } +}