summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/docs/handbook/launcherjava.md
blob: 0ce795e4b8972e3c4505f663f2a654fa33d9031f (plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# LauncherJava `launcherjava/`

> **Location**: `launcherjava/`  
> **Language**: Java  
> **Purpose**: Minecraft launching component
> **Latest Version**: 0.0.5-1

---

## Overview

LauncherJava is the Java-based component responsible for actually launching Minecraft. It acts as an intermediary between the C++ launcher and the Minecraft JVM process.

---

## How It Works

```
┌─────────────┐      ┌──────────────┐     ┌─────────────┐
│  ProjT      │────▶│ LauncherJava │────▶│  Minecraft  │
│  Launcher   │      │   (Java)     │     │    JVM      │
│  (C++)      │      │              │     │             │
└─────────────┘      └──────────────┘     └─────────────┘
      │                    │
      │   stdin            │   exec
      │   (script)         │   (launch)
      ▼                    ▼
```

### Launch Sequence

1. C++ launcher sends launch script via stdin
2. LauncherJava parses the script
3. Waits for `launcher` command
4. Executes Minecraft with configured parameters

---

## Launch Script Format

The launcher communicates via a text-based protocol:

```text
mod legacyjavafixer-1.0
mainClass net.minecraft.launchwrapper.Launch
param --username
param PlayerName
param --version
param ProjT Launcher
param --gameDir
param /path/to/minecraft
param --assetsDir
param /path/to/assets
param --assetIndex
param 1.20.4
param --uuid
param xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
param --accessToken
param [TOKEN]
param --userType
param msa
windowTitle ProjT Launcher: Instance Name
windowParams 854x480
userName PlayerName
sessionId token:[TOKEN]:[UUID]
launcher standard
```

### Commands

| Command | Description |
|---------|-------------|
| `mod <name>` | Load a mod (tweaker) |
| `mainClass <class>` | Set main class |
| `param <value>` | Add launch parameter |
| `windowTitle <title>` | Set window title |
| `windowParams <WxH>` | Set window size |
| `userName <name>` | Player username |
| `sessionId <id>` | Session identifier |
| `launcher <type>` | Execute launch |
| `abort` | Cancel launch |

---

## Launcher Types

| Type | Use Case |
|------|----------|
| `standard` | All Minecraft versions (recommended) |
| `legacy` | Minecraft < 1.6 (deprecated) |

### Differences

- **Standard**: Universal launcher, works with all versions
- **Legacy**: Supports custom window icon/title but only for old versions

---

## Building

LauncherJava is built as part of the main CMake build:

```bash
# Built automatically with main project
cmake --build build

# Or build separately
cd launcherjava
./gradlew build
```

---

## Debugging

### Enable Debug Output

```text
debug on
mainClass ...
```

### Attach Profiler

Since LauncherJava waits for the `launcher` command, you can:

1. Start LauncherJava
2. Attach your profiler (VisualVM, JProfiler, etc.)
3. Send the `launcher` command

---

## License

Available under **GPL-3.0** (with classpath exception), sublicensed from its original **Apache-2.0** codebase.

---

## Related Documentation

- [Program Info](./program_info.md) — Application identity
- [JavaCheck](./javacheck.md) — Java detection