From a380d39865bc905636f2356411aa47be1be89d47 Mon Sep 17 00:00:00 2001 From: Norbiros Date: Sat, 10 Aug 2024 22:46:42 +0200 Subject: [PATCH] feat(frontend): Package datapack as NeoForge mod (#2142) --- apps/frontend/src/helpers/package.js | 16 ++++++++++++++++ .../src/pages/[type]/[id]/version/[version].vue | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/helpers/package.js b/apps/frontend/src/helpers/package.js index 931cfef9e..70120fb30 100644 --- a/apps/frontend/src/helpers/package.js +++ b/apps/frontend/src/helpers/package.js @@ -119,6 +119,16 @@ export const createDataPackVersion = async function ( forgeModsToml.issueTrackerURL = project.issues_url; } + const neoModsToml = { + ...forgeModsToml, + modLoader: "javafml", + loaderVersion: "[1,)", + mods: forgeModsToml.mods.map((mod) => ({ + ...mod, + updateJSONURL: mod.updateJSONURL + "?neoforge=only", + })), + }; + const primaryFileData = await (await fetch(primaryFile.url)).blob(); const primaryZipReader = new JSZip(); @@ -133,6 +143,12 @@ export const createDataPackVersion = async function ( if (loaders.includes("forge")) { primaryZipReader.file("META-INF/mods.toml", TOML.stringify(forgeModsToml, { newline: "\n" })); // eslint-disable-line import/no-named-as-default-member } + if (loaders.includes("neoforge")) { + primaryZipReader.file( + "META-INF/neoforge.mods.toml", + TOML.stringify(neoModsToml, { newline: "\n" }), // eslint-disable-line import/no-named-as-default-member + ); + } if (!newForge && loaders.includes("forge")) { const classFile = new Uint8Array( diff --git a/apps/frontend/src/pages/[type]/[id]/version/[version].vue b/apps/frontend/src/pages/[type]/[id]/version/[version].vue index 31507f40e..a280867b7 100644 --- a/apps/frontend/src/pages/[type]/[id]/version/[version].vue +++ b/apps/frontend/src/pages/[type]/[id]/version/[version].vue @@ -27,13 +27,13 @@
@@ -901,7 +901,7 @@ export default defineNuxtComponent({ newFileTypes: [], - packageLoaders: ["forge", "fabric", "quilt"], + packageLoaders: ["forge", "fabric", "quilt", "neoforge"], showKnownErrors: false, shouldPreventActions: false,