aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/patchmc
blob: 4b23cc9d12118857dc1f30366cd764cc146ae552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/node

var fs = require('fs');
var path = require('path');

var profilesPath = path.join(process.env.HOME, '/.minecraft/launcher_profiles.json');
var profiles = require(profilesPath);

var def = "-Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M";
var patch = " -Dorg.lwjgl.librarypath=\"/home/loek/.minecraft\""

for (var profile in profiles.profiles) {
	var javaArgs = profiles.profiles[profile].javaArgs
	profiles.profiles[profile].javaArgs = javaArgs ? (javaArgs.includes(patch) ? javaArgs : javaArgs + patch) : (def + patch);
}

fs.writeFileSync(profilesPath, JSON.stringify(profiles, null, 4))