Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Analysis/Information/Fabric/FabricVersionInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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@(?<version>' . static::$fabricVersionPattern . ')/',
'/' . VanillaServerLog::getPrefixPattern() . '(?:\(FabricLoader\/GameProvider\) )?Loading Minecraft ' . VanillaVersionInformation::getVersionPattern() . ' with Fabric Loader (?<version>' . static::$fabricVersionPattern . ')/'
'/' . FabricLog::getPrefixPattern() . '[\[(]FabricLoader[\])] Loading [0-9]+ mods: (?:\w{1,63}@[^, ]+, )*fabricloader@(?<version>' . static::$fabricVersionPattern . ')/',
'/' . FabricLog::getPrefixPattern() . '(?:\(FabricLoader\/GameProvider\) )?Loading Minecraft ' . VanillaVersionInformation::getVersionPattern() . ' with Fabric Loader (?<version>' . static::$fabricVersionPattern . ')/'
];
}

Expand Down
7 changes: 6 additions & 1 deletion src/Log/Minecraft/Vanilla/Fabric/FabricClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
];
}
}
13 changes: 11 additions & 2 deletions src/Log/Minecraft/Vanilla/Fabric/FabricLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions test/data/Vanilla/Fabric/fabric-26-1-client-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
198 changes: 198 additions & 0 deletions test/data/Vanilla/Fabric/fabric-client-modrinth-app.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
16 changes: 16 additions & 0 deletions test/data/Vanilla/Fabric/fabric-client-modrinth-app.log
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions test/data/Vanilla/Fabric/fabric-loom-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions test/data/Vanilla/Fabric/fabric-loom-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions test/tests/Logs/AutoLogsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading