edibleBlocks/interactive-setup.sh

117 lines
4.5 KiB
Bash
Raw Normal View History

2024-04-10 15:57:17 -06:00
#!/bin/bash
echo 'Welcome! We will ask you a few questions to get set up.'
echo 'please note if you fuck up typing you will fuck up your mod, but you can fix it manually cant you :)'
echo '______'
echo 'First lets get your mod name and description'
echo '______'
echo 'Human Readable Mod Name:'
read modnamehr
echo 'Mod Name - example_mod :'
read modnameus
echo 'Mod Name - Case - ExampleMod:'
read modnamecase
echo 'Mod Description - "this mod does stuff!"'
read moddesc
echo '______'
echo 'okay now lets get some information about you'
echo '______'
echo 'Your Name - or Username:'
read uname
echo 'Your website - backwards - com.example:'
read website
echo 'now split it up... so'
echo 'website tld - ie "com" from com.example'
read websitetld
echo 'and the root.. ie "example" from com.example'
read websiteroot
echo '______'
echo 'okay now some links!'
echo '______'
echo 'Mod Homepage - (NO HTTPS://DFASDF/) - example.com:'
read homepage
echo 'you will have to manually edit the "source" and "issues" section of the quilt.mod.json'
echo '______'
# list vars
echo 'OK. here is what you typed...'
echo $modnamehr, $modnameus, $modnamecase, $uname, $website, $homepage, $websiteld, $websiteroot, $moddesc
echo '______'
echo 'Setting you up....'
# edit gradle properties
sed -i ./gradle.properties -e "7s/com.example/${website}/"
sed -i ./gradle.properties -e "8s/example_mod/${modnameus}/"
# edit namespace
## Folders
###################something is going wrong here, it doesnt know how to rename the folder?????????????
mv ./src/main/java/com ./src/main/java/${websitetld}
mv ./src/main/java/${websitetld}/example ./src/main/java/${websitetld}/${websiteroot}
mv ./src/main/java/${websitetld}/${websiteroot}/example_mod ./src/main/java/${websitetld}/${websiteroot}/${modnameus}
mv ./src/main/resources/assets/example_mod ./src/main/resources/assets/${modnameus}
## Packages/filenames
mv ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/ExampleMod.java ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java
mv ./src/main/resources/example_mod.mixins.json ./src/main/resources/${modnameus}.mixins.json
# edit file lines.... this is going to suck to type out lol....
####remember sed -i <FILE-TO-EDIT> -e "<line>s/<texttoedit>/<texttoinpu>"
## Main Package
### package
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "1s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}/"
### class
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "8s/ExampleMod/${modnamecase}/"
### MOD_ID
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "10s/example_mod/${modnameus}/"
### Logger Name
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "15s/Example Mod/${modnamehr}/"
## TitleScreenMixin
### package
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "1s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}/"
### Main Class Import
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "3s/com.example.example_mod.ExampleMod/${websitetld}.${websiteroot}.${modnameus}.${modnamecase}/"
### Logger Class
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "14s/ExampleMod/${modnamecase}/"
## RESOURCES (mixins.json and quilt.mod.json)
### package name in *.mixins.json
sed -i ./src/main/resources/${modnameus}.mixins.json -e "4s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}/"
#### quilt.mod.json
### group section
sed -i ./src/main/resources/quilt.mod.json -e "4s/com.example/${websitetld}.${websiteroot}/"
### id section
sed -i ./src/main/resources/quilt.mod.json -e "5s/example_mod/${modnameus}/"
### name section
sed -i ./src/main/resources/quilt.mod.json -e "8s/Mod name/${modnamehr}/"
### description section
sed -i ./src/main/resources/quilt.mod.json -e "9s/A short description of your mod./${moddesc}/"
### contributors section
sed -i ./src/main/resources/quilt.mod.json -e "11s/Your name here/${uname}/"
### homepage section
sed -i ./src/main/resources/quilt.mod.json -e "14s/example.com/${homepage}/"
### icon secion
sed -i ./src/main/resources/quilt.mod.json -e "18s/example_mod/${modnameus}/"
### entrypoints init section
sed -i ./src/main/resources/quilt.mod.json -e "22s/com.example.example_mod.ExampleMod/${websitetld}.${websiteroot}.${modnameus}.${modnamecase}/"
### mixin section
sed -i ./src/main/resources/quilt.mod.json -e "39s/example_mod/${modnameus}/"