feat: add support for the minecraft BCC mod (#429)

This commit is contained in:
CosminPerRam 2023-12-03 04:40:45 +02:00 committed by GitHub
parent 266db8c6a0
commit 26ea510312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@
### 4.3.0
* Fix `Post Scriptum` not being on the valve protocol.
* Fix `Epic` protocol's `numplayers` not being in the `raw` field.
* Added support for the Minecraft [Better Compatibility Checker](https://www.curseforge.com/minecraft/mc-mods/better-compatibility-checker) Mod.
### 4.2.0
* Renamed `Counter Strike: 2D` to `CS2D` in [games.txt](games.txt) (why? see [this](https://cs2d.com/faq.php?show=misc_name#misc_name)).

View File

@ -42,7 +42,7 @@ class MinecraftVanilla extends Core {
const str = reader.rest().toString('utf8');
this.debugLog(str);
const json = JSON.parse(str);
const json = JSON.parse(str.substring(0, strLen));
delete json.favicon;
state.raw = json;
@ -63,6 +63,16 @@ class MinecraftVanilla extends Core {
for (let i = state.players.length; i < Math.min(json.players.online, 10000); i++) {
state.players.push({});
}
// Better Compatibility Checker mod support
let bccJson = {}
if (str.length > strLen) {
const bccStr = str.substring(strLen + 1);
bccJson = JSON.parse(bccStr);
}
state.raw.bcc = bccJson;
}
varIntBuffer(num) {