Skip to content

Commit ac510be

Browse files
authored
Merge pull request #151 from lunaynx/fix/fabric-log-parsing
fix: detect Fabric client logs after launcher preamble
2 parents 790d402 + 8fcabd1 commit ac510be

5 files changed

Lines changed: 2079 additions & 2 deletions

File tree

src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function getDetectors(): array
1414
{
1515
return [
1616
(new MultiPatternDetector())
17-
->addPattern('#^\[[\d:]+\] \[main\/INFO\](?:\:| \(FabricLoader/GameProvider\)) Loading Minecraft [^ \n]+ with Fabric Loader [^ \n]+#')
17+
->addPattern('/' . static::getLoadingMinecraftPattern() . '/m')
1818
->addPattern('#^\[[\d:]+\] \[(?:Render thread|main)\/INFO\](?:\:| \((?:net\.minecraft\.client\.)?Minecraft\)) Setting user: \w+#m')
1919
];
2020
}

src/Log/Minecraft/Vanilla/Fabric/FabricLog.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@ abstract class FabricLog extends VanillaLog
1919
public static function getDetectors(): array
2020
{
2121
return array_merge(parent::getDetectors(), [
22-
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . '(?:\(FabricLoader\/GameProvider\) )?Loading Minecraft ' . VanillaVersionInformation::getVersionPattern() . ' with Fabric Loader/m'),
22+
(new SinglePatternDetector())->setPattern('/' . static::getLoadingMinecraftPattern() . '/m'),
2323
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . '[[(]FabricLoader[\])] Loading \d+ mods:/m'),
2424
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . 'A critical error occurred\nnet.fabricmc.loader/m'),
2525
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . 'Found new data pack Fabric Mods, loading it automatically$/m'),
2626
(new SinglePatternDetector())->setPattern('/^' . static::$prefixPattern . 'Reloading ResourceManager: Default, Fabric Mods \(Fabric Tool Attribute API/m')
2727
]);
2828
}
2929

30+
protected static function getLoadingMinecraftPattern(): string
31+
{
32+
return '^' . static::$prefixPattern . '(?:\(FabricLoader\/GameProvider\) )?Loading Minecraft '
33+
. VanillaVersionInformation::getVersionPattern() . ' with Fabric Loader(?: [^ \n]+)?';
34+
}
35+
3036
/**
3137
* @return AnalyserInterface
3238
*/

0 commit comments

Comments
 (0)