Skip to content

Fabric ​

The fabric plugin, from @opys/minecraft.

Fabric, for any Minecraft version Fabric supports.

js
// opys.config.mjs
export default defineConfig({
  plugins: [
    fabric({ version: '1.21.4' }),
    java({ version: '21' }),
  ],
  manifest: {
    command: '@fabric.command',
    args: [
      '@fabric.jvmArgs',
      '@fabric.mainClass',
      '@fabric.gameArgs',
    ],
    workdir: '${game_directory}',
  },
});

Use it instead of minecraft. A loader brings the game with it.

Options ​

OptionWhat it does
versionWhich build. See below.
loaderA Fabric loader version. Left out: the newest stable one.
sourceA mirror of Fabric Meta.
manifestBaseA mirror of Mojang's version list.
librariesLibraries to add or replace.

version ​

A plain Minecraft version. Fabric has no aliases.

js
fabric({ version: '1.21.4' }); // the newest stable Fabric loader
fabric({ version: '1.21.4', loader: '0.16.10' }); // a pinned one

Without loader, the newest stable loader is used, so it can change between builds. Pin it for a pack that never moves.

What it adds ​

Everything Vanilla Minecraft adds, with these differences.

KindWhat
FilesThe Fabric loader and its libraries, on top of the game's.
Launchcommand, jvmArgs, mainClass, gameArgs.
VariablesThe same as vanilla.
EnvironmentNone.

Each one below: what it is, and how it ends up in the manifest.

Files · Fabric libraries ​

The Fabric loader and what it needs, from Fabric's server.

js
// opys.config.mjs
export default defineConfig({
  plugins: [
    fabric({ version: '1.21.4' }),
    java({ version: '21' }),
  ],
  manifest: {
    command: '@fabric.command',
    args: [
      '@fabric.jvmArgs',
      '@fabric.mainClass',
      '@fabric.gameArgs',
    ],
    workdir: '${game_directory}',
  },
});
jsonc
// in the manifest
{
  "path": "${library_directory}/net/fabricmc/fabric-loader/0.19.5/fabric-loader-0.19.5.jar",
  "source": { "url": "https://maven.fabricmc.net/net/fabricmc/fabric-loader/0.19.5/fabric-loader-0.19.5.jar" }
}

Launch ​

The vanilla command line with Fabric's main class, and one line telling Fabric which class the real game is.

js
// opys.config.mjs
export default defineConfig({
  plugins: [
    fabric({ version: '1.21.4' }),
    java({ version: '21' }),
  ],
  manifest: {
    command: '@fabric.command',
    args: [
      '@fabric.jvmArgs',
      '@fabric.mainClass',
      '@fabric.gameArgs',
    ],
    workdir: '${game_directory}',
  },
});
jsonc
// in the manifest
"launch": {
  // '@fabric.command'
  "command": "${java_bin}",
  "args": [
    // '@fabric.jvmArgs'
    // … the vanilla JVM arguments, then:
    "-cp",
    "${classpath}",
    "-DFabricMcEmu= net.minecraft.client.main.Main ",
    // '@fabric.mainClass'
    "net.fabricmc.loader.impl.launch.knot.KnotClient",
    // '@fabric.gameArgs'
    "--username", "${auth_player_name}",
    "--version", "${version_name}"
    // … the vanilla game arguments
  ],
  "workdir": "${game_directory}"
}
You writeBecomes
'@fabric.command'The program to run: whatever Java the pack has.
'@fabric.jvmArgs'Arguments for Java itself, ending with the classpath.
'@fabric.mainClass'The class to start. One argument.
'@fabric.gameArgs'Arguments for the game: who is playing, and where things are.

Variables ​

The same names as vanilla. classpath now has this loader's libraries ahead of the game's.

js
// opys.config.mjs
export default defineConfig({
  plugins: [
    fabric({ version: '1.21.4' }),
    java({ version: '21' }),
  ],
  manifest: {
    command: '@fabric.command',
    args: [
      '@fabric.jvmArgs',
      '@fabric.mainClass',
      '@fabric.gameArgs',
    ],
    workdir: '${game_directory}',
  },
});
jsonc
// in the manifest
"vars": {
  "game_directory": "${root}/",
  "library_directory": "${root}/libraries",
  // … the rest, as in vanilla
}

Nothing runs on the player's machine before the game. Fabric has no install step.

Good to know ​