Skip to content

Commit

Permalink
feat(frontend): Package datapack as NeoForge mod (#2142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbiros authored Aug 10, 2024
1 parent 34d3310 commit a380d39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions apps/frontend/src/helpers/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/pages/[type]/[id]/version/[version].vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
<multiselect
id="package-mod-loaders"
v-model="packageLoaders"
:options="['fabric', 'forge', 'quilt']"
:options="['fabric', 'forge', 'quilt', 'neoforge']"
:custom-label="(value) => value.charAt(0).toUpperCase() + value.slice(1)"
:multiple="true"
:searchable="false"
:show-no-results="false"
:show-labels="false"
placeholder="Choose loaders.."
placeholder="Choose loaders..."
open-direction="top"
/>
<div class="button-group">
Expand Down Expand Up @@ -901,7 +901,7 @@ export default defineNuxtComponent({
newFileTypes: [],
packageLoaders: ["forge", "fabric", "quilt"],
packageLoaders: ["forge", "fabric", "quilt", "neoforge"],
showKnownErrors: false,
shouldPreventActions: false,
Expand Down

0 comments on commit a380d39

Please sign in to comment.