Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e38527fcc | ||
|
|
1a41f832e4 | ||
|
|
3aeb275a65 | ||
|
|
2e74130b2e |
@@ -37,28 +37,6 @@ if (-not (Get-Command "java" -ErrorAction SilentlyContinue)) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that git is installed
|
|
||||||
if (-not (Get-Command "git" -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Host "Error: git is not installed." -Foreground Red
|
|
||||||
|
|
||||||
if ($winget) {
|
|
||||||
Write-Host "Attempting to install git."
|
|
||||||
winget install --id Git.Git -e --source winget
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Please install git to continue." -Foreground Red
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check that multimc is installed
|
|
||||||
if (-not (Get-Command "multimc" -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Host "Error: multimc is not installed." -Foreground Red
|
|
||||||
Write-Host "Please install multimc to continue." -Foreground Red
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Test-Path ".venv") { } else { python -m venv .venv }
|
if (Test-Path ".venv") { } else { python -m venv .venv }
|
||||||
|
|
||||||
. ./.venv/bin/Activate.ps1
|
. ./.venv/bin/Activate.ps1
|
||||||
|
|||||||
164
client/client.py
164
client/client.py
@@ -1,27 +1,169 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os, sys, shutil, requests, tempfile, glob, subprocess
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
MOD_DOWNLOADER_URL = "https://github.com/North-West-Wind/CurseForge-CLI/releases/latest/download/curseforge.zip"
|
OS = sys.platform
|
||||||
|
|
||||||
REPO_URL = "https://git.233hfd.com/joey/FishPogPixelmon"
|
MOD_DOWNLOADER_URL = "https://github.com/Advik-B/CMPDL/releases/download/v3.0.0/CMPDL-raw.ZipApp.zip"
|
||||||
|
|
||||||
|
MODPACK_RELEASES_URL = "https://git.233hfd.com/api/v1/repos/joey/FishPogPixelmon/releases?limit=1"
|
||||||
|
|
||||||
|
MULTIMC_DOWNLOAD_URL_WINDOWS = "https://files.multimc.org/downloads/mmc-develop-win32.zip"
|
||||||
|
MULTIMC_PARENT_DIR = ""
|
||||||
|
MULTIMC_DIR = ""
|
||||||
|
|
||||||
|
if OS == "darwin":
|
||||||
|
cprint("no support for macos yet", "red")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if OS == "linux":
|
||||||
|
MULTIMC_PARENT_DIR = f"{os.getenv('HOME')}/.local/share"
|
||||||
|
MULTIMC_DIR = f"{MULTIMC_PARENT_DIR}/multimc"
|
||||||
|
|
||||||
|
if OS == "windows":
|
||||||
|
MULTIMC_PARENT_DIR = f"{os.getenv('APPDATA')}/FishPog"
|
||||||
|
MULTIMC_DIR = f"{MULTIMC_PARENT_DIR}/MultiMC"
|
||||||
|
|
||||||
|
INSTANCE_DIR = f"{MULTIMC_DIR}/instances/FishPogPixelmon"
|
||||||
|
|
||||||
|
|
||||||
# main
|
# main
|
||||||
def __main__():
|
def __main__():
|
||||||
header()
|
header()
|
||||||
warning()
|
multimc()
|
||||||
|
needs_mods = instance()
|
||||||
|
if needs_mods:
|
||||||
|
mods()
|
||||||
|
run_mmc()
|
||||||
|
|
||||||
|
|
||||||
# info
|
# run
|
||||||
def warning():
|
def run_mmc():
|
||||||
cprint(
|
cprint("ready to go! starting multimc!", "green")
|
||||||
"This updater may remove your singleplayer worlds. Please use a different instance for singleplayer.", "yellow"
|
os.chdir(MULTIMC_DIR)
|
||||||
|
|
||||||
|
if OS == "windows":
|
||||||
|
subprocess.Popen(["MultiMC.exe"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
if OS == "linux":
|
||||||
|
subprocess.Popen(["./MultiMC"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
|
||||||
|
# mods
|
||||||
|
def mods():
|
||||||
|
os.chdir(INSTANCE_DIR)
|
||||||
|
|
||||||
|
if not os.path.exists(f"{INSTANCE_DIR}/downloader.zip"):
|
||||||
|
cprint("downloader.zip not found - downloading", "yellow")
|
||||||
|
r = requests.get(MOD_DOWNLOADER_URL, allow_redirects=True)
|
||||||
|
open("downloader.zip", "wb").write(r.content)
|
||||||
|
|
||||||
|
cprint("downloading mods. this may take a while, please wait.", "green")
|
||||||
|
subprocess.run(["python", "downloader.zip", "manifest.json"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
for file in glob.glob(f"{INSTANCE_DIR}/mods/*"):
|
||||||
|
name = os.path.basename(file)
|
||||||
|
shutil.move(file, os.path.join(f"{INSTANCE_DIR}/.minecraft/mods", name))
|
||||||
|
|
||||||
|
shutil.rmtree(f"{INSTANCE_DIR}/mods")
|
||||||
|
|
||||||
|
cprint("mods downloaded successfully", "green")
|
||||||
|
|
||||||
|
|
||||||
|
# multimc
|
||||||
|
def instance():
|
||||||
|
unclean = False
|
||||||
|
release = most_recent_release()
|
||||||
|
|
||||||
|
if not os.path.exists(INSTANCE_DIR):
|
||||||
|
unclean = True
|
||||||
|
cprint("instance not found - downloading", "yellow")
|
||||||
|
download_instance(release)
|
||||||
|
|
||||||
|
version = ""
|
||||||
|
if os.path.exists(f"{INSTANCE_DIR}/.version"):
|
||||||
|
f = open(f"{INSTANCE_DIR}/.version", "r")
|
||||||
|
version = f.read()
|
||||||
|
|
||||||
|
if version != release["tag_name"]:
|
||||||
|
unclean = True
|
||||||
|
cprint("new update available! - downloading", "green")
|
||||||
|
download_instance(release)
|
||||||
|
|
||||||
|
cprint("instance is up to date", "green")
|
||||||
|
return unclean
|
||||||
|
|
||||||
|
|
||||||
|
def download_instance(release: dict[str, Any]):
|
||||||
|
os.makedirs(f"{INSTANCE_DIR}/.minecraft", exist_ok=True)
|
||||||
|
|
||||||
|
TMP = tempfile.mkdtemp()
|
||||||
|
os.chdir(TMP)
|
||||||
|
|
||||||
|
download_url = get_release_asset(release)
|
||||||
|
r = requests.get(download_url, allow_redirects=True)
|
||||||
|
open("instance.zip", "wb").write(r.content)
|
||||||
|
shutil.unpack_archive("instance.zip", ".")
|
||||||
|
os.remove("instance.zip")
|
||||||
|
|
||||||
|
for file in glob.glob(f"{TMP}/overrides/*"):
|
||||||
|
if file == f"{TMP}/overrides/options.txt" and os.path.exists(f"{INSTANCE_DIR}/.minecraft/options.txt"):
|
||||||
|
continue
|
||||||
|
name = os.path.basename(file)
|
||||||
|
shutil.move(file, os.path.join(f"{INSTANCE_DIR}/.minecraft", name))
|
||||||
|
|
||||||
|
shutil.rmtree(f"{TMP}/overrides")
|
||||||
|
|
||||||
|
for file in glob.glob(f"{TMP}/*"):
|
||||||
|
name = os.path.basename(file)
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, name))
|
||||||
|
|
||||||
|
shutil.rmtree(TMP)
|
||||||
|
|
||||||
|
os.chdir(INSTANCE_DIR)
|
||||||
|
shutil.copy(
|
||||||
|
os.path.join(INSTANCE_DIR, "fishpog_pixelmon.png"), os.path.join(MULTIMC_DIR, "icons", "fishpog_pixelmon.png")
|
||||||
)
|
)
|
||||||
if input("Continue? [Y/n] ").lower() == "n":
|
|
||||||
exit()
|
f = open(".version", "w")
|
||||||
else:
|
f.write(release["tag_name"])
|
||||||
print("")
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def multimc():
|
||||||
|
if os.path.exists(MULTIMC_DIR):
|
||||||
|
return
|
||||||
|
|
||||||
|
if OS != "windows":
|
||||||
|
cprint("multimc is not installed - please install it", "red")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
os.makedirs(MULTIMC_PARENT_DIR, exist_ok=True)
|
||||||
|
os.chdir(MULTIMC_PARENT_DIR)
|
||||||
|
|
||||||
|
cprint("multimc is not installed - installing", "yellow")
|
||||||
|
r = requests.get(MULTIMC_DOWNLOAD_URL_WINDOWS, allow_redirects=True)
|
||||||
|
open("multimc.zip", "wb").write(r.content)
|
||||||
|
shutil.unpack_archive("multimc.zip", ".")
|
||||||
|
os.remove("multimc.zip")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
# releases
|
||||||
|
def most_recent_release() -> dict[str, Any]:
|
||||||
|
r = requests.get(MODPACK_RELEASES_URL)
|
||||||
|
releases: list[dict[str, Any]] = r.json()
|
||||||
|
return releases[0]
|
||||||
|
|
||||||
|
|
||||||
|
def most_recent_version(release: dict[str, Any]) -> str:
|
||||||
|
return release["tag_name"]
|
||||||
|
|
||||||
|
|
||||||
|
def get_release_asset(release: dict[str, Any]):
|
||||||
|
return release["assets"][0]["browser_download_url"]
|
||||||
|
|
||||||
|
|
||||||
# ascii art lol
|
# ascii art lol
|
||||||
|
|||||||
@@ -12,13 +12,7 @@ if ! [ -x "$(command -v java)" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that git is installed
|
# check that multimc is installed
|
||||||
if ! [ -x "$(command -v git)" ]; then
|
|
||||||
echo 'Error: git is not installed. Please install it to continue.' >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check that git is installed
|
|
||||||
if ! [ -x "$(command -v multimc)" ]; then
|
if ! [ -x "$(command -v multimc)" ]; then
|
||||||
echo 'Error: multimc is not installed. Please install it to continue.' >&2
|
echo 'Error: multimc is not installed. Please install it to continue.' >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
BIN
modpack/fishpog_pixelmon.png
Normal file
BIN
modpack/fishpog_pixelmon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
6
modpack/instance.cfg
Normal file
6
modpack/instance.cfg
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
InstanceType=OneSix
|
||||||
|
name=FishPog Pixelmon
|
||||||
|
JoinServerOnLaunch=true
|
||||||
|
JoinServerOnLaunchAddress=minecraft.233hfd.com
|
||||||
|
JoinWorldOnLaunch=true
|
||||||
|
iconKey=fishpog_pixelmon
|
||||||
38
modpack/mmc-pack.json
Normal file
38
modpack/mmc-pack.json
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"cachedName": "LWJGL 3",
|
||||||
|
"cachedVersion": "3.2.2",
|
||||||
|
"cachedVolatile": true,
|
||||||
|
"dependencyOnly": true,
|
||||||
|
"uid": "org.lwjgl3",
|
||||||
|
"version": "3.2.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cachedName": "Minecraft",
|
||||||
|
"cachedRequires": [
|
||||||
|
{
|
||||||
|
"equals": "3.2.2",
|
||||||
|
"suggests": "3.2.2",
|
||||||
|
"uid": "org.lwjgl3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cachedVersion": "1.16.5",
|
||||||
|
"uid": "net.minecraft",
|
||||||
|
"version": "1.16.5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cachedName": "Forge",
|
||||||
|
"cachedRequires": [
|
||||||
|
{
|
||||||
|
"equals": "1.16.5",
|
||||||
|
"uid": "net.minecraft"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cachedVersion": "36.2.34",
|
||||||
|
"uid": "net.minecraftforge",
|
||||||
|
"version": "36.2.34"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatVersion": 1
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ PAX_LATEST_RELEASE = f"{PAX_GITHUB}/releases/latest/download"
|
|||||||
PAX_LINUX = f"{PAX_LATEST_RELEASE}/pax"
|
PAX_LINUX = f"{PAX_LATEST_RELEASE}/pax"
|
||||||
PAX_WINDOWS = f"{PAX_LATEST_RELEASE}/pax-windows.zip"
|
PAX_WINDOWS = f"{PAX_LATEST_RELEASE}/pax-windows.zip"
|
||||||
|
|
||||||
MODPACK_GITHUB = "https://git.233hfd.com/joey/FishPogPixelmon"
|
MODPACK_GIT = "https://git.233hfd.com/joey/FishPogPixelmon"
|
||||||
MODPACK_RELEASES_URL = "https://git.233hfd.com/api/v1/repos/joey/FishPogPixelmon/releases"
|
MODPACK_RELEASES_URL = "https://git.233hfd.com/api/v1/repos/joey/FishPogPixelmon/releases"
|
||||||
|
|
||||||
|
|
||||||
@@ -74,8 +74,10 @@ def release():
|
|||||||
"tea",
|
"tea",
|
||||||
"release",
|
"release",
|
||||||
"create",
|
"create",
|
||||||
|
"-t",
|
||||||
|
f"v{version}",
|
||||||
"-a",
|
"-a",
|
||||||
".out/FishPog Pixelmon.zip",
|
".out/FishPogPixelmon.zip",
|
||||||
f"v{version}",
|
f"v{version}",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -84,7 +86,7 @@ def release():
|
|||||||
# export
|
# export
|
||||||
def export_pack():
|
def export_pack():
|
||||||
subprocess.run(["./pax", "export"])
|
subprocess.run(["./pax", "export"])
|
||||||
os.rename(".out/FishPog Pixelmon.zip", ".out/FishPog Pixelmon.zip")
|
os.rename(".out/FishPog Pixelmon.zip", ".out/FishPogPixelmon.zip")
|
||||||
|
|
||||||
|
|
||||||
# pax
|
# pax
|
||||||
|
|||||||
Reference in New Issue
Block a user