-
Notifications
You must be signed in to change notification settings - Fork 41
/
make-my-own.sh
executable file
·36 lines (33 loc) · 1.19 KB
/
make-my-own.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
print_help() {
echo "$0 <new package name> <project name> <modid>"
}
if [ "$#" -ne "3" ]; then
print_help
exit 0
fi
base=$(dirname "$(readlink -f "$0")")
echo "Updating $base"
package_name="$1"
project_name="$2"
modid="$3"
package_dir=$(echo "$package_name" | tr . /)
echo "Setting package name to $package_name"
echo "Setting project name to $project_name"
echo "Setting package dir to $package_dir"
echo "Setting mod id to $modid"
(
set -x
find "$base"/src/main -type f -exec sed -i s/examplemod/"$modid"/g\;s/com.example/"$package_name"/g {} +
sed -i s/com.example/"$package_name"/g\;s/examplemod/"$modid"/g "$base"/gradle.properties
sed -i s/examplemod/"$project_name"/g "$base"/settings.gradle.kts
mkdir -p "$base"/src/main/java/"$package_dir"
mkdir -p "$base"/src/main/kotlin/"$package_dir"
mv "$base"/src/main/java/com/example/* "$base"/src/main/java/"$package_dir"
mv "$base"/src/main/kotlin/com/example/* "$base"/src/main/kotlin/"$package_dir"
mv "$base"/src/main/resources/mixins.examplemod.json "$base"/src/main/resources/mixins."$modid".json
rm "$base"/.github/workflows/init.yml
rm "$(readlink -f $0)"
)
echo "All done"
echo "Now go commit those changes"