Skip to content
Closed
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
11 changes: 11 additions & 0 deletions src/Analyser/Report/CrashReport/FabricCrashReportAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
namespace Aternos\Codex\Minecraft\Analyser\Report\CrashReport;

use Aternos\Codex\Minecraft\Analysis\Information\Fabric\CrashReport\FabricVersionInformation;
use Aternos\Codex\Minecraft\Analysis\Problem\Fabric\FabricEntryStageProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Fabric\FabricMixinApplyProblem;

/**
* Analyses Fabric crash reports, including client logs that end in a crash report.
*
* The report parser makes one entry per line, so only problems whose pattern fits on a single line are added here.
* Patterns that need the stack trace below an exception, like FabricMixinProblem and FabricClientOnlyModProblem,
* cannot match in a crash report.
*/
class FabricCrashReportAnalyser extends MinecraftCrashReportAnalyser
{
public function __construct()
{
parent::__construct();
$this->addPossibleInsightClass(FabricVersionInformation::class);
$this->addPossibleInsightClass(FabricMixinApplyProblem::class);
$this->addPossibleInsightClass(FabricEntryStageProblem::class);
}
}
24 changes: 12 additions & 12 deletions src/Detective/Detective.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ class Detective extends \Aternos\Codex\Detective\Detective
{
protected string $defaultLogClass = MinecraftLog::class;
protected array $possibleLogClasses = [
SpigotCrashReportLog::class,
PaperCrashReportLog::class,
PurpurCrashReportLog::class,
FoliaCrashReport::class,
FabricCrashReportLog::class,
QuiltCrashReportLog::class,
NeoForgeCrashReportLog::class,
ForgeCrashReportLog::class,
VanillaCrashReportLog::class,
MohistCrashReportLog::class,
ArclightCrashReportLog::class,

FabricClientLog::class,
QuiltClientLog::class,
ForgeClientLog::class,
Expand Down Expand Up @@ -83,18 +95,6 @@ class Detective extends \Aternos\Codex\Detective\Detective
GlowstoneServerLog::class,
QuiltServerLog::class,

SpigotCrashReportLog::class,
PaperCrashReportLog::class,
PurpurCrashReportLog::class,
FoliaCrashReport::class,
FabricCrashReportLog::class,
QuiltCrashReportLog::class,
NeoForgeCrashReportLog::class,
ForgeCrashReportLog::class,
VanillaCrashReportLog::class,
MohistCrashReportLog::class,
ArclightCrashReportLog::class,

VanillaNetworkProtocolErrorReportLog::class,

PrismLauncherClientLog::class,
Expand Down
7 changes: 7 additions & 0 deletions src/Log/Minecraft/Vanilla/Fabric/FabricCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class FabricCrashReportLog extends FabricLog implements CrashReportLogTypeInterf
use VanillaCrashReportTrait;

/**
* The last detector catches a client log that ends in a crash report without its system details,
* like a launcher console cut off after the stack trace. Then only the loader line names Fabric:
* [02:24:31] [main/INFO]: Loading Minecraft 26.1.2 with Fabric Loader 0.19.3
*
* @inheritDoc
*/
public static function getDetectors(): array
Expand All @@ -27,6 +31,9 @@ public static function getDetectors(): array
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern("/^\tIs Modded: Definitely; Server brand changed to 'fabric'$/im"),
(new MultiPatternDetector())
->addPattern("/^---- Minecraft Crash Report ----$/m")
->addPattern('/' . static::getLoadingMinecraftPattern() . '/m'),
];
}

Expand Down
11 changes: 10 additions & 1 deletion src/Log/Minecraft/Vanilla/VanillaCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ class VanillaCrashReportLog extends VanillaReportLog implements CrashReportLogTy
use VanillaCrashReportTrait;

/**
* Matches the header only at the start of a line:
* ---- Minecraft Crash Report ----
*
* Crash reports are detected before client logs, so a header inside a log line must not count.
* Forge 1.7.10 prints a system report with this header on every start
* (`[STDOUT/]: [cpw.mods.fml.client.SplashProgress:start:188]: ---- Minecraft Crash Report ----`),
* although the game did not crash.
* A real Forge crash logged with a prefix is still detected by ForgeCrashReportLog.
*
* @inheritDoc
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/---- Minecraft Crash Report ----/")];
return [(new SinglePatternDetector())->setPattern("/^---- Minecraft Crash Report ----/m")];
}
}
Loading
Loading