Skip to content

Commit

Permalink
Add server section
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 committed Aug 7, 2024
1 parent c300aeb commit 54da5e3
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 109 deletions.
8 changes: 0 additions & 8 deletions _sass/fabric.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,4 @@ p {
object-fit: cover;
}
}
}

.container {
background-color: #161B22;
width: 100%;
padding: 24px;

border-radius: 10px;
}
15 changes: 10 additions & 5 deletions download.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ topnav: true

# Download Fabric Loader

You can select the Minecraft and Fabric Loader versions in the installer, which works for all supported versions; it will install Fabric Loader and add it as a profile to your Minecraft Launcher. For more details, see the [Fabric Documentation - Installing Fabric page](https://docs.fabricmc.net/players/installing-fabric).
You can select the Minecraft and Fabric Loader versions in the installer, which works for all supported versions; it will install Fabric Loader and add it as a profile to your Minecraft Launcher.

<noscript style="color:red">You need Javascript to show the Download button.</noscript>
<div class="fabric-component" data-component="Download"></div>
Expand All @@ -16,10 +16,16 @@ You can select the Minecraft and Fabric Loader versions in the installer, which
<script type="text/javascript" src="{{ "/scripts/main.js" | relative_url | append: cacheBust }}"></script>
<link href="{{ "/scripts/style.css" | relative_url | append: cacheBust }}" rel="stylesheet">

<div style="text-align: center;">
<b>Make sure to follow the <a href="https://docs.fabricmc.net/players/installing-fabric">installation instructions!</a></b>
</div>

## Using a Third-Party Launcher? {#third-party-launcher}

These third-party launchers have their own installation process for Fabric Loader, consider checking out the relevant documentation for the launcher you are using:

<!-- Todo: link to our own guides. -->

<div class="button-group horizontal">
<a class="button secondary" href="https://support.modrinth.com/en/articles/8827653-installing-updating-mod-loaders-and-game-versions" target="_blank"><img class="button-icon" src="/assets/external/modrinth-app.png"><span>Modrinth App</span></a>
<a class="button secondary" href="https://support.curseforge.com/en/support/solutions/articles/9000196904-creating-a-custom-profile" target="_blank"><img class="button-icon" src="/assets/external/cf_app_icon.png"><span>CurseForge App</span></a>
Expand All @@ -36,8 +42,7 @@ _Is your Launcher not in this list? Consider adding it to the website's [GitHub

### Minecraft Server {#server}

To create a Minecraft server with Fabric mods, use the universal jar installer above to install a server instance on your current system, or use the Fabric Server Launcher, which wraps the vanilla server jar with Fabric Loader - useful for dedicated servers.

<div class="container">
To create a Minecraft server with Fabric mods, use the universal jar installer to set up a server on your system, or the Fabric Server Launcher, which wraps the vanilla server jar with Fabric Loader for dedicated servers. The executable jar is a small launcher that starts the Fabric-enabled Minecraft server using the specified versions, eliminating the need for an installer.

</div>
<noscript style="color:red">You need Javascript to show the Server Executable Download button.</noscript>
<div class="fabric-component" data-component="Server"></div>
233 changes: 137 additions & 96 deletions scripts/src/lib/Server.svelte
Original file line number Diff line number Diff line change
@@ -1,111 +1,130 @@
<script lang="ts">
import {getGameVersions, getInstallerVersions, getLoaderVersions} from "./Api";
import DownloadIcon from "./DownloadIcon.svelte";
let gameVersion: string | undefined;
let loaderVersion: string | undefined;
let installerVersion: string | undefined;
$: serverJarUrl = `https://meta.fabricmc.net/v2/versions/loader/${gameVersion}/${loaderVersion}/${installerVersion}/server/jar`;
$: serverJarFilename = `fabric-server-mc.${gameVersion}-loader.${loaderVersion}-launcher.${installerVersion}.jar`
$: installerJarUrl = `https://maven.fabricmc.net/net/fabricmc/fabric-installer/${installerVersion}/fabric-installer-${installerVersion}.jar`;
let versions = Promise.all([getGameVersions(), getLoaderVersions(), getInstallerVersions()])
.then(([gameVersions, loaderVersions, installerVersions]) => {
const versions = {
game: gameVersions,
loader: loaderVersions.filter((v) => {
const split = v.version.split(".")
return parseInt(split[0]) > 0 || parseInt(split[1]) >= 12 // 0.12.0 loader or newer
}),
installer: installerVersions.filter((v) => {
const split = v.version.split(".")
return parseInt(split[0]) > 0 || parseInt(split[1]) >= 8 // 0.8.0 installer or newer
})
};
// Populates the default version with the latest stable, or latest if none are stable.
gameVersion = (versions.game.find((v) => v.stable) || versions.game[0]).version;
loaderVersion = (versions.loader.find((v) => v.stable) || versions.loader[0]).version;
installerVersion = (versions.installer.find((v) => v.stable) || versions.installer[0]).version;
return versions;
})
import {
getGameVersions,
getInstallerVersions,
getLoaderVersions,
} from "./Api";
import DownloadIcon from "./DownloadIcon.svelte";
let gameVersion: string | undefined;
let loaderVersion: string | undefined;
let installerVersion: string | undefined;
$: serverJarUrl = `https://meta.fabricmc.net/v2/versions/loader/${gameVersion}/${loaderVersion}/${installerVersion}/server/jar`;
$: serverJarFilename = `fabric-server-mc.${gameVersion}-loader.${loaderVersion}-launcher.${installerVersion}.jar`;
$: installerJarUrl = `https://maven.fabricmc.net/net/fabricmc/fabric-installer/${installerVersion}/fabric-installer-${installerVersion}.jar`;
let versions = Promise.all([
getGameVersions(),
getLoaderVersions(),
getInstallerVersions(),
]).then(([gameVersions, loaderVersions, installerVersions]) => {
const versions = {
game: gameVersions,
loader: loaderVersions.filter((v) => {
const split = v.version.split(".");
return parseInt(split[0]) > 0 || parseInt(split[1]) >= 12; // 0.12.0 loader or newer
}),
installer: installerVersions.filter((v) => {
const split = v.version.split(".");
return parseInt(split[0]) > 0 || parseInt(split[1]) >= 8; // 0.8.0 installer or newer
}),
};
// Populates the default version with the latest stable, or latest if none are stable.
gameVersion = (versions.game.find((v) => v.stable) || versions.game[0])
.version;
loaderVersion = (
versions.loader.find((v) => v.stable) || versions.loader[0]
).version;
installerVersion = (
versions.installer.find((v) => v.stable) || versions.installer[0]
).version;
return versions;
});
</script>

<main>
{#await versions}
<p>Loading versions..</p>
{:then data}

<div class="download">
<div class="form-line">
<label for="minecraft-version">Minecraft Version:</label>
<select id="minecraft-version" bind:value={gameVersion} style="min-width: 200px">
{#each data.game as version}
<option value={version.version}>{version.version}</option>
{/each}
</select>
{#await versions}
<p>Loading versions..</p>
{:then data}
<div class="input-group">
<div class="form-line">
<label for="minecraft-version">Minecraft Version:</label>
<select
id="minecraft-version"
bind:value={gameVersion}
style="min-width: 200px"
>
{#each data.game as version}
<option value={version.version}>{version.version}</option>
{/each}
</select>
</div>

<div class="form-line">
<label for="loader-version">Fabric Loader Version:</label>
<select
id="loader-version"
bind:value={loaderVersion}
style="min-width: 200px"
>
{#each data.loader as version}
<option value={version.version}>{version.version}</option>
{/each}
</select>
</div>

<div class="form-line">
<label for="installer-version">Installer Version:</label>
<select
id="installer-version"
bind:value={installerVersion}
style="min-width: 200px"
>
{#each data.installer as version}
<option value={version.version}>{version.version}</option>
{/each}
</select>
</div>

<div class="download">
<a class="button primary" href={serverJarUrl}
><DownloadIcon />Executable Server (.jar)</a
>
</div>
</div>

<div class="form-line">
<label for="loader-version">Fabric Loader Version:</label>
<select id="loader-version" bind:value={loaderVersion} style="min-width: 200px">
{#each data.loader as version}
<option value={version.version}>{version.version}</option>
{/each}
</select>
<div style="margin-bottom: 15px;">
<p>
You can use the following command to download the latest server jar,
useful if you're on a headless server or want to automate the process.
</p>
<code>
curl -OJ {serverJarUrl}
</code>
</div>

<div class="form-line">
<label for="installer-version">Installer Version:</label>
<select id="installer-version" bind:value={installerVersion} style="min-width: 200px">
{#each data.installer as version}
<option value={version.version}>{version.version}</option>
{/each}
</select>
</div>
<div style="margin-bottom: 15px;">
<p>Use the following command to run the executable server launcher with 2GB of ram. After a small wait the Minecraft server will be ready.</p>
<code>
java -Xmx2G -jar {serverJarFilename} nogui
</code>
</div>

<div class="download">
<a class="button primary large" href={serverJarUrl}><DownloadIcon />Executable Server (.jar)</a>
</div>
<hr />
{:catch error}
<p style="color: red">Error: {error.message}</p>
<p>
<a href={installerJarUrl}>
Download installer for older versions or manual installation
</a>
For support please visit one of our
<a href="/discuss/">community discussion</a>
groups.
</p>
</div>

<p>The executable jar is a small launcher that will start the Fabric enabled Minecraft server using the versions specified above. There is no need to use an installer when using this method.</p>

<div style="margin-bottom: 15px;">
<h4>CLI download:</h4>
<p>Use the following command to download the executable server launcher to the current directory</p>
<code>
curl -OJ {serverJarUrl}
</code>
</div>

<div style="margin-bottom: 15px;">
<h4>Launch command:</h4>
<p>Use the following command to run the executable server launcher with 2GB of ram. After a small wait the Minecraft server will be ready.</p>
<code>
java -Xmx2G -jar {serverJarFilename} nogui
</code>
</div>

{:catch error}
<p style="color: red">Error: {error.message}</p>
<p>
For support please visit one of our
<a href="/discuss/">community discussion</a>
groups.
</p>
{/await}

{/await}
</main>

<style>
<style scoped>
code {
display: inline-block;
width: 100%;
Expand All @@ -114,4 +133,26 @@
white-space: nowrap;
user-select: all;
}
</style>
.download {
margin-top: auto;
margin-bottom: auto;
}
.form-line {
text-align: center;
}
.input-group {
display: flex;
flex-direction: row;
justify-content: space-between;
}
/* On mobile, make the form lines stack */
@media (max-width: 1075px) {
.input-group {
flex-direction: column;
}
}
</style>

0 comments on commit 54da5e3

Please sign in to comment.