An autistic fork because I didn't liked the og code. (For now, just redoing the Microsoft module, maybe I will redo the whole code later).
[!NOTE] Most extra parameters use the original minecraft-java-core defaults, so migrating to mc-java-core-333 is seamless and compatible. To get the highest possible optimization offered by this fork check the full list of improvements.
-
Microsoft
- Implemented switch statement.
- Removed unnecessary logic.
- Added more intuitive errorTypes.
- XboxAccount value is now optional (a whole auth request just for 3 vars (?)).
- Added doIncludeXboxAccount param (default: true).
- xsts login now includes better error messages in case of XErr code.
- xsts login now returns error properly in case of XErr code.
- getAuth()
- Added doRemoveCookies param (default: true).
- Added fetchJSON function with improved logic (place-holder until I update the whole fork [11 commits behind at the moment of writing]).
- Added HTTP 429 error handler.
-
ForgeMC
- downloadLibraries()
- Removed unnecessary logic.
- Added better check event emitter feedback.
- Priority is given to downloading from the official links first, if provided, and then from the mirrors (instead of the other way around).
- Fixed not reaching on error event.
- Re-downloading for corrupted/incomplete libraries.
- patchForge()
- General improvements.
- Fixed not reaching on error event.
- downloadLibraries()
-
FabricMC
- downloadJson()
-
Forced fabric metadata request to use IPv4 (to prevent ETIMEDOUT in some clients).Discarded - Added retry metadata request with mirrors.
-
- downloadJson()
-
Loader
- install()
- Improved if conditionals with just an object.
- forge()
- General improvements.
- install()
-
download
-
Added IPv4Agent constant here so it is reusable in other loaders.Discarded
- checkMirror()
- Minor changes.
- Added check if response.size is an actual number.
-
-
forgePatcher
- patcher()
- General improvements.
- Fixed not emitting error event when failing to read jar manifest.
- check()
- Minor changes.
- setArgument()
- Minor changes.
- computePath()
- Minor changes.
- readJarManifest()
- Minor changes.
- patcher()
-
src\utils\Index.ts
- getFileFromArchive()
- Improved info in case of error.
- skipLibrary()
- Minor changes.
- loader()
- Implemented switch statement.
- getFileFromArchive()
npm i mc-java-core-333
Require library
const { Launch, Mojang } = require('mc-java-core-333');
const { Mojang, Launch } = require('mc-java-core-333');
const launch = new Launch();
async function main() {
let opt = {
url: 'https://launcher.luuxis.fr/files/?instance=PokeMoonX',
authenticator: await Mojang.login('Benjas333'),
timeout: 10000,
path: './Minecraft',
instance: 'PokeMoonX',
version: '1.20.4',
detached: false,
intelEnabledMac: true,
downloadFileMultiple: 30,
loader: {
path: '',
type: 'forge',
build: 'latest',
enable: true
},
verify: true,
ignored: [
'config',
'essential',
'logs',
'resourcepacks',
'saves',
'screenshots',
'shaderpacks',
'W-OVERFLOW',
'options.txt',
'optionsof.txt'
],
JVM_ARGS: [],
GAME_ARGS: [],
java: {
path: null,
version: null,
type: 'jre',
},
screen: {
width: 1500,
height: 900
},
memory: {
min: '4G',
max: '6G'
}
}
await launch.Launch(opt);
launch.on('extract', extract => {
console.log(extract);
});
launch.on('progress', (progress, size, element) => {
console.log(`Downloading ${element} ${Math.round((progress / size) * 100)}%`);
});
launch.on('check', (progress, size, element) => {
console.log(`Checking ${element} ${Math.round((progress / size) * 100)}%`);
});
launch.on('estimated', (time) => {
let hours = Math.floor(time / 3600);
let minutes = Math.floor((time - hours * 3600) / 60);
let seconds = Math.floor(time - hours * 3600 - minutes * 60);
console.log(`${hours}h ${minutes}m ${seconds}s`);
})
launch.on('speed', (speed) => {
console.log(`${(speed / 1067008).toFixed(2)} Mb/s`)
})
launch.on('patch', patch => {
console.log(patch);
});
launch.on('data', (e) => {
console.log(e);
})
launch.on('close', code => {
console.log(code);
});
launch.on('error', err => {
console.log(err);
});
}
main()