modpack-template/Makefile

103 lines
3.3 KiB
Makefile
Raw Normal View History

2021-08-29 21:46:40 +01:00
default:
@echo "No Default make command configured"
@echo "Please use either"
2023-05-15 22:06:23 +01:00
@echo " - make multimc"
@echo " - make local multimc"
2023-05-15 22:06:23 +01:00
@echo " - make curseforge"
@echo " - make modrinth"
@echo " - make local technic"
2023-05-15 22:06:23 +01:00
@echo " - make technic"
@echo " - make server"
@echo " - make all"
@echo ""
2023-03-11 01:31:48 +00:00
PACKNAME := $(notdir $(shell pwd))
ICONNAME := $(shell echo $(PACKNAME) | sed 's/[^a-zA-Z0-9]/_/g')
2023-05-15 22:06:23 +01:00
PACKURL := $(shell pw detect)
2023-03-11 01:31:48 +00:00
build: refresh
@mkdir -p .build
@echo "PACKNAME: ${PACKNAME}"
@echo "ICONNAME: ${ICONNAME}"
@echo "PACKURL: ${PACKURL}"
curseforge: build
2022-02-25 19:48:07 +00:00
@echo "Making Curseforge pack"
2023-03-11 01:31:48 +00:00
packwiz curseforge export --pack-file .minecraft/pack.toml
2023-05-15 22:06:23 +01:00
mv ./*.zip ./.build/${PACKNAME}-curseforge.zip
2022-03-02 02:47:39 +00:00
modrinth: build
2022-03-02 02:47:39 +00:00
@echo "Making Modrinth pack"
packwiz modrinth export --pack-file .minecraft/pack.toml
2023-05-15 22:06:23 +01:00
mv ./*.mrpack ./.build/${PACKNAME}-modrinth.mrpack
2022-02-25 19:48:07 +00:00
multimc: build
2022-02-25 19:07:26 +00:00
@echo "Making MultiMC pack"
cp .minecraft/icon.png ./${ICONNAME}_icon.png
2023-03-11 01:31:48 +00:00
7z d .build/${PACKNAME}-multimc.zip ./* -r
7z d .build/${PACKNAME}-multimc.zip ./.minecraft -r
2023-05-15 22:06:23 +01:00
@sed -i 's#{PACKURL}#${PACKURL}#' instance.cfg
@sed -i 's#{ICONNAME}#${ICONNAME}#' instance.cfg
2023-03-11 01:31:48 +00:00
7z a .build/${PACKNAME}-multimc.zip ./* -r
7z a .build/${PACKNAME}-multimc.zip ./.minecraft -r
7z d .build/${PACKNAME}-multimc.zip ./.build ./.minecraft/mods ./.minecraft/pack.toml ./.minecraft/index.toml -r
rm ./${ICONNAME}_icon.png
2023-05-15 22:06:23 +01:00
@sed -i 's#${PACKURL}#{PACKURL}#' instance.cfg
@sed -i 's#${ICONNAME}#{ICONNAME}#' instance.cfg
2023-05-15 22:06:23 +01:00
2021-08-29 21:46:40 +01:00
# Technic targets
technic: build
2022-02-25 19:07:26 +00:00
@echo "Making Technic pack"
@mkdir -p .technic
2022-02-25 19:07:26 +00:00
-rm -rf .technic
cp -r .minecraft .technic
cp .minecraft/icon.png .technic/icon.png
2023-03-11 01:31:48 +00:00
cd .technic && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml && cd ..
-rm -rf .technic/packwiz* .technic/index.toml .technic/pack.toml .technic/mods/*.toml
7z d .build/${PACKNAME}-technic.zip ./* ./.* -r
7z a .build/${PACKNAME}-technic.zip ./.technic/* -r
2021-08-29 21:46:40 +01:00
# Server target
server: build
2023-05-15 22:06:23 +01:00
@echo "Making Server pack"
-rm -rf .server
@mkdir -p .server
mc-server-icon --icon .minecraft/icon.png --output .server/server-icon.png
2023-05-15 22:06:23 +01:00
cd .server && java -jar ../.minecraft/packwiz-installer-bootstrap.jar -s server ../.minecraft/pack.toml && cd ..
7z d .build/${PACKNAME}-server.zip ./* ./.* -r
7z a .build/${PACKNAME}-server.zip ./.server/* -r
preClean:
-rm -rf .build .server .technic
-rm -f ./instance.cfga*
postClean:
2022-02-27 19:35:13 +00:00
-git gc --aggressive --prune
2023-05-15 22:06:23 +01:00
clean: preClean postClean
2022-02-27 19:35:13 +00:00
2023-05-15 22:06:23 +01:00
all: preClean curseforge modrinth multimc technic server postClean
refresh:
cd .minecraft && packwiz refresh
update-packwiz:
go install github.com/packwiz/packwiz@latest
2023-05-03 19:15:54 +01:00
go install github.com/Merith-TK/packwiz-wrapper/cmd/pw@main
go install github.com/Merith-TK/utils/cmd/mc-server-icon@main
clear
2023-05-15 22:06:23 +01:00
@echo "Packwiz has been Updated"
run-server:
@cd .minecraft && pw refresh
@mkdir -p .run
@echo "eula=true" > .run/eula.txt
@mc-server-icon --icon .minecraft/icon.png --output .run/server-icon.png
@cd .run && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml -s server
@if [ ! -f .run/server.jar ]; then \
echo "Downloading Fabric server jar..."; \
curl -o .run/server.jar https://meta.fabricmc.net/v2/versions/loader/1.21.1/0.16.5/1.0.1/server/jar; \
fi
@cd .run && java -Xmx2G -Xms2G -jar server.jar nogui