Update for 1.21, describe setup process

This commit is contained in:
Alan O'Cull 2024-08-11 21:12:24 -04:00
parent 309ab9505a
commit 8041d3f2d1
4 changed files with 12 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
loot_randomizer/loot_tables/
loot_randomizer/loot_table/
loot_randomizer/*.zip
mcrecipescrambler/
build/

View File

@ -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

View File

@ -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\

View File

@ -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"}]')