From 8041d3f2d13d239e3473918db0ff68bf27f548b8 Mon Sep 17 00:00:00 2001 From: alan Date: Sun, 11 Aug 2024 21:12:24 -0400 Subject: [PATCH] Update for 1.21, describe setup process --- .gitignore | 2 +- README.md | 7 ++++++- build_double.cmd | 3 +++ loot_randomizer/randomize.py | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d871d17..ce0e680 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -loot_randomizer/loot_tables/ +loot_randomizer/loot_table/ loot_randomizer/*.zip mcrecipescrambler/ build/ \ No newline at end of file diff --git a/README.md b/README.md index 7c1732b..66e0012 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,9 @@ Trent keeps asking me for randomizers, so I'm automating the process now so it's easy. -on windows: `.\build.cmd packName` +## DOING THE THING +1. First, run `$ prep.cmd` to clone the `mcrecipescrambler` repository +2. Go to `%appdata%\.minecraft\versions\1.21.1` in Windows, then use 7-Zip to open the `.jar` file as an archive +3. Copy the contents of `recipe` from the `.jar` into `mcrecipescrambler/crafting_files` (make directory as necessary) +4. Copy the contents of `loot_table` from the `.jar` into `loot_randomizer/loot_table` (can right-click directory and click **Copy to...**) +5. Run `build_double.cmd pack_name` in terminal diff --git a/build_double.cmd b/build_double.cmd index 9883cb7..3988497 100644 --- a/build_double.cmd +++ b/build_double.cmd @@ -14,6 +14,9 @@ mkdir .\build\%1\ "C:\Program Files\7-Zip\7z.exe" x loot_randomizer\random_loot.zip -o.\build\%1\ -r -y "C:\Program Files\7-Zip\7z.exe" x mcrecipescrambler\out.zip -o.\build\%1\ -r -y +REM rename recipes to recipe, to support 1.21 format +move build\%1\data\minecraft\recipes build\%1\data\minecraft\recipe + REM now, zip everything up into a file, and delete remains "C:\Program Files\7-Zip\7z.exe" a -tzip .\build\randomizer_%1.zip .\build\%1\* rmdir /s /q .\build\%1\ diff --git a/loot_randomizer/randomize.py b/loot_randomizer/randomize.py index 37bcd43..97a016a 100644 --- a/loot_randomizer/randomize.py +++ b/loot_randomizer/randomize.py @@ -26,7 +26,7 @@ print('Generating datapack...') file_list = [] remaining = [] -for dirpath, dirnames, filenames in os.walk('loot_tables'): +for dirpath, dirnames, filenames in os.walk('loot_table'): for filename in filenames: file_list.append(os.path.join(dirpath, filename)) remaining.append(os.path.join(dirpath, filename)) @@ -47,7 +47,7 @@ for from_file in file_dict: zip.writestr(os.path.join('data/minecraft/', file_dict[from_file]), contents) -zip.writestr('pack.mcmeta', json.dumps({'pack':{'pack_format':1, 'description':datapack_desc}}, indent=4)) +zip.writestr('pack.mcmeta', json.dumps({'pack':{'pack_format':48, 'description':datapack_desc}}, indent=4)) zip.writestr('data/minecraft/tags/functions/load.json', json.dumps({'values':['{}:reset'.format(datapack_name)]})) zip.writestr('data/{}/functions/reset.mcfunction'.format(datapack_name), 'tellraw @a ["",{"text":"Loot table randomizer by SethBling","color":"green"}]')