quilt-template-mod/interactive-setup.sh

117 lines
4.5 KiB
Bash
Raw Normal View History

2023-06-20 22:55:45 -06:00
#!/bin/bash
2023-06-21 00:36:50 -06:00
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 '______'
2023-06-21 01:27:09 -06:00
echo 'Mod Homepage - (NO HTTPS://DFASDF/) - example.com:'
2023-06-21 00:36:50 -06:00
read homepage
2023-06-21 01:27:09 -06:00
echo 'you will have to manually edit the "source" and "issues" section of the quilt.mod.json'
2023-06-21 00:36:50 -06:00
echo '______'
# list vars
echo 'OK. here is what you typed...'
2023-06-21 01:27:09 -06:00
echo $modnamehr, $modnameus, $modnamecase, $uname, $website, $homepage, $websiteld, $websiteroot, $moddesc
2023-06-21 00:36:50 -06:00
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
2023-06-21 01:27:09 -06:00
###################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}
2023-06-21 00:36:50 -06:00
## Packages/filenames
mv ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/ExampleMod.java ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java
2023-06-21 01:27:09 -06:00
mv ./src/main/resources/example_mod.mixins.json ./src/main/resources/${modnameus}.mixins.json
2023-06-21 00:36:50 -06:00
# 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
2023-06-21 01:27:09 -06:00
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "1s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}/"
2023-06-21 00:36:50 -06:00
### Main Class Import
2023-06-21 01:27:09 -06:00
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "3s/com.example.example_mod.ExampleMod/${websitetld}.${websiteroot}.${modnameus}.${modnamecase}/"
2023-06-21 00:36:50 -06:00
### Logger Class
2023-06-21 01:27:09 -06:00
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "14s/ExampleMod/${modnamecase}/"
2023-06-21 00:36:50 -06:00
## 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
2023-06-21 01:27:09 -06:00
sed -i ./src/main/resources/quilt.mod.json -e "14s/example.com/${homepage}/"
2023-06-21 00:36:50 -06:00
### 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}/"