aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/ui/src/types/bindings/game-version.ts
blob: 1b1c395b5ac7526509a383e2ab832c18154c79e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export type Arguments = {
  game: Record<string, unknown>;
  jvm: Record<string, unknown>;
};

export type AssetIndex = {
  id: string;
  sha1: string;
  size: bigint;
  url: string;
  totalSize: bigint | null;
};

export type DownloadArtifact = {
  sha1: string | null;
  size: bigint | null;
  url: string;
  path: string | null;
};

export type Downloads = {
  client: DownloadArtifact;
  server: DownloadArtifact | null;
};

/**
 * Represents a Minecraft version JSON, supporting both vanilla and modded (Fabric/Forge) formats.
 * Modded versions use `inheritsFrom` to reference a parent vanilla version.
 */
export type GameVersion = {
  id: string;
  /**
   * Optional for mod loaders that inherit from vanilla
   */
  downloads: Downloads | null;
  /**
   * Optional for mod loaders that inherit from vanilla
   */
  assetIndex: AssetIndex | null;
  libraries: Array<Library>;
  mainClass: string;
  minecraftArguments: string | null;
  arguments: Arguments | null;
  javaVersion: JavaVersion | null;
  /**
   * For mod loaders: the vanilla version this inherits from
   */
  inheritsFrom: string | null;
  /**
   * Fabric/Forge may specify a custom assets version
   */
  assets: string | null;
  /**
   * Release type (release, snapshot, old_beta, etc.)
   */
  type: string | null;
};

export type JavaVersion = { component: string; majorVersion: bigint };

export type Library = {
  downloads: LibraryDownloads | null;
  name: string;
  rules: Array<Rule> | null;
  natives: Record<string, unknown>;
  /**
   * Maven repository URL for mod loader libraries
   */
  url: string | null;
};

export type LibraryDownloads = {
  artifact: DownloadArtifact | null;
  classifiers: Record<string, unknown>;
};

export type OsRule = {
  name: string | null;
  version: string | null;
  arch: string | null;
};

export type Rule = {
  action: string;
  os: OsRule | null;
  features: Record<string, unknown>;
};