diff --git a/src/Analysis/Information/Fabric/FabricVersionInformation.php b/src/Analysis/Information/Fabric/FabricVersionInformation.php index cfd47084..c700b4de 100644 --- a/src/Analysis/Information/Fabric/FabricVersionInformation.php +++ b/src/Analysis/Information/Fabric/FabricVersionInformation.php @@ -3,7 +3,7 @@ namespace Aternos\Codex\Minecraft\Analysis\Information\Fabric; use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation; -use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog; +use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Fabric\FabricLog; use Aternos\Codex\Minecraft\Translator\Translator; class FabricVersionInformation extends FabricInformation @@ -22,14 +22,15 @@ public function __construct() * Matches the Fabric Loader version in the list of loaded mods or in the "Loading Minecraft" line: * [14:04:09] [main/INFO]: [FabricLoader] Loading 3 mods: minecraft@1.16.5, java@11, fabricloader@0.11.1 * [03:35:09] [main/INFO]: Loading Minecraft 1.19.4 with Fabric Loader 0.14.19 + * [09:45:19] [main] [FabricLoader/GameProvider/INFO]: Loading Minecraft 1.20.1 with Fabric Loader 0.19.3 * * @inheritDoc */ public static function getPatterns(): array { return [ - '/' . VanillaServerLog::getPrefixPattern() . '[\[(]FabricLoader[\])] Loading [0-9]+ mods: (?:\w{1,63}@[^, ]+, )*fabricloader@(?' . static::$fabricVersionPattern . ')/', - '/' . VanillaServerLog::getPrefixPattern() . '(?:\(FabricLoader\/GameProvider\) )?Loading Minecraft ' . VanillaVersionInformation::getVersionPattern() . ' with Fabric Loader (?' . static::$fabricVersionPattern . ')/' + '/' . FabricLog::getPrefixPattern() . '[\[(]FabricLoader[\])] Loading [0-9]+ mods: (?:\w{1,63}@[^, ]+, )*fabricloader@(?' . static::$fabricVersionPattern . ')/', + '/' . FabricLog::getPrefixPattern() . '(?:\(FabricLoader\/GameProvider\) )?Loading Minecraft ' . VanillaVersionInformation::getVersionPattern() . ' with Fabric Loader (?' . static::$fabricVersionPattern . ')/' ]; } diff --git a/src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php b/src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php index 7ea698cb..fc4be099 100644 --- a/src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php +++ b/src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php @@ -15,7 +15,12 @@ public static function getDetectors(): array return [ (new MultiPatternDetector()) ->addPattern('/' . static::getLoadingMinecraftPattern() . '/m') - ->addPattern('#^\[[\d:]+\] \[(?:Render thread|main)\/INFO\](?::| \((?:net\.minecraft\.client\.)?Minecraft\)) Setting user: \w+#m') + ->addPattern('#^\[[\d:]+\] \[(?:Render thread|main)\/INFO\](?::| \((?:net\.minecraft\.client\.)?Minecraft\)) Setting user: \w+#m'), + // Modrinth App, logger in its own bracket: + // [09:45:51] [Render thread] [net.minecraft.class_310/INFO]: Setting user: Player + (new MultiPatternDetector()) + ->addPattern('/' . static::getLoadingMinecraftPattern() . '/m') + ->addPattern('/^\[[\d:]+\] \[Render thread\] \[[^\]\/]+\/INFO\]: Setting user: \w+/m') ]; } } diff --git a/src/Log/Minecraft/Vanilla/Fabric/FabricLog.php b/src/Log/Minecraft/Vanilla/Fabric/FabricLog.php index a30d3c5e..2a2fff04 100644 --- a/src/Log/Minecraft/Vanilla/Fabric/FabricLog.php +++ b/src/Log/Minecraft/Vanilla/Fabric/FabricLog.php @@ -10,8 +10,17 @@ abstract class FabricLog extends VanillaLog { - protected static string $pattern = '/^(\[(?:[0-9]{2}:?){3}\] \[[^\/]+\/(\w+)\]:?).*$/'; - protected static string $prefixPattern = '\[(?:[0-9]{2}:?){3}\] \[[^\/]+\/\w+\]:? '; + /** + * Everything between the time and the slash before the level. + * Usually that's only the thread: + * [12:00:00] [main/INFO]: + * The Modrinth App writes the thread and the logger in separate brackets, and the logger can contain slashes: + * [09:45:19] [main] [FabricLoader/GameProvider/INFO]: + */ + protected const string THREAD_PATTERN = '(?:\[[^\]\/]+\] \[[^\]]+|\[[^\/]+)'; + + protected static string $pattern = '/^(\[(?:[0-9]{2}:?){3}\] ' . self::THREAD_PATTERN . '\/(\w+)\]:?).*$/'; + protected static string $prefixPattern = '\[(?:[0-9]{2}:?){3}\] ' . self::THREAD_PATTERN . '\/\w+\]:? '; /** * @inheritDoc diff --git a/test/data/Vanilla/Fabric/fabric-26-1-client-dev.json b/test/data/Vanilla/Fabric/fabric-26-1-client-dev.json index a30815d2..f08f587c 100644 --- a/test/data/Vanilla/Fabric/fabric-26-1-client-dev.json +++ b/test/data/Vanilla/Fabric/fabric-26-1-client-dev.json @@ -1164,6 +1164,23 @@ "label": "Minecraft version", "value": "26.1" }, + { + "message": "Fabric loader version: 0.18.4", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[12:23:58] [main\/INFO]", + "lines": [ + { + "number": 1, + "content": "[12:23:58] [main\/INFO] (FabricLoader\/GameProvider) Loading Minecraft 26.1 with Fabric Loader 0.18.4" + } + ] + }, + "label": "Fabric loader version", + "value": "0.18.4" + }, { "message": "Java version: 25", "counter": 1, diff --git a/test/data/Vanilla/Fabric/fabric-client-modrinth-app.json b/test/data/Vanilla/Fabric/fabric-client-modrinth-app.json new file mode 100644 index 00000000..845dfac9 --- /dev/null +++ b/test/data/Vanilla/Fabric/fabric-client-modrinth-app.json @@ -0,0 +1,198 @@ +{ + "id": "fabric\/client", + "name": "Fabric", + "type": "Client Log", + "version": "1.20.1", + "title": "Fabric 1.20.1 Client Log", + "entries": [ + { + "level": 6, + "time": null, + "prefix": null, + "lines": [ + { + "number": 1, + "content": "# Minecraft launcher log started at 2026-08-16 09:45:13" + }, + { + "number": 2, + "content": "# Instance: Example Pack" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[09:45:19] [main] [FabricLoader\/GameProvider\/INFO]:", + "lines": [ + { + "number": 3, + "content": "[09:45:19] [main] [FabricLoader\/GameProvider\/INFO]: Loading Minecraft 1.20.1 with Fabric Loader 0.19.3" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[09:45:19] [main] [FabricLoader\/GameRemap\/INFO]:", + "lines": [ + { + "number": 4, + "content": "[09:45:19] [main] [FabricLoader\/GameRemap\/INFO]: Fabric is preparing JARs on first launch, this may take a few seconds..." + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[09:45:19] [main] [FabricLoader\/INFO]:", + "lines": [ + { + "number": 5, + "content": "[09:45:19] [main] [FabricLoader\/INFO]: Loading 670 mods:" + }, + { + "number": 6, + "content": "\t- fabricloader 0.19.3" + }, + { + "number": 7, + "content": "\t- java 17" + }, + { + "number": 8, + "content": "\t- minecraft 1.20.1" + }, + { + "number": 9, + "content": "\t- necronomicon 1.6.0" + } + ] + }, + { + "level": 4, + "time": null, + "prefix": "[09:45:47] [main] [FabricLoader\/Mixin\/WARN]:", + "lines": [ + { + "number": 10, + "content": "[09:45:47] [main] [FabricLoader\/Mixin\/WARN]: Mixin apply for mod necronomicon failed necronomicon-common.mixins.json:item.AnimatedItemNameMixin from mod necronomicon -> net.minecraft.class_1799: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException Critical injection failure: @Inject annotation on getName could not find any targets matching 'getHoverName' in net\/minecraft\/class_1799. No refMap loaded. [handler$kjf002$necronomicon$getName(Lorg\/spongepowered\/asm\/mixin\/injection\/callback\/CallbackInfoReturnable;)V -> Parse -> -> Validate Targets]" + }, + { + "number": 11, + "content": "org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: Critical injection failure: @Inject annotation on getName could not find any targets matching 'getHoverName' in net\/minecraft\/class_1799. No refMap loaded. [handler$kjf002$necronomicon$getName(Lorg\/spongepowered\/asm\/mixin\/injection\/callback\/CallbackInfoReturnable;)V -> Parse -> -> Validate Targets]" + }, + { + "number": 12, + "content": "\tat org.spongepowered.asm.mixin.injection.selectors.TargetSelectors.validate(TargetSelectors.java:346)" + }, + { + "number": 13, + "content": "\tat org.spongepowered.asm.mixin.injection.struct.InjectionInfo.readAnnotation(InjectionInfo.java:369)" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[09:45:51] [Render thread] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService\/INFO]:", + "lines": [ + { + "number": 14, + "content": "[09:45:51] [Render thread] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService\/INFO]: Environment: authHost='https:\/\/authserver.mojang.com', accountsHost='https:\/\/api.mojang.com', sessionHost='https:\/\/sessionserver.mojang.com', servicesHost='https:\/\/api.minecraftservices.com', name='PROD'" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[09:45:51] [Render thread] [net.minecraft.class_310\/INFO]:", + "lines": [ + { + "number": 15, + "content": "[09:45:51] [Render thread] [net.minecraft.class_310\/INFO]: Setting user: Player" + }, + { + "number": 16, + "content": "# Process exited with status: exit code: 0xffffffff" + }, + { + "number": 17, + "content": "" + } + ] + } + ], + "analysis": { + "problems": [], + "information": [ + { + "message": "Minecraft version: 1.20.1", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[09:45:19] [main] [FabricLoader\/GameProvider\/INFO]:", + "lines": [ + { + "number": 3, + "content": "[09:45:19] [main] [FabricLoader\/GameProvider\/INFO]: Loading Minecraft 1.20.1 with Fabric Loader 0.19.3" + } + ] + }, + "label": "Minecraft version", + "value": "1.20.1" + }, + { + "message": "Fabric loader version: 0.19.3", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[09:45:19] [main] [FabricLoader\/GameProvider\/INFO]:", + "lines": [ + { + "number": 3, + "content": "[09:45:19] [main] [FabricLoader\/GameProvider\/INFO]: Loading Minecraft 1.20.1 with Fabric Loader 0.19.3" + } + ] + }, + "label": "Fabric loader version", + "value": "0.19.3" + }, + { + "message": "Java version: 17", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[09:45:19] [main] [FabricLoader\/INFO]:", + "lines": [ + { + "number": 5, + "content": "[09:45:19] [main] [FabricLoader\/INFO]: Loading 670 mods:" + }, + { + "number": 6, + "content": "\t- fabricloader 0.19.3" + }, + { + "number": 7, + "content": "\t- java 17" + }, + { + "number": 8, + "content": "\t- minecraft 1.20.1" + }, + { + "number": 9, + "content": "\t- necronomicon 1.6.0" + } + ] + }, + "label": "Java version", + "value": "17" + } + ] + } +} \ No newline at end of file diff --git a/test/data/Vanilla/Fabric/fabric-client-modrinth-app.log b/test/data/Vanilla/Fabric/fabric-client-modrinth-app.log new file mode 100644 index 00000000..a5b8a6b3 --- /dev/null +++ b/test/data/Vanilla/Fabric/fabric-client-modrinth-app.log @@ -0,0 +1,16 @@ +# Minecraft launcher log started at 2026-08-16 09:45:13 +# Instance: Example Pack +[09:45:19] [main] [FabricLoader/GameProvider/INFO]: Loading Minecraft 1.20.1 with Fabric Loader 0.19.3 +[09:45:19] [main] [FabricLoader/GameRemap/INFO]: Fabric is preparing JARs on first launch, this may take a few seconds... +[09:45:19] [main] [FabricLoader/INFO]: Loading 670 mods: + - fabricloader 0.19.3 + - java 17 + - minecraft 1.20.1 + - necronomicon 1.6.0 +[09:45:47] [main] [FabricLoader/Mixin/WARN]: Mixin apply for mod necronomicon failed necronomicon-common.mixins.json:item.AnimatedItemNameMixin from mod necronomicon -> net.minecraft.class_1799: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException Critical injection failure: @Inject annotation on getName could not find any targets matching 'getHoverName' in net/minecraft/class_1799. No refMap loaded. [handler$kjf002$necronomicon$getName(Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable;)V -> Parse -> -> Validate Targets] +org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: Critical injection failure: @Inject annotation on getName could not find any targets matching 'getHoverName' in net/minecraft/class_1799. No refMap loaded. [handler$kjf002$necronomicon$getName(Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable;)V -> Parse -> -> Validate Targets] + at org.spongepowered.asm.mixin.injection.selectors.TargetSelectors.validate(TargetSelectors.java:346) + at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.readAnnotation(InjectionInfo.java:369) +[09:45:51] [Render thread] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' +[09:45:51] [Render thread] [net.minecraft.class_310/INFO]: Setting user: Player +# Process exited with status: exit code: 0xffffffff diff --git a/test/data/Vanilla/Fabric/fabric-loom-client.json b/test/data/Vanilla/Fabric/fabric-loom-client.json index 74127508..c5e04e88 100644 --- a/test/data/Vanilla/Fabric/fabric-loom-client.json +++ b/test/data/Vanilla/Fabric/fabric-loom-client.json @@ -1018,6 +1018,23 @@ "label": "Minecraft version", "value": "1.16.5" }, + { + "message": "Fabric loader version: 0.14.10", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[11:44:00] [main\/INFO]", + "lines": [ + { + "number": 1, + "content": "[11:44:00] [main\/INFO] (FabricLoader\/GameProvider) Loading Minecraft 1.16.5 with Fabric Loader 0.14.10" + } + ] + }, + "label": "Fabric loader version", + "value": "0.14.10" + }, { "message": "Java version: 17", "counter": 1, diff --git a/test/data/Vanilla/Fabric/fabric-loom-server.json b/test/data/Vanilla/Fabric/fabric-loom-server.json index 45e005e7..5c23cf49 100644 --- a/test/data/Vanilla/Fabric/fabric-loom-server.json +++ b/test/data/Vanilla/Fabric/fabric-loom-server.json @@ -688,6 +688,23 @@ "label": "Minecraft version", "value": "1.16.5" }, + { + "message": "Fabric loader version: 0.14.10", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[11:47:03] [main\/INFO]", + "lines": [ + { + "number": 1, + "content": "[11:47:03] [main\/INFO] (FabricLoader\/GameProvider) Loading Minecraft 1.16.5 with Fabric Loader 0.14.10" + } + ] + }, + "label": "Fabric loader version", + "value": "0.14.10" + }, { "message": "Java version: 17", "counter": 1, diff --git a/test/tests/Logs/AutoLogsTest.php b/test/tests/Logs/AutoLogsTest.php index e094cfab..75b36308 100644 --- a/test/tests/Logs/AutoLogsTest.php +++ b/test/tests/Logs/AutoLogsTest.php @@ -1170,6 +1170,16 @@ public function test_fabric_client_1_19_2(): void $this->assertStringEqualsFile($log->getExpectedPath(), $log->getOutput(), $log->getLogPath()); } + /** + * @return void + * @throws Exception + */ + public function test_fabric_client_modrinth_app(): void + { + $log = new TestLog('Vanilla/Fabric/fabric-client-modrinth-app.log'); + $this->assertStringEqualsFile($log->getExpectedPath(), $log->getOutput(), $log->getLogPath()); + } + /** * @return void * @throws Exception