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
17 changes: 11 additions & 6 deletions src/Log/Minecraft/Vanilla/Forge/ForgeClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge;

use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

Expand All @@ -15,14 +16,18 @@ public static function getDetectors(): array
{
return [
(new MultiPatternDetector())
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml\.forgeVersion/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'(fml|forge)client\' with arguments/m'),
->addPattern('/' . static::MAIN_INFO_PREFIX . 'ModLauncher running: .*--fml\.forgeVersion/m')
->addPattern('/' . static::MAIN_INFO_PREFIX . 'Launching target \'(fml|forge)client\' with arguments/m'),
(new MultiPatternDetector())
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--version, (?:' . VanillaVersionInformation::getVersionPattern() . '-)?forge-/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'forge_client\' with arguments/m'),
->addPattern('/' . static::MAIN_INFO_PREFIX . 'ModLauncher running: .*--version, (?:' . VanillaVersionInformation::getVersionPattern() . '-)?forge-/m')
->addPattern('/' . static::MAIN_INFO_PREFIX . 'Launching target \'forge_client\' with arguments/m'),
(new MultiPatternDetector())
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Forge Mod Loader version/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching wrapped minecraft \{net\.minecraft\.client/m')
->addPattern('/' . static::MAIN_INFO_PREFIX . 'Forge Mod Loader version/m')
->addPattern('/' . static::MAIN_INFO_PREFIX . 'Launching wrapped minecraft \{net\.minecraft\.client/m'),
// The Modrinth App only starts clients and passes the plain Minecraft version without "forge-":
// [23:18:07] [main] [cpw.mods.modlauncher.LaunchServiceHandler/INFO]: Launching target 'forge_client' with arguments [--version, 26.3, ...
(new SinglePatternDetector())
->setPattern('/^\[[^\]]+\] \[main\] \[[^\]\/]+\/INFO\]: Launching target \'forge_client\' with arguments/m')
];
}
}
17 changes: 16 additions & 1 deletion src/Log/Minecraft/Vanilla/Forge/ForgeLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@

