-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (46 loc) · 2.19 KB
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
ID=rainbow
VERSION=develop
LOADER=fabric
MINECRAFT=1.20.1
BUILDDIR=build
$(BUILDDIR)/$(MINECRAFT):
mkdir -p $@/$(MINECRAFT)
$(BUILDDIR)/$(MINECRAFT)/server: | $(BUILDDIR)/$(MINECRAFT)
@echo "Installing Fabric"
mkdir -p $(BUILDDIR)/$(MINECRAFT)/server
wget -nc https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.11.2/fabric-installer-0.11.2.jar -O $(BUILDDIR)/fabric-installer.jar
cd $(BUILDDIR) && java -jar fabric-installer.jar \
server -dir $(MINECRAFT)/server -mcversion ${MINECRAFT} -downloadMinecraft
-rm $(BUILDDIR)/fabric-installer.jar
$(BUILDDIR)/$(MINECRAFT)/server/packwiz-installer-bootstrap.jar: | $(BUILDDIR)/$(MINECRAFT)/server
@echo "Preparing packwiz bootstrap"
wget -nc https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v0.0.3/packwiz-installer-bootstrap.jar -P $(BUILDDIR)/$(MINECRAFT)/server
$(BUILDDIR)/$(MINECRAFT)/server/eula.txt:
@echo "Agreeing to EULA"
echo "eula=true" > $(BUILDDIR)/$(MINECRAFT)/server/eula.txt
update-packwiz:
@echo "Update packwiz"
go install github.com/packwiz/packwiz@latest
serve-mods: | update-packwiz
@echo "Download server mods"
-pkill packwiz
packwiz --pack-file ./pack/${MINECRAFT}/pack.toml serve &
@sleep 1
prepare-server: serve-mods $(BUILDDIR)/$(MINECRAFT)/server/packwiz-installer-bootstrap.jar
run-server: prepare-server $(BUILDDIR)/$(MINECRAFT)/server/eula.txt
@echo "Starting Dev Server"
cd $(BUILDDIR)/$(MINECRAFT)/server && java -jar packwiz-installer-bootstrap.jar -g -s server http://0.0.0.0:8080/pack.toml
cd $(BUILDDIR)/$(MINECRAFT)/server && java -jar fabric-server-launch.jar nogui || echo "done"
-pkill packwiz
export-mrpack: $(BUILDDIR)/$(MINECRAFT)
@echo "Making ${MINECRAFT} Modrinth pack"
sed -i -e '/version =/ s/= .*/= "${VERSION}"/' pack/${MINECRAFT}/pack.toml
cd $(BUILDDIR)/$(MINECRAFT) && packwiz modrinth export --pack-file ../../pack/${MINECRAFT}/pack.toml
upload-modrinth: export-mrpack
ID=${ID} VERSION=${VERSION} LOADER=${LOADER} MINECRAFT=${MINECRAFT} MODRINTH_TOKEN=${MODRINTH_TOKEN} gradle modrinth
clean:
-pkill packwiz
-rm -rf $(BUILDDIR)/
sed -i -e '/version =/ s/= .*/= "${VERSION}"/' ./pack/$(MINECRAFT)/pack.toml
-git gc --aggressive --prune
all: modrinth prism server clean