Skip to content

Commit

Permalink
Merge branch 'main' into elifoster-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
sciwhiz12 committed Feb 11, 2024
2 parents 05b24b1 + 9f1aa03 commit d9e3a50
Show file tree
Hide file tree
Showing 20 changed files with 1,049 additions and 83 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.119.0"

- name: Build
run: hugo
run: hugo -F

- uses: matyrobbrt/cloudflare-pr-previews/upload@v1
name: Upload website
with:
build-dir: ./public/
build-dir: ./public/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
public/
.hugo_build.lock
.idea
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "themes/hugo-notice"]
path = themes/hugo-notice
url = https://github.com/martignoni/hugo-notice.git
60 changes: 43 additions & 17 deletions assets/js/neoforge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,39 @@ const FORGE_GAV = 'net/neoforged/neoforge'
const LEGACY_GAV = 'net/neoforged/forge'
const LATEST_ENDPOINT = 'https://maven.neoforged.net/api/maven/latest/version/releases/'
const DOWNLOAD_URL = 'https://maven.neoforged.net/releases'
//https://maven.neoforged.net/api/maven/latest/version/releases/net%2Fneoforged%2Fneoforge?filter=20.2
// For the latest version: https://maven.neoforged.net/api/maven/latest/version/releases/net/neoforged/neoforge
// For legacy version(s): https://maven.neoforged.net/api/maven/latest/version/releases/net/neoforged/forge
// To filter a specific MC version: https://maven.neoforged.net/api/maven/latest/version/releases/net/neoforged/neoforge?filter=20.4
async function loadLatestVersions(minecraftVersions) {
for (const mcVersion of minecraftVersions) {
let gav;
let fn;
let mcvers;
if (mcVersion.startsWith("1.20.1")) {
gav = LEGACY_GAV;
fn = "forge";
mcvers = "1.20.1"
} else {
gav = FORGE_GAV;
fn = "neoforge";
mcvers = `1.${mcVersion}`
}
let currentMcVersionUrl = new URL(LATEST_ENDPOINT + encodeURIComponent(gav) + '?filter=' + encodeURIComponent(mcVersion));
let gav;
let fn;
let mcvers;
let dropDown_VAL;
let badges_beta;
let badges_new;
if (mcVersion.startsWith("1.20.1")) {
gav = LEGACY_GAV;
fn = "forge";
mcvers = "1.20.1";
badges_new = "";
badges_beta = "";
dropDown_VAL = "";
} else {
gav = FORGE_GAV;
fn = "neoforge";
badges_beta = "";
badges_new = `<font class="badges_new">NEW</font>`;
dropDown_VAL = ` open="open"`;
}

let currentMcVersionUrl;
let versionJson;
if (mcvers == "1.20.1") {
currentMcVersionUrl = new URL(LATEST_ENDPOINT + encodeURIComponent(gav) + '?filter=' + encodeURIComponent(mcVersion));
} else {
currentMcVersionUrl = new URL(LATEST_ENDPOINT + encodeURIComponent(gav));
}

try {
const response = await fetch(currentMcVersionUrl);
Expand All @@ -34,17 +50,27 @@ async function loadLatestVersions(minecraftVersions) {

if (versionJson) {
const {version} = versionJson;
if (mcVersion == "latest") {
mcvers = "1." + Array.from(version)[0] + Array.from(version)[1] + Array.from(version)[2] + Array.from(version)[3];
}
if (version.includes("beta")) {
badges_beta = `<font class="badges_beta">BETA</font>`;
}

const vs = `#filelist${mcVersion}`.split('.').join("");
const installerUrl = `${DOWNLOAD_URL}/${gav}/${encodeURIComponent(version)}/${fn}-${encodeURIComponent(version)}-installer.jar`;
const changelogUrl = `${DOWNLOAD_URL}/${gav}/${encodeURIComponent(version)}/${fn}-${encodeURIComponent(version)}-changelog.txt`;

document.querySelector(vs).innerHTML = `
<div class="fileinfo__header">NeoForge ${version} for Minecraft ${mcvers}</div>
<details${dropDown_VAL}>
<summary class="fileinfo__header">${badges_beta} ${badges_new} NeoForge ${version} for Minecraft ${mcvers}</summary>
<div class="fileinfo__body">
<a href="${installerUrl}"><span class="fileinfo__icon"><i class="bi-file-earmark-zip-fill" style="font-size: 2rem;"></i></span>
<span class="fileinfo__content"><span>Latest <em>NeoForge</em> Installer</span><span>${fn}-${version}-installer.jar</span></span></a>
<span class="fileinfo__content"><span>Latest <em>NeoForge</em> Installer</span><span>${fn}-${version}-installer.jar</span></span></a>
<a href="${changelogUrl}"><span class="fileinfo__icon"><i class="bi-file-earmark-text-fill" style="font-size: 2rem;"></i></span>
<span class="fileinfo__content"><span>Latest Changelog</span><span>${version}</span></span></a>
<span class="fileinfo__content"><span>Latest Changelog</span><span>${version}</span></span></a>
</div>
</details>
`;
}
}
Expand Down
24 changes: 3 additions & 21 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ description: |
# NeoForge installer files
You can find a direct link to our latest installer files below.

{{< files "latest" >}}
{{< files "1.20.1" >}}

Note: this file is still called forge because we're trying to maintain compatibility with launchers,
assuming they don't hardcode things too much.

## The new version is here

{{<files "20.2" >}}
{{< versions >}}

# Using NeoForge for mod development

Expand All @@ -29,20 +24,7 @@ assuming they don't hardcode things too much.
2. Clone this project locally, and get started! Our [Documentation] and the [Modding Wiki] are great places to learn more.

## If you have an existing mod project
You can use neoforge in your existing mod development as well. To do so:
1. Update your repositories to use `https://maven.neoforged.net/releases` instead of `https://maven.minecraftforge.net`
2. Update your ForgeGradle to use NeoGradle 6.0.13 or above:
```
plugins {
...
id 'net.neoforged.gradle' version '[6.0.13, 6.2)'
}
```
3. Update your `minecraft` dependency to use `net.neoforged:forge` and the version as shown above.

### Some things to note
1. At the present time, mods built by either system should be intercompatible between forks.
2. Do note that recently, there were some changes in the recommended way to use ForgeGradle/NeoGradle. Note especially the way that `settings.gradle` has changed, as well as the removal of the `buildscript` section in `build.gradle`. Refer to [The MDK] for an example and more.
Refer to [The MDK] for an example of how to update your build script to use NeoForge.

[The MDK]: https://github.com/neoforged/MDK
[Documentation]: https://docs.neoforged.net
Expand Down
Loading

1 comment on commit d9e3a50

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: d9e3a503eec750bdce29a132187714a035478a83
Status: ✅ Deploy successful!
Preview URL: https://ad917b2c.neoforged-website-previews.pages.dev
PR Preview URL: https://pr-20.neoforged-website-previews.pages.dev

Please sign in to comment.