52 lines
986 B
Bash
Executable File
52 lines
986 B
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
DORECIPES=$1
|
|
DOLOOT=$2
|
|
APPEND=$3
|
|
|
|
for fn in `cat config/packnames.txt`; do
|
|
PACKNAME="$fn$APPEND"
|
|
PACK="build/$PACKNAME"
|
|
echo "generating $PACK"
|
|
mkdir -p $PACK
|
|
|
|
PATHLOOT="python/random_loot.zip"
|
|
PATHRECIPES="python/scrambler.zip"
|
|
|
|
# Do randomization
|
|
if [ "$DOLOOT" = true ]; then
|
|
cd python/ && python random_loot.py
|
|
cd ..
|
|
fi
|
|
if [ "$DORECIPES" = true ]; then
|
|
cd python/ && python scramble_recipes.py
|
|
cd ..
|
|
fi
|
|
|
|
# Wait for Filesystem to catch up
|
|
echo "generated packs, waiting"
|
|
sleep 0.3
|
|
|
|
# Extract generated zip files
|
|
echo "extracting files"
|
|
if [ -f $PATHLOOT ]; then
|
|
7z x $PATHLOOT -o$PACK -r -y
|
|
fi
|
|
if [ -f $PATHRECIPES ]; then
|
|
7z x $PATHRECIPES -o$PACK -r -y
|
|
|
|
# rename recipes to recipe, to support 1.21 format
|
|
mv $PACK/data/minecraft/recipes $PACK/data/minecraft/recipe
|
|
fi
|
|
|
|
# Zip it all up
|
|
echo "zipping datapack"
|
|
cd build/
|
|
7z a -tzip $PACKNAME.zip $PACKNAME/*
|
|
cd ..
|
|
|
|
# rm -rf $PACK
|
|
rm -rf $PATHLOOT
|
|
rm -rf $PATHRECIPES
|
|
done
|