From 54ae6414da5b2fe9a19b7fcc7176bb293b7b0539 Mon Sep 17 00:00:00 2001 From: krumel Date: Sun, 12 Jun 2022 11:08:55 +0200 Subject: [PATCH] added helper scripts to repo --- .gitignore | 7 ++++- datapacks/gen_crushing.py | 31 +++++++++++++++++++ datapacks/templates/sheetmetal_crushing.json | 16 ++++++++++ refreshmods.sh | 32 ++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 datapacks/gen_crushing.py create mode 100644 datapacks/templates/sheetmetal_crushing.json create mode 100755 refreshmods.sh diff --git a/.gitignore b/.gitignore index 2ff68bc..6b30fda 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !readme.md !.gitignore !modlist.md +!refreshmods.sh #include configs !config @@ -14,4 +15,8 @@ !saves/ !saves/world/ !saves/world/serverconfig/ -!saves/world/serverconfig/** \ No newline at end of file +!saves/world/serverconfig/** + +#include datapack generation +!datapacks +!datapacks/** \ No newline at end of file diff --git a/datapacks/gen_crushing.py b/datapacks/gen_crushing.py new file mode 100644 index 0000000..08e9c0c --- /dev/null +++ b/datapacks/gen_crushing.py @@ -0,0 +1,31 @@ +import os.path + +template_path = "./templates/sheetmetal_crushing.json" +output_path = "../openloader/modpack_datapack/data/modpack_datapack/recipes" +output_name = "sheetmetal_crushing_{}.json" + +recipes = [ + ["copper", "immersiveengineering:sheetmetal_copper", "create:crushed_copper_ore"], + ["aluminum", "immersiveengineering:sheetmetal_aluminum", "create:crushed_aluminum_ore"], + ["lead", "immersiveengineering:sheetmetal_lead", "create:crushed_lead_ore"], + ["silver", "immersiveengineering:sheetmetal_silver", "create:crushed_silver_ore"], + ["nickel", "immersiveengineering:sheetmetal_nickel", "create:crushed_nickel_ore"], + ["uranium", "immersiveengineering:sheetmetal_uranium", "create:crushed_uranium_ore"], +# ["constantan", "immersiveengineering:sheetmetal_copper", "create:crushed_copper_ore"], +# ["electrum", "immersiveengineering:sheetmetal_copper", "create:crushed_copper_ore"], +# ["steel", "immersiveengineering:sheetmetal_copper", "create:crushed_copper_ore"], + ["iron", "immersiveengineering:sheetmetal_iron", "create:crushed_iron_ore"], + ["gold", "immersiveengineering:sheetmetal_gold", "create:crushed_gold_ore"], + ["gold_cdeco", "createdeco:gold_sheet_metal", "create:crushed_gold_ore"], + ["iron_cdeco", "createdeco:iron_sheet_metal", "create:crushed_iron_ore"], + ["copper_cdeco", "createdeco:copper_sheet_metal", "create:crushed_copper_ore"], + ["zinc_cdeco", "createdeco:zinc_sheet_metal", "create:crushed_zinc_ore"] +] + +template = open(template_path, "r").readlines() + +for recipe in recipes: + print(recipe[0]) + with open(os.path.join(output_path, output_name.format(recipe[0])), "w") as outfile: + for line in template: + outfile.write(line.replace("{input}", recipe[1]).replace("{output}", recipe[2])) diff --git a/datapacks/templates/sheetmetal_crushing.json b/datapacks/templates/sheetmetal_crushing.json new file mode 100644 index 0000000..4c912b4 --- /dev/null +++ b/datapacks/templates/sheetmetal_crushing.json @@ -0,0 +1,16 @@ +{ + "type": "create:crushing", + "group": "minecraft:misc", + "ingredients": [ + { + "item": "{input}" + } + ], + "results": [ + { + "item": "{output}", + "count": 1 + } + ], + "processingTime": 300 +} \ No newline at end of file diff --git a/refreshmods.sh b/refreshmods.sh new file mode 100755 index 0000000..d9156e5 --- /dev/null +++ b/refreshmods.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# if you cloned this from the repository, you might have to edit your paths +# this is mainly for me, so I can easily update the pack on the server +echo "Sync mods" + +rsync -Pr --delete --filter="- /user/" --filter="- /.old/" ~/Games/Minecraft/modpack_dev/ ~/.local/share/PolyMC/instances/modpack_dev/.minecraft/mods/ + +echo "Create modlist" + +echo "# Automatically downloaded" > modlist.md +ferium list >> modlist.md +echo "# Manually downloaded" >> modlist.md +ls ~/Games/Minecraft/modpack_dev/user >> modlist.md + +# add extra newlines +gawk -i inplace 1 ORS='\n\n' modlist.md + +echo "Zip the mods" +tar -czvf /tmp/krumels_pack_dev_$(date -Idate -u).tar.gz mods + +echo "Move mods to the webroot" +rsync -e ssh /tmp/krumels_pack_dev_$(date -Idate -u).tar.gz minecraft@krumel.moe:~/webroot/mods + +echo "Sync mods with server" +rsync -Pr --delete --filter="- /DistantHorizons-*" mods/ minecraft@krumel.moe:~/Krumelcraft/mods/ + +echo "Sync config with server" +rsync -Pr --delete config/ minecraft@krumel.moe:~/Krumelcraft/config/ + +echo "Sync level-config with server" +rsync -Pr --delete saves/world/serverconfig/ minecraft@krumel.moe:~/Krumelcraft/world/serverconfig \ No newline at end of file