Skip to content

@loontail/minecraft-kit / targetPaths

Variable: targetPaths

ts
const targetPaths: {
  assetIndex: (root, indexId) => string;
  assetLegacy: (root, virtualPath) => string;
  assetObject: (root, hash) => string;
  assetResource: (root, virtualPath) => string;
  assetsDir: (root) => string;
  assetsLegacyDir: (root) => string;
  assetVirtual: (root, virtualPath) => string;
  forgeInstaller: (root, mavenVersion) => string;
  librariesDir: (root) => string;
  libraryFile: (root, libraryPath) => string;
  loggingConfig: (root, id) => string;
  nativesDir: (root, versionId) => string;
  runtimeJavaExecutable: (directory, component, os, installRoot?) => string;
  runtimeRoot: (directory, component, installRoot?) => string;
  runtimesDir: (root) => string;
  versionDir: (root, versionId) => string;
  versionJar: (root, versionId) => string;
  versionJson: (root, versionId) => string;
  versionsDir: (root) => string;
};

Defined in: src/core/paths.ts:39

Helpers for the per-target Minecraft directory layout. Use these to derive paths to a specific file (versions/<id>/<id>.jar, assets/objects/<aa>/<sha1>, …) consistently with what the install and verify runners write/expect.

Type Declaration

NameTypeDescriptionDefined in
assetIndex()(root, indexId) => string-src/core/paths.ts:52
assetLegacy()(root, virtualPath) => string-src/core/paths.ts:58
assetObject()(root, hash) => string-src/core/paths.ts:54
assetResource()(root, virtualPath) => string-src/core/paths.ts:60
assetsDir()(root) => string-src/core/paths.ts:47
assetsLegacyDir()(root) => string-src/core/paths.ts:48
assetVirtual()(root, virtualPath) => string-src/core/paths.ts:56
forgeInstaller()(root, mavenVersion) => string-src/core/paths.ts:79
librariesDir()(root) => string-src/core/paths.ts:46
libraryFile()(root, libraryPath) => string-src/core/paths.ts:50
loggingConfig()(root, id) => string-src/core/paths.ts:62
nativesDir()(root, versionId) => string-src/core/paths.ts:63
runtimeJavaExecutable()(directory, component, os, installRoot?) => string-src/core/paths.ts:73
runtimeRoot()(directory, component, installRoot?) => stringPath to a runtime component's root directory. Honours installRoot (custom global runtime location) when present; otherwise falls back to <directory>/runtime/<component>.src/core/paths.ts:69
runtimesDir()(root) => string-src/core/paths.ts:49
versionDir()(root, versionId) => string-src/core/paths.ts:41
versionJar()(root, versionId) => string-src/core/paths.ts:42
versionJson()(root, versionId) => string-src/core/paths.ts:44
versionsDir()(root) => string-src/core/paths.ts:40

Example

ts
import { targetPaths } from "@loontail/minecraft-kit";

const jar = targetPaths.versionJar(target.directory, target.minecraft.version);
const java = targetPaths.runtimeJavaExecutable(
  target.directory,
  target.runtime.component,
  target.runtime.system.os,
  target.runtime.installRoot,
);

MIT License