@thomasfarineau/anvil 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,113 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://anvil.dev/config.schema.json",
4
+ "title": "Anvil Launcher Config",
5
+ "description": "Configuration file for an Anvil Minecraft launcher (config.json)",
6
+ "type": "object",
7
+ "required": ["instances"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": {
11
+ "type": "string",
12
+ "description": "JSON schema URL for validation",
13
+ "default": "./node_modules/anvil/src/client/config.schema.json"
14
+ },
15
+ "identifier": {
16
+ "type": "string",
17
+ "description": "Reverse-domain app identifier (e.g. com.mycompany.mylauncher). Used by Tauri to name the installed bundle.",
18
+ "default": ""
19
+ },
20
+ "target": {
21
+ "type": "string",
22
+ "description": "Output directory for compiled executables/installers (relative to project root). Defaults to src-anvil/target/ when empty.",
23
+ "default": ""
24
+ },
25
+ "app_name": {
26
+ "type": "string",
27
+ "description": "Native window title",
28
+ "default": "HomeLauncher"
29
+ },
30
+ "data_folder": {
31
+ "type": "string",
32
+ "description": "Subfolder name inside %APPDATA% / ~/Library used to store game files",
33
+ "default": "HomeLauncher"
34
+ },
35
+ "java_version": {
36
+ "type": "integer",
37
+ "enum": [17, 21],
38
+ "description": "Java version to download and use",
39
+ "default": 21
40
+ },
41
+ "update_url": {
42
+ "type": "string",
43
+ "description": "URL of the update manifest (leave empty to disable auto-update)"
44
+ },
45
+ "logo": {
46
+ "type": "string",
47
+ "description": "Path (relative to src/) or URL of the branding logo displayed in the UI"
48
+ },
49
+ "session": {
50
+ "type": "string",
51
+ "enum": ["none", "mojang", "custom"],
52
+ "description": "Authentication mode. 'none': offline. 'custom': client calls MC.setSession() before launch.",
53
+ "default": "none"
54
+ },
55
+ "window_decorations": {
56
+ "type": "boolean",
57
+ "description": "Show native window title bar and borders",
58
+ "default": true
59
+ },
60
+ "window_resizable": {
61
+ "type": "boolean",
62
+ "description": "Allow the user to resize the launcher window",
63
+ "default": false
64
+ },
65
+ "instances": {
66
+ "type": "array",
67
+ "description": "List of Minecraft instances available in the launcher",
68
+ "minItems": 1,
69
+ "items": {
70
+ "type": "object",
71
+ "required": ["id", "name", "mc_version"],
72
+ "additionalProperties": false,
73
+ "properties": {
74
+ "id": {
75
+ "type": "string",
76
+ "description": "Unique identifier for this instance (used as folder name)"
77
+ },
78
+ "name": {
79
+ "type": "string",
80
+ "description": "Display name shown on the play button"
81
+ },
82
+ "mc_version": {
83
+ "type": "string",
84
+ "description": "Minecraft version (e.g. \"1.21.4\")"
85
+ },
86
+ "loader": {
87
+ "type": "string",
88
+ "enum": ["", "fabric", "forge", "neoforge", "quilt"],
89
+ "description": "Mod loader to install alongside Minecraft",
90
+ "default": ""
91
+ },
92
+ "loader_version": {
93
+ "type": "string",
94
+ "description": "Mod loader version (e.g. \"0.16.9\" for Fabric)",
95
+ "default": ""
96
+ },
97
+ "server_ip": {
98
+ "type": "string",
99
+ "description": "Server IP to auto-connect to on launch",
100
+ "default": ""
101
+ },
102
+ "server_port": {
103
+ "type": "integer",
104
+ "minimum": 1,
105
+ "maximum": 65535,
106
+ "description": "Server port",
107
+ "default": 25565
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,95 @@
1
+ export interface InstanceConfig {
2
+ id: string;
3
+ name: string;
4
+ mc_version: string;
5
+ loader: string;
6
+ loader_version: string;
7
+ server_ip: string;
8
+ server_port: number;
9
+ }
10
+
11
+ export interface LauncherConfig {
12
+ identifier: string;
13
+ app_name: string;
14
+ target: string;
15
+ data_folder: string;
16
+ java_version: number;
17
+ update_url: string;
18
+ logo: string;
19
+ session: 'none' | 'mojang' | 'custom';
20
+ window_decorations: boolean;
21
+ window_resizable: boolean;
22
+ instances: InstanceConfig[];
23
+ }
24
+
25
+ export interface CustomSession {
26
+ username: string;
27
+ uuid: string;
28
+ access_token: string;
29
+ }
30
+
31
+ export interface Settings {
32
+ username: string;
33
+ launcher_dir: string | null;
34
+ max_memory: number;
35
+ }
36
+
37
+ export interface InstanceStatus {
38
+ id: string;
39
+ name: string;
40
+ installed: boolean;
41
+ }
42
+
43
+ export interface InitStatus {
44
+ launcher_dir: string;
45
+ java_ok: boolean;
46
+ instances: InstanceStatus[];
47
+ }
48
+
49
+ export interface SetupProgress {
50
+ step: string;
51
+ current: number;
52
+ total: number;
53
+ label: string;
54
+ error: boolean;
55
+ }
56
+
57
+ export interface GameOutput {
58
+ instance_id: string;
59
+ text: string;
60
+ stderr: boolean;
61
+ }
62
+
63
+ export interface GameExit {
64
+ instance_id: string;
65
+ code: number;
66
+ }
67
+
68
+ export interface UpdateInfo {
69
+ version: string;
70
+ url: string;
71
+ notes: string;
72
+ }
73
+
74
+ export declare const MC: {
75
+ getConfig(): Promise<LauncherConfig>;
76
+ getSettings(): Promise<Settings>;
77
+ saveSettings(s: Settings): Promise<void>;
78
+ getDefaultDir(): Promise<string>;
79
+ getInitStatus(): Promise<InitStatus>;
80
+ runSetup(): Promise<void>;
81
+ verify(instanceId: string): Promise<void>;
82
+ play(instanceId: string): Promise<void>;
83
+ checkUpdate(): Promise<UpdateInfo | null>;
84
+ doUpdate(url: string): Promise<void>;
85
+ setSession(session: CustomSession): Promise<void>;
86
+ clearSession(): Promise<void>;
87
+ close(): Promise<void>;
88
+ on: {
89
+ setupProgress(cb: (p: SetupProgress) => void): Promise<() => void>;
90
+ setupDone(cb: () => void): Promise<() => void>;
91
+ gameStarting(cb: (instanceId: string) => void): Promise<() => void>;
92
+ gameOutput(cb: (o: GameOutput) => void): Promise<() => void>;
93
+ gameExit(cb: (e: GameExit) => void): Promise<() => void>;
94
+ };
95
+ };
@@ -0,0 +1,31 @@
1
+ [package]
2
+ name = "{{name}}"
3
+ version = "1.0.0"
4
+ description = "Minecraft Launcher"
5
+ authors = []
6
+ edition = "2021"
7
+
8
+ [lib]
9
+ name = "app_lib"
10
+ crate-type = ["staticlib", "cdylib", "rlib"]
11
+
12
+ [[bin]]
13
+ name = "{{name}}"
14
+ path = "src/main.rs"
15
+
16
+ [build-dependencies]
17
+ tauri-build = { version = "2", features = [] }
18
+
19
+ [dependencies]
20
+ serde_json = "1.0"
21
+ serde = { version = "1.0", features = ["derive"] }
22
+ log = "0.4"
23
+ tauri = { version = "2", features = [] }
24
+ tauri-plugin-log = "2"
25
+ reqwest = { version = "0.12", features = ["json", "stream"] }
26
+ futures-util = "0.3"
27
+ dirs = "5"
28
+ zip = "2"
29
+ tar = "0.4"
30
+ flate2 = "1"
31
+ chrono = "0.4"
@@ -0,0 +1,3 @@
1
+ fn main() {
2
+ tauri_build::build()
3
+ }