Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3ae3fe83d | ||
|
|
9bea47ca50 | ||
|
|
3707ff5551 | ||
|
|
3cb9b47004 | ||
|
|
8373c48de8 | ||
|
|
b885e5e3b3 | ||
|
|
1e9379636d | ||
|
|
7682582364 | ||
|
|
be1db9d555 | ||
|
|
6e38527fcc | ||
|
|
1a41f832e4 | ||
|
|
3aeb275a65 | ||
|
|
2e74130b2e |
@@ -14,7 +14,7 @@ if (-not (Get-Command "python" -ErrorAction SilentlyContinue)) {
|
|||||||
|
|
||||||
if ($winget) {
|
if ($winget) {
|
||||||
Write-Host "Attempting to install python."
|
Write-Host "Attempting to install python."
|
||||||
winget install --id=Python.Python.3.11 -e
|
(winget install --id=Python.Python.3.11 -e) | Out-Null
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "Please install python to continue." -Foreground Red
|
Write-Host "Please install python to continue." -Foreground Red
|
||||||
@@ -23,12 +23,12 @@ if (-not (Get-Command "python" -ErrorAction SilentlyContinue)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check that java is installed
|
# Check that java is installed
|
||||||
if (-not (Get-Command "java" -ErrorAction SilentlyContinue)) {
|
if (-not (Get-Command "C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin\java" -ErrorAction SilentlyContinue)) {
|
||||||
Write-Host "Error: java is not installed." -Foreground Red
|
Write-Host "Error: java is not installed." -Foreground Red
|
||||||
|
|
||||||
if ($winget) {
|
if ($winget) {
|
||||||
Write-Host "Attempting to install java."
|
Write-Host "Attempting to install java."
|
||||||
winget install AdoptOpenJDK.OpenJDK.11
|
(winget install AdoptOpenJDK.OpenJDK.11) | Out-Null
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "Please install java to continue." -Foreground Red
|
Write-Host "Please install java to continue." -Foreground Red
|
||||||
@@ -37,31 +37,9 @@ 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\Scripts\Activate.ps1
|
||||||
|
|
||||||
(python -m pip install --upgrade pip) | Out-Null
|
(python -m pip install --upgrade pip) | Out-Null
|
||||||
(python -m pip install -r requirements.txt) | Out-Null
|
(python -m pip install -r requirements.txt) | Out-Null
|
||||||
|
|||||||
206
client/client.py
206
client/client.py
@@ -1,27 +1,211 @@
|
|||||||
#!/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/Joshyx/ModpackDownloader/releases/download/v1.3/ModpackDownloader-1.3.jar"
|
||||||
|
|
||||||
|
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 = ""
|
||||||
|
INSTANCE_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"
|
||||||
|
INSTANCE_DIR = f"{MULTIMC_DIR}/instances/FishPogPixelmon"
|
||||||
|
|
||||||
|
if OS == "win32":
|
||||||
|
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 input("Continue? [Y/n] ").lower() == "n":
|
if OS == "win32":
|
||||||
exit()
|
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(os.path.join(INSTANCE_DIR, "downloader.jar")):
|
||||||
|
cprint("downloader.jar not found - downloading", "yellow")
|
||||||
|
r = requests.get(MOD_DOWNLOADER_URL, allow_redirects=True)
|
||||||
|
open("downloader.jar", "wb").write(r.content)
|
||||||
|
|
||||||
|
cprint("downloading mods. this may take a while, please wait.", "green")
|
||||||
|
|
||||||
|
my_env = os.environ.copy()
|
||||||
|
my_env["CURSEFORGE_API_KEY"] = "$2a$10$QbCxI6f4KxEs50QKwE2piu1t6oOA8ayOw27H9N/eaH3Sdp5NTWwvO"
|
||||||
|
|
||||||
|
os.makedirs(os.path.join(INSTANCE_DIR, "mods"))
|
||||||
|
if OS != "win32":
|
||||||
|
subprocess.run(["java", "-jar", "downloader.jar", ".", "mods"], env=my_env)
|
||||||
else:
|
else:
|
||||||
print("")
|
subprocess.run(
|
||||||
|
[
|
||||||
|
"C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.11.9-hotspot\\bin\\java",
|
||||||
|
"-jar",
|
||||||
|
"downloader.jar",
|
||||||
|
".",
|
||||||
|
"mods",
|
||||||
|
],
|
||||||
|
env=my_env,
|
||||||
|
)
|
||||||
|
|
||||||
|
for file in glob.glob(os.path.join(INSTANCE_DIR, ".minecraft", "mods", "*")):
|
||||||
|
if (
|
||||||
|
os.path.basename(file) == "OptiFine_1.16.5_HD_U_G8.jar"
|
||||||
|
or os.path.basename(file) == "TrainerCommands-1.16.5-2.6.0.jar"
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
os.remove(file)
|
||||||
|
|
||||||
|
for file in glob.glob(os.path.join(INSTANCE_DIR, "mods", "mods", "*")):
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, ".minecraft", "mods", os.path.basename(file)))
|
||||||
|
|
||||||
|
os.makedirs(os.path.join(INSTANCE_DIR, ".minecraft", "resourcepacks"), exist_ok=True)
|
||||||
|
for file in glob.glob(os.path.join(INSTANCE_DIR, "mods", "resourcepacks", "*")):
|
||||||
|
if os.path.exists(os.path.join(INSTANCE_DIR, ".minecraft", "resourcepacks", os.path.basename(file))):
|
||||||
|
continue
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, ".minecraft", "resourcepacks", os.path.basename(file)))
|
||||||
|
|
||||||
|
shutil.rmtree(os.path.join(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(os.path.join(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(os.path.join(TMP, "overrides", "*")):
|
||||||
|
if file == os.path.join(TMP, "overrides", "options.txt") and os.path.exists(
|
||||||
|
os.path.join(INSTANCE_DIR, ".minecraft", "options.txt")
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
if os.path.exists(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file))):
|
||||||
|
if os.path.isdir(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file))):
|
||||||
|
shutil.rmtree(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file)))
|
||||||
|
else:
|
||||||
|
os.remove(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file)))
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file)))
|
||||||
|
|
||||||
|
shutil.rmtree(os.path.join(TMP, "overrides"))
|
||||||
|
|
||||||
|
for file in glob.glob(os.path.join(TMP, "*")):
|
||||||
|
if os.path.exists(os.path.join(INSTANCE_DIR, os.path.basename(file))):
|
||||||
|
if os.path.isdir(os.path.join(INSTANCE_DIR, os.path.basename(file))):
|
||||||
|
shutil.rmtree(os.path.join(INSTANCE_DIR, os.path.basename(file)))
|
||||||
|
else:
|
||||||
|
os.remove(os.path.join(INSTANCE_DIR, os.path.basename(file)))
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, os.path.basename(file)))
|
||||||
|
|
||||||
|
os.chdir(INSTANCE_DIR)
|
||||||
|
if not os.path.exists(os.path.join(MULTIMC_DIR, "icons", "fishpog_pixelmon.png")):
|
||||||
|
os.makedirs(os.path.join(MULTIMC_DIR, "icons"), exist_ok=True)
|
||||||
|
shutil.copy(
|
||||||
|
os.path.join(INSTANCE_DIR, "fishpog_pixelmon.png"),
|
||||||
|
os.path.join(MULTIMC_DIR, "icons", "fishpog_pixelmon.png"),
|
||||||
|
)
|
||||||
|
|
||||||
|
f = open(".version", "w")
|
||||||
|
f.write(release["tag_name"])
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def multimc():
|
||||||
|
if os.path.exists(MULTIMC_DIR):
|
||||||
|
return
|
||||||
|
|
||||||
|
if OS != "win32":
|
||||||
|
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
|
||||||
@@ -23,6 +23,34 @@
|
|||||||
"name": "JourneyMap"
|
"name": "JourneyMap"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 55438,
|
||||||
|
"fileID": 3346467,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "MrCrayfish's Furniture Mod"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"projectID": 74072,
|
||||||
|
"fileID": 3695126,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "Tinkers Construct",
|
||||||
|
"dependencies": [
|
||||||
|
74924
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"projectID": 74924,
|
||||||
|
"fileID": 3631982,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "Mantle",
|
||||||
|
"explicit": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 223852,
|
"projectID": 223852,
|
||||||
"fileID": 3776277,
|
"fileID": 3776277,
|
||||||
@@ -31,6 +59,22 @@
|
|||||||
"name": "Storage Drawers"
|
"name": "Storage Drawers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 225608,
|
||||||
|
"fileID": 3172951,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "WorldEdit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"projectID": 228756,
|
||||||
|
"fileID": 3543538,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "Iron Chests"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 233342,
|
"projectID": 233342,
|
||||||
"fileID": 3216206,
|
"fileID": 3216206,
|
||||||
@@ -66,6 +110,14 @@
|
|||||||
"name": "Just Enough Items (JEI)"
|
"name": "Just Enough Items (JEI)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 245755,
|
||||||
|
"fileID": 3515707,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "Waystones"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 247560,
|
"projectID": 247560,
|
||||||
"fileID": 4024011,
|
"fileID": 4024011,
|
||||||
@@ -98,6 +150,18 @@
|
|||||||
"name": "Simple Storage Network"
|
"name": "Simple Storage Network"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 314905,
|
||||||
|
"fileID": 3802698,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "FTB Ranks (Forge)",
|
||||||
|
"dependencies": [
|
||||||
|
404465,
|
||||||
|
419699
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 328085,
|
"projectID": 328085,
|
||||||
"fileID": 3536025,
|
"fileID": 3536025,
|
||||||
@@ -117,6 +181,14 @@
|
|||||||
"name": "Pam's HarvestCraft 2 - Crops"
|
"name": "Pam's HarvestCraft 2 - Crops"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 361579,
|
||||||
|
"fileID": 3767277,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "spark"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 365460,
|
"projectID": 365460,
|
||||||
"fileID": 3281234,
|
"fileID": 3281234,
|
||||||
@@ -125,6 +197,17 @@
|
|||||||
"name": "Pam's HarvestCraft 2 - Trees"
|
"name": "Pam's HarvestCraft 2 - Trees"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 367706,
|
||||||
|
"fileID": 4503125,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "FancyMenu [Forge]",
|
||||||
|
"dependencies": [
|
||||||
|
410295
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 372534,
|
"projectID": 372534,
|
||||||
"fileID": 3190867,
|
"fileID": 3190867,
|
||||||
@@ -160,6 +243,47 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"projectID": 404465,
|
||||||
|
"fileID": 3553840,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "FTB Library (Forge)",
|
||||||
|
"explicit": false,
|
||||||
|
"dependencies": [
|
||||||
|
419699
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"projectID": 410295,
|
||||||
|
"fileID": 4514901,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "Konkrete [Forge]",
|
||||||
|
"explicit": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"projectID": 410811,
|
||||||
|
"fileID": 3510643,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "FTB Essentials (Forge)",
|
||||||
|
"dependencies": [
|
||||||
|
404465
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"projectID": 419699,
|
||||||
|
"fileID": 4521290,
|
||||||
|
"required": true,
|
||||||
|
"__meta": {
|
||||||
|
"name": "Architectury API (Fabric/Forge)",
|
||||||
|
"explicit": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"projectID": 486392,
|
"projectID": 486392,
|
||||||
"fileID": 3535459,
|
"fileID": 3535459,
|
||||||
|
|||||||
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
|
||||||
|
}
|
||||||
BIN
modpack/overrides/mods/TrainerCommands-1.16.5-2.6.0.jar
Normal file
BIN
modpack/overrides/mods/TrainerCommands-1.16.5-2.6.0.jar
Normal file
Binary file not shown.
1
server/.jabbarc
Normal file
1
server/.jabbarc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
openjdk@1.11.0-2
|
||||||
193
server/server.py
Normal file
193
server/server.py
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os, sys, shutil, requests, tempfile, glob, subprocess
|
||||||
|
from termcolor import cprint
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
OS = sys.platform
|
||||||
|
|
||||||
|
MOD_DOWNLOADER_URL = "https://github.com/Joshyx/ModpackDownloader/releases/download/v1.3/ModpackDownloader-1.3.jar"
|
||||||
|
FORGE_URL = (
|
||||||
|
"https://maven.minecraftforge.net/net/minecraftforge/forge/1.16.5-36.2.34/forge-1.16.5-36.2.34-installer.jar"
|
||||||
|
)
|
||||||
|
FORGE_JAR = "forge-1.16.5-36.2.34.jar"
|
||||||
|
MODPACK_RELEASES_URL = "https://git.233hfd.com/api/v1/repos/joey/FishPogPixelmon/releases?limit=1"
|
||||||
|
|
||||||
|
INSTANCE_DIR = os.path.join(str(os.getenv("HOME")), "pixelmon")
|
||||||
|
|
||||||
|
|
||||||
|
# main
|
||||||
|
def __main__():
|
||||||
|
header()
|
||||||
|
needs_mods = instance()
|
||||||
|
if needs_mods:
|
||||||
|
mods()
|
||||||
|
forge()
|
||||||
|
launch()
|
||||||
|
|
||||||
|
|
||||||
|
# launcher
|
||||||
|
def launch():
|
||||||
|
if input("launch server? [Y/n] ").lower() == "n":
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
os.chdir(f"{INSTANCE_DIR}/.minecraft")
|
||||||
|
subprocess.run(["java", "-Xmx30720M", "-Xms1024M", "-jar", FORGE_JAR, "--nogui"])
|
||||||
|
|
||||||
|
|
||||||
|
# forge
|
||||||
|
def forge():
|
||||||
|
os.makedirs(f"{INSTANCE_DIR}/.minecraft", exist_ok=True)
|
||||||
|
os.chdir(f"{INSTANCE_DIR}/.minecraft")
|
||||||
|
|
||||||
|
if os.path.exists(os.path.join(f"{INSTANCE_DIR}/.minecraft", "forge-installer.jar")):
|
||||||
|
return
|
||||||
|
|
||||||
|
cprint("forge-installer.jar not found - downloading", "yellow")
|
||||||
|
r = requests.get(FORGE_URL, allow_redirects=True)
|
||||||
|
open("forge-installer.jar", "wb").write(r.content)
|
||||||
|
cprint("installing forge", "green")
|
||||||
|
|
||||||
|
subprocess.run(["java", "-jar", "forge-installer.jar", "--installServer"])
|
||||||
|
|
||||||
|
f = open("eula.txt", "w")
|
||||||
|
f.write("eula=true")
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
# mods
|
||||||
|
def mods():
|
||||||
|
os.chdir(INSTANCE_DIR)
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(INSTANCE_DIR, "downloader.zip")):
|
||||||
|
cprint("downloader.jar not found - downloading", "yellow")
|
||||||
|
r = requests.get(MOD_DOWNLOADER_URL, allow_redirects=True)
|
||||||
|
open("downloader.jar", "wb").write(r.content)
|
||||||
|
|
||||||
|
cprint("downloading mods. this may take a while, please wait.", "green")
|
||||||
|
|
||||||
|
my_env = os.environ.copy()
|
||||||
|
my_env["CURSEFORGE_API_KEY"] = "$2a$10$QbCxI6f4KxEs50QKwE2piu1t6oOA8ayOw27H9N/eaH3Sdp5NTWwvO"
|
||||||
|
|
||||||
|
os.makedirs(os.path.join(INSTANCE_DIR, "mods"))
|
||||||
|
subprocess.run(["java", "-jar", "downloader.jar", ".", "mods"], env=my_env)
|
||||||
|
|
||||||
|
for file in glob.glob(os.path.join(INSTANCE_DIR, ".minecraft", "mods", "*")):
|
||||||
|
if os.path.basename(file) == "TrainerCommands-1.16.5-2.6.0.jar":
|
||||||
|
continue
|
||||||
|
os.remove(file)
|
||||||
|
|
||||||
|
for file in glob.glob(os.path.join(INSTANCE_DIR, "mods", "mods", "*")):
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, ".minecraft", "mods", os.path.basename(file)))
|
||||||
|
|
||||||
|
shutil.rmtree(os.path.join(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(os.path.join(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(os.path.join(TMP, "overrides", "*")):
|
||||||
|
if file == os.path.join(TMP, "overrides", "options.txt") and os.path.exists(
|
||||||
|
os.path.join(INSTANCE_DIR, ".minecraft", "options.txt")
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
if os.path.exists(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file))):
|
||||||
|
if os.path.isdir(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file))):
|
||||||
|
shutil.rmtree(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file)))
|
||||||
|
else:
|
||||||
|
os.remove(os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file)))
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, ".minecraft", os.path.basename(file)))
|
||||||
|
|
||||||
|
shutil.rmtree(os.path.join(TMP, "overrides"))
|
||||||
|
|
||||||
|
for file in glob.glob(os.path.join(TMP, "*")):
|
||||||
|
if os.path.exists(os.path.join(INSTANCE_DIR, os.path.basename(file))):
|
||||||
|
if os.path.isdir(os.path.join(INSTANCE_DIR, os.path.basename(file))):
|
||||||
|
shutil.rmtree(os.path.join(INSTANCE_DIR, os.path.basename(file)))
|
||||||
|
else:
|
||||||
|
os.remove(os.path.join(INSTANCE_DIR, os.path.basename(file)))
|
||||||
|
shutil.move(file, os.path.join(INSTANCE_DIR, os.path.basename(file)))
|
||||||
|
|
||||||
|
os.chdir(INSTANCE_DIR)
|
||||||
|
|
||||||
|
f = open(".version", "w")
|
||||||
|
f.write(release["tag_name"])
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
def header():
|
||||||
|
cprint(
|
||||||
|
"""
|
||||||
|
_______ __ __ _______
|
||||||
|
| _ ||__|.-----.| |--.| _ |.-----..-----.
|
||||||
|
|. 1___|| ||__ --|| ||. 1 || _ || _ |
|
||||||
|
|. __) |__||_____||__|__||. ____||_____||___ |
|
||||||
|
|: | |: | |_____|
|
||||||
|
|::.| |::.|
|
||||||
|
`---' `---'
|
||||||
|
|
||||||
|
_______ __ __
|
||||||
|
| _ ||__|.--.--..-----.| |.--------..-----..-----.
|
||||||
|
|. 1 || ||_ _|| -__|| || || _ || |
|
||||||
|
|. ____||__||__.__||_____||__||__|__|__||_____||__|__|
|
||||||
|
|: |
|
||||||
|
|::.|
|
||||||
|
`---'
|
||||||
|
""",
|
||||||
|
"green",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# run app
|
||||||
|
__main__()
|
||||||
22
server/server.sh
Executable file
22
server/server.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# check that python is installed
|
||||||
|
if ! [ -x "$(command -v python)" ]; then
|
||||||
|
echo 'Error: python is not installed. Please install it to continue.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check that java is installed
|
||||||
|
if ! [ -x "$(command -v java)" ]; then
|
||||||
|
echo 'Error: java is not installed. Please install it to continue.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -d .venv ]; then python -m venv .venv; fi
|
||||||
|
|
||||||
|
source .venv/bin/activate &>/dev/null
|
||||||
|
|
||||||
|
python -m pip install --upgrade pip &>/dev/null
|
||||||
|
python -m pip install -r ../client/requirements.txt &>/dev/null
|
||||||
|
|
||||||
|
python ./server.py
|
||||||
30
tooling.py
30
tooling.py
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os, sys, argparse, tempfile, subprocess, shutil, requests
|
import os, sys, argparse, tempfile, subprocess, shutil, requests, zipfile
|
||||||
from git.repo import Repo
|
from git.repo import Repo
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@ parser = argparse.ArgumentParser(description="a helper script for liightninggod
|
|||||||
|
|
||||||
parser.add_argument("--export", "-e", help="export modpack zip", action="store_true")
|
parser.add_argument("--export", "-e", help="export modpack zip", action="store_true")
|
||||||
parser.add_argument("--release", "-r", help="release modpack version", action="store_true")
|
parser.add_argument("--release", "-r", help="release modpack version", action="store_true")
|
||||||
|
parser.add_argument("--client", "-c", help="export modpack client as a zip file", action="store_true")
|
||||||
parser.add_argument("--setup", "-s", help="setup project and install dependencies", action="store_true")
|
parser.add_argument("--setup", "-s", help="setup project and install dependencies", action="store_true")
|
||||||
parser.add_argument("--force", "-f", help="forces things when needed, like redoing setup", action="store_true")
|
parser.add_argument("--force", "-f", help="forces things when needed, like redoing setup", action="store_true")
|
||||||
parser.add_argument("--build-pax", help="builds pax from source, even if on a supported platform", action="store_true")
|
parser.add_argument("--build-pax", help="builds pax from source, even if on a supported platform", action="store_true")
|
||||||
@@ -20,7 +21,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"
|
||||||
|
|
||||||
|
|
||||||
@@ -39,12 +40,27 @@ def __main__():
|
|||||||
elif args.release:
|
elif args.release:
|
||||||
release()
|
release()
|
||||||
return
|
return
|
||||||
|
elif args.client:
|
||||||
|
print("exporting modpack client")
|
||||||
|
export_client()
|
||||||
|
return
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"no command provided. pass the -h flag to see commands for tooling, or run ./pax to interact with the modpack's files"
|
"no command provided. pass the -h flag to see commands for tooling, or run ./pax to interact with the modpack's files"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# client
|
||||||
|
def export_client():
|
||||||
|
z = zipfile.ZipFile(".out/FishPogPixelmonClient.zip", "w", zipfile.ZIP_DEFLATED)
|
||||||
|
z.write("client/README.md", "README.md")
|
||||||
|
z.write("client/client.ps1", "client.ps1")
|
||||||
|
z.write("client/client.sh", "client.sh")
|
||||||
|
z.write("client/requirements.txt", "requirements.txt")
|
||||||
|
z.write("client/client.py", "client.py")
|
||||||
|
z.close()
|
||||||
|
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
def setup_pack():
|
def setup_pack():
|
||||||
pax()
|
pax()
|
||||||
@@ -74,8 +90,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 +102,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
|
||||||
@@ -106,7 +124,7 @@ def pax():
|
|||||||
os.chmod("pax", 0o755)
|
os.chmod("pax", 0o755)
|
||||||
return
|
return
|
||||||
|
|
||||||
if OS == "windows":
|
if OS == "win32":
|
||||||
print("downloading and extracting pax for windows...")
|
print("downloading and extracting pax for windows...")
|
||||||
r = requests.get(PAX_WINDOWS, allow_redirects=True)
|
r = requests.get(PAX_WINDOWS, allow_redirects=True)
|
||||||
open("pax-windows.zip", "wb").write(r.content)
|
open("pax-windows.zip", "wb").write(r.content)
|
||||||
@@ -116,7 +134,7 @@ def pax():
|
|||||||
|
|
||||||
|
|
||||||
def pax_from_source():
|
def pax_from_source():
|
||||||
if OS == "windows":
|
if OS == "win32":
|
||||||
cprint("building from source not supported on windows yet", "red")
|
cprint("building from source not supported on windows yet", "red")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|||||||
2
venv.ps1
2
venv.ps1
@@ -12,7 +12,7 @@ if (-Not (Test-Path "./.venv")) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Activate the virtual environment
|
# Activate the virtual environment
|
||||||
. ./.venv/bin/Activate.ps1
|
. .\.venv\Scripts\Activate.ps1
|
||||||
|
|
||||||
# Install required packages
|
# Install required packages
|
||||||
& $python -m pip install --upgrade pip
|
& $python -m pip install --upgrade pip
|
||||||
|
|||||||
Reference in New Issue
Block a user