abstract class ForgeLog extends VanillaLog
{
protected static string $pattern = '/^(\[(?:\S+ )?(?:[0-9]{2}:?){3}(?:\.[0-9]+)?\] \[[^\]]+\/(\w+)\](?: \[([^\]]+)\])?:).*$/';
/**
* Start of an INFO line from the main thread, used by the Forge and NeoForge detectors.
* Usually the level is in the thread bracket, in newer versions followed by the logger:
* [12:00:00] [main/INFO]:
* [12:00:00] [main/INFO] [cpw.mods.modlauncher.Launcher/]:
* The Modrinth App writes the thread and the logger in separate brackets, with the level after the logger:
* [18:43:19] [main] [cpw.mods.modlauncher.Launcher/INFO]:
*/
public const string MAIN_INFO_PREFIX = '^\[[^\]]+\] \[main(?:\/INFO\](?: \[[^\]]+\])?|\] \[[^\]]+\/INFO\]): ';

/**
* Matches the start of an entry, the optional bracket without a slash is the thread written by the Modrinth App:
* [12:00:00] [main/INFO] [cpw.mods.modlauncher.Launcher/]:
* [18:43:19] [main] [cpw.mods.modlauncher.Launcher/INFO]:
*/
protected static string $pattern = '/^(\[(?:\S+ )?(?:[0-9]{2}:?){3}(?:\.[0-9]+)?\] (?:\[[^\]\/]+\] )?\[[^\]]+\/(\w+)\](?: \[([^\]]+)\])?:).*$/';

/**
* @inheritDoc
Expand Down
7 changes: 4 additions & 3 deletions src/Log/Minecraft/Vanilla/NeoForge/NeoForgeClientLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge\ForgeLog;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

class NeoForgeClientLog extends NeoForgeLog implements ClientLogTypeInterface
Expand All @@ -15,9 +16,9 @@ public static function getDetectors(): array
{
return [
new MultiPatternDetector()
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml\.neoForgeVersion/m')
->addPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Launching target \'(fml|forge)client\' with arguments/m'),
new SinglePatternDetector()->setPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: Starting FancyModLoader version [0-9.]+ \(CLIENT/m'),
->addPattern('/' . ForgeLog::MAIN_INFO_PREFIX . 'ModLauncher running: .*--fml\.neoForgeVersion/m')
->addPattern('/' . ForgeLog::MAIN_INFO_PREFIX . 'Launching target \'(fml|forge)client\' with arguments/m'),
new SinglePatternDetector()->setPattern('/' . ForgeLog::MAIN_INFO_PREFIX . 'Starting FancyModLoader version [0-9.]+ \(CLIENT/m'),
];
}
}
8 changes: 6 additions & 2 deletions src/Log/Minecraft/Vanilla/NeoForge/NeoForgeLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Aternos\Codex\Analyser\AnalyserInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analyser\NeoForgeAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Forge\ForgeLog;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaLog;
use Aternos\Codex\Minecraft\Parser\ForgeParser;
use Aternos\Codex\Minecraft\Parser\Parser;
Expand All @@ -13,7 +14,10 @@

abstract class NeoForgeLog extends VanillaLog
{
protected static string $pattern = '/^(\[(?:\S+ )?(?:[0-9]{2}:?){3}(?:\.[0-9]+)?\] \[[^\]]+\/(\w+)\](?: \[([^\]]+)\])?:).*$/';
/**
* Same entry format as Forge, see ForgeLog::$pattern.
*/
protected static string $pattern = '/^(\[(?:\S+ )?(?:[0-9]{2}:?){3}(?:\.[0-9]+)?\] (?:\[[^\]\/]+\] )?\[[^\]]+\/(\w+)\](?: \[([^\]]+)\])?:).*$/';

/**
* @inheritDoc
Expand All @@ -22,7 +26,7 @@ public static function getDetectors(): array
{
return array_merge(parent::getDetectors(), [
(new SinglePatternDetector())->setPattern('/NeoForge mod loading/'),
(new SinglePatternDetector())->setPattern('/^\[[^\]]+\] \[main\/INFO\]( \[[^\]]+\])?: ModLauncher running: .*--fml\.neoForgeVersion/m')
(new SinglePatternDetector())->setPattern('/' . ForgeLog::MAIN_INFO_PREFIX . 'ModLauncher running: .*--fml\.neoForgeVersion/m')
]);
}

Expand Down
254 changes: 254 additions & 0 deletions test/data/Vanilla/Forge/forge-client-modrinth-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
{
"id": "forge\/client",
"name": "Forge",
"type": "Client Log",
"version": "26.3",
"title": "Forge 26.3 Client Log",
"entries": [
{
"level": 6,
"time": null,
"prefix": null,
"lines": [
{
"number": 1,
"content": "Ignoring duplicate module on SecureModuleFinder: jtracy: Jar[jar:file:\/\/\/Users\/********\/Library\/Application%20Support\/ModrinthApp\/meta\/libraries\/com\/mojang\/jtracy\/1.14.38\/jtracy-1.14.38-natives-macos.jar!\/]"
},
{
"number": 2,
"content": "Ignoring duplicate module on SecureModuleFinder: jtracy: Jar[jar:file:\/\/\/Users\/********\/Library\/Application%20Support\/ModrinthApp\/meta\/libraries\/com\/mojang\/jtracy\/1.14.38\/jtracy-1.14.38-natives-macos-arm64.jar!\/]"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:06] [main] [cpw.mods.modlauncher.Launcher\/INFO]:",
"lines": [
{
"number": 3,
"content": "[23:18:06] [main] [cpw.mods.modlauncher.Launcher\/INFO]: ModLauncher running: args [--username, {MINECRAFT_USERNAME}, --version, 26.3, --gameDir, \/Users\/********\/Library\/Application Support\/ModrinthApp\/profiles\/Forge 26.3, --assetsDir, \/Users\/********\/Library\/Application Support\/ModrinthApp\/meta\/assets, --assetIndex, 34, --uuid, {MINECRAFT_UUID}, --accessToken, **********, --clientId, c4502edb-87c6-40cb-b595-64a280cf8906, --xuid, 0, --versionType, release, --width, 854, --height, 480, --launchTarget, forge_client]"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:06] [main] [cpw.mods.modlauncher.Launcher\/INFO]:",
"lines": [
{
"number": 4,
"content": "[23:18:06] [main] [cpw.mods.modlauncher.Launcher\/INFO]: JVM identified as Azul Systems, Inc. OpenJDK 64-Bit Server VM **.**.**.**.3+1-LTS"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:06] [main] [cpw.mods.modlauncher.Launcher\/INFO]:",
"lines": [
{
"number": 5,
"content": "[23:18:06] [main] [cpw.mods.modlauncher.Launcher\/INFO]: ModLauncher 10.2.6 starting: java version 25.**.**.**.** by Azul Systems, Inc.; OS Mac OS X arch aarch64 version 27.2.1"
}
]
},
{
"level": 4,
"time": null,
"prefix": "[23:18:06] [main] [net.minecraftforge.fml.loading.FMLConfig\/WARN]:",
"lines": [
{
"number": 6,
"content": "[23:18:06] [main] [net.minecraftforge.fml.loading.FMLConfig\/WARN]: Configuration file \/Users\/********\/Library\/Application Support\/ModrinthApp\/profiles\/Forge 26.3\/config\/fml.toml is not correct. Correcting"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:06] [main] [net.minecraftforge.fml.loading.ImmediateWindowHandler\/INFO]:",
"lines": [
{
"number": 7,
"content": "[23:18:06] [main] [net.minecraftforge.fml.loading.ImmediateWindowHandler\/INFO]: Loading ImmediateWindowProvider fmlearlywindow"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:06] [main] [net.minecraftforge.fml.loading.ImmediateWindowHandler\/INFO]:",
"lines": [
{
"number": 8,
"content": "[23:18:06] [main] [net.minecraftforge.fml.loading.ImmediateWindowHandler\/INFO]: ImmediateWindowProvider fmlearlywindow does not support default, switching to dummyprovider"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:06] [main] [mixin\/INFO]:",
"lines": [
{
"number": 9,
"content": "[23:18:06] [main] [mixin\/INFO]: SpongePowered MIXIN Subsystem Version=0.8.7 Source=jar:file:\/\/\/Users\/********\/Library\/Application%20Support\/ModrinthApp\/meta\/libraries\/org\/spongepowered\/mixin\/0.8.7\/mixin-0.8.7.jar!\/ Service=ModLauncher Env=CLIENT"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:07] [main] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer\/INFO]:",
"lines": [
{
"number": 10,
"content": "[23:18:07] [main] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer\/INFO]: Found mod file forge-26.3-66.1.8-client.jar of type MOD with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@344344fa"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:07] [main] [cpw.mods.modlauncher.LaunchServiceHandler\/INFO]:",
"lines": [
{
"number": 11,
"content": "[23:18:07] [main] [cpw.mods.modlauncher.LaunchServiceHandler\/INFO]: Launching target 'forge_client' with arguments [--version, 26.3, --gameDir, \/Users\/********\/Library\/Application Support\/ModrinthApp\/profiles\/Forge 26.3, --assetsDir, \/Users\/********\/Library\/Application Support\/ModrinthApp\/meta\/assets, --uuid, {MINECRAFT_UUID}, --username, {MINECRAFT_USERNAME}, --assetIndex, 34, --accessToken, **********, --clientId, c4502edb-87c6-40cb-b595-64a280cf8906, --xuid, 0, --versionType, release, --width, 854, --height, 480]"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:09] [Datafixer Bootstrap #0] [com.mojang.datafixers.DataFixerBuilder\/INFO]:",
"lines": [
{
"number": 12,
"content": "[23:18:09] [Datafixer Bootstrap #0] [com.mojang.datafixers.DataFixerBuilder\/INFO]: 307 Datafixer optimizations took 302 milliseconds"
}
]
},
{
"level": 4,
"time": null,
"prefix": "[23:18:10] [main] [oshi.software.os.mac.MacOperatingSystem\/WARN]:",
"lines": [
{
"number": 13,
"content": "[23:18:10] [main] [oshi.software.os.mac.MacOperatingSystem\/WARN]: Unable to parse version 27.2 to a codename."
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:14] [Render thread] [com.mojang.blaze3d.platform.SdlDebug\/INFO]:",
"lines": [
{
"number": 14,
"content": "[23:18:14] [Render thread] [com.mojang.blaze3d.platform.SdlDebug\/INFO]: SDL [SYSTEM]: App ID: com.mojang.minecraft"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:14] [Render thread] [com.mojang.blaze3d.platform.SdlDebug\/INFO]:",
"lines": [
{
"number": 15,
"content": "[23:18:14] [Render thread] [com.mojang.blaze3d.platform.SdlDebug\/INFO]: SDL [SYSTEM]: SDL revision: SDL-3.4.14-62f10da"
}
]
},
{
"level": 4,
"time": null,
"prefix": "[23:18:14] [Render thread] [com.mojang.renderpearl.backend.vulkan.VulkanBackend\/WARN]:",
"lines": [
{
"number": 16,
"content": "[23:18:14] [Render thread] [com.mojang.renderpearl.backend.vulkan.VulkanBackend\/WARN]: Device [Apple M5 Pro] supports all extensions from FeatureSet [Vulkan Portability Subset], making required"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.ForgeMod\/INFO]:",
"lines": [
{
"number": 17,
"content": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.ForgeMod\/INFO]: Forge mod loading, version 66.1.8, for MC 26.3 with MCP 20260918.230105"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.MinecraftForge\/INFO]:",
"lines": [
{
"number": 18,
"content": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.MinecraftForge\/INFO]: MinecraftForge v66.1.8 Initialized"
}
]
},
{
"level": 6,
"time": null,
"prefix": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.ForgeMod\/INFO]:",
"lines": [
{
"number": 19,
"content": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.ForgeMod\/INFO]: Opening jdk.naming.dns\/com.sun.jndi.dns to java.naming"
},
{
"number": 20,
"content": ""
}
]
}
],
"analysis": {
"problems": [],
"information": [
{
"message": "Minecraft version: 26.3",
"counter": 1,
"entry": {
"level": 6,
"time": null,
"prefix": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.ForgeMod\/INFO]:",
"lines": [
{
"number": 17,
"content": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.ForgeMod\/INFO]: Forge mod loading, version 66.1.8, for MC 26.3 with MCP 20260918.230105"
}
]
},
"label": "Minecraft version",
"value": "26.3"
},
{
"message": "Forge version: 66.1.8",
"counter": 1,
"entry": {
"level": 6,
"time": null,
"prefix": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.MinecraftForge\/INFO]:",
"lines": [
{
"number": 18,
"content": "[23:18:15] [modloading-worker-0] [net.minecraftforge.common.MinecraftForge\/INFO]: MinecraftForge v66.1.8 Initialized"
}
]
},
"label": "Forge version",
"value": "66.1.8"
}
]
}
}
Loading
Loading