summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgenerateForge.py13
-rw-r--r--generateNeoForge.py13
-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
6 files changed, 28 insertions, 24 deletions
diff --git a/generateForge.py b/generateForge.py
index c233f948fc..067a392ad6 100755
--- a/generateForge.py
+++ b/generateForge.py
@@ -14,7 +14,7 @@ from meta.common.forge import (
STATIC_LEGACYINFO_FILE,
INSTALLER_INFO_DIR,
BAD_VERSIONS,
- FORGEWRAPPER_MAVEN,
+ FORGEWRAPPER_LIBRARY,
)
from meta.common.mojang import MINECRAFT_COMPONENT
from meta.model import (
@@ -287,16 +287,7 @@ def version_from_build_system_installer(
v.libraries = []
- wrapper_lib = Library(
- name=GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "mmc2")
- )
- wrapper_lib.downloads = MojangLibraryDownloads()
- wrapper_lib.downloads.artifact = MojangArtifact(
- url=FORGEWRAPPER_MAVEN % (wrapper_lib.name.path()),
- sha1="4ee5f25cc9c7efbf54aff4c695da1054c1a1d7a3",
- size=34444,
- )
- v.libraries.append(wrapper_lib)
+ v.libraries.append(FORGEWRAPPER_LIBRARY)
for upstream_lib in installer.libraries:
forge_lib = Library.parse_obj(upstream_lib.dict())
diff --git a/generateNeoForge.py b/generateNeoForge.py
index 0e45e808bb..781fdce1fe 100644
--- a/generateNeoForge.py
+++ b/generateNeoForge.py
@@ -12,7 +12,7 @@ from meta.common.neoforge import (
VERSION_MANIFEST_DIR,
DERIVED_INDEX_FILE,
INSTALLER_INFO_DIR,
- FORGEWRAPPER_MAVEN,
+ FORGEWRAPPER_LIBRARY,
)
from meta.common.mojang import MINECRAFT_COMPONENT
from meta.model import (
@@ -89,16 +89,7 @@ def version_from_build_system_installer(
v.libraries = []
- wrapper_lib = Library(
- name=GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "1.5.6-prism")
- )
- wrapper_lib.downloads = MojangLibraryDownloads()
- wrapper_lib.downloads.artifact = MojangArtifact(
- url=FORGEWRAPPER_MAVEN % (wrapper_lib.name.path()),
- sha1="b059aa8c4d2508055c6ed2a2561923a5e670a5eb",
- size=34860,
- )
- v.libraries.append(wrapper_lib)
+ v.libraries.append(FORGEWRAPPER_LIBRARY)
for upstream_lib in installer.libraries:
forge_lib = Library.parse_obj(upstream_lib.dict())
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))