summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-17 16:26:12 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-17 16:26:12 +0200
commit4b38e79f8e69a21f69bac0af1209e129f64749d0 (patch)
tree6ad7be8a6bf68afe535b93a5b50f47d2d345c9d5 /meta
parent48d04ea67e6d4efab346ff383b294bf878d02003 (diff)
downloadProject-Tick-4b38e79f8e69a21f69bac0af1209e129f64749d0.tar.gz
Project-Tick-4b38e79f8e69a21f69bac0af1209e129f64749d0.zip
refactor: define global forgewrapper library
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'meta')
-rw-r--r--meta/common/__init__.py2
-rw-r--r--meta/common/forge.py8
-rw-r--r--meta/common/neoforge.py8
-rw-r--r--meta/model/__init__.py8
4 files changed, 24 insertions, 2 deletions
diff --git a/meta/common/__init__.py b/meta/common/__init__.py
index 7a6514b2be..454a2cfeb8 100644
--- a/meta/common/__init__.py
+++ b/meta/common/__init__.py
@@ -6,6 +6,8 @@ import requests
from cachecontrol import CacheControl
from cachecontrol.caches import FileCache
+LAUNCHER_MAVEN = "https://files.prismlauncher.org/maven/%s"
+
def serialize_datetime(dt: datetime.datetime):
if dt.tzinfo is None:
diff --git a/meta/common/forge.py b/meta/common/forge.py
index be626599ff..d8828036bd 100644
--- a/meta/common/forge.py
+++ b/meta/common/forge.py
@@ -1,5 +1,7 @@
from os.path import join
+from ..model import GradleSpecifier, make_launcher_library
+
BASE_DIR = "forge"
JARS_DIR = join(BASE_DIR, "jars")
@@ -13,5 +15,9 @@ STATIC_LEGACYINFO_FILE = join(BASE_DIR, "forge-legacyinfo.json")
FORGE_COMPONENT = "net.minecraftforge"
-FORGEWRAPPER_MAVEN = "https://files.prismlauncher.org/maven/%s"
+FORGEWRAPPER_LIBRARY = make_launcher_library(
+ GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "mmc2"),
+ "4ee5f25cc9c7efbf54aff4c695da1054c1a1d7a3",
+ 34444,
+)
BAD_VERSIONS = ["1.12.2-14.23.5.2851"]
diff --git a/meta/common/neoforge.py b/meta/common/neoforge.py
index 079933008a..3af76b9a21 100644
--- a/meta/common/neoforge.py
+++ b/meta/common/neoforge.py
@@ -1,5 +1,7 @@
from os.path import join
+from ..model import GradleSpecifier, make_launcher_library
+
BASE_DIR = "neoforge"
JARS_DIR = join(BASE_DIR, "jars")
@@ -11,4 +13,8 @@ DERIVED_INDEX_FILE = join(BASE_DIR, "derived_index.json")
NEOFORGE_COMPONENT = "net.neoforged"
-FORGEWRAPPER_MAVEN = "https://files.prismlauncher.org/maven/%s"
+FORGEWRAPPER_LIBRARY = make_launcher_library(
+ GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "1.5.6-prism"),
+ "b059aa8c4d2508055c6ed2a2561923a5e670a5eb",
+ 34860,
+)
diff --git a/meta/model/__init__.py b/meta/model/__init__.py
index 14b054e5d2..68cd034f1b 100644
--- a/meta/model/__init__.py
+++ b/meta/model/__init__.py
@@ -7,6 +7,7 @@ import pydantic
from pydantic import Field, validator
from ..common import (
+ LAUNCHER_MAVEN,
serialize_datetime,
replace_old_launchermeta_url,
get_all_bases,
@@ -330,3 +331,10 @@ class MetaPackage(Versioned):
authors: Optional[List[str]]
description: Optional[str]
project_url: Optional[str] = Field(alias="projectUrl")
+
+
+def make_launcher_library(
+ name: GradleSpecifier, hash: str, size: int, maven=LAUNCHER_MAVEN
+):
+ artifact = MojangArtifact(url=maven % name.path(), sha1=hash, size=size)
+ return Library(name=name, downloads=MojangLibraryDownloads(artifact=artifact))