diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-10-13 18:32:17 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-10-13 18:32:17 +0200 |
| commit | 8d14ea329584924c51c5dc80720ddb829a289396 (patch) | |
| tree | 9b442d3944abfec27e3ca0018e9dc3328b8111a4 /src/main/kotlin | |
| parent | 72347d1e5b10061a30b177de4574c1044a7f7c4c (diff) | |
| download | Firmament-8d14ea329584924c51c5dc80720ddb829a289396.tar.gz Firmament-8d14ea329584924c51c5dc80720ddb829a289396.tar.bz2 Firmament-8d14ea329584924c51c5dc80720ddb829a289396.zip | |
test: fix debuglogger usage in tests
Diffstat (limited to 'src/main/kotlin')
| -rw-r--r-- | src/main/kotlin/features/debug/DebugLogger.kt | 3 | ||||
| -rw-r--r-- | src/main/kotlin/util/MC.kt | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/kotlin/features/debug/DebugLogger.kt b/src/main/kotlin/features/debug/DebugLogger.kt index 02073b7..52f6143 100644 --- a/src/main/kotlin/features/debug/DebugLogger.kt +++ b/src/main/kotlin/features/debug/DebugLogger.kt @@ -3,6 +3,7 @@ package moe.nea.firmament.features.debug import kotlinx.serialization.serializer import net.minecraft.text.Text import moe.nea.firmament.util.MC +import moe.nea.firmament.util.TestUtil import moe.nea.firmament.util.collections.InstanceList import moe.nea.firmament.util.data.Config import moe.nea.firmament.util.data.DataHolder @@ -19,7 +20,7 @@ class DebugLogger(val tag: String) { allInstances.add(this) } - fun isEnabled() = EnabledLogs.data.contains(tag) + fun isEnabled() = TestUtil.isInTest || EnabledLogs.data.contains(tag) fun log(text: String) = log { text } fun log(text: () -> String) { if (!isEnabled()) return diff --git a/src/main/kotlin/util/MC.kt b/src/main/kotlin/util/MC.kt index ed5cac3..d60e19c 100644 --- a/src/main/kotlin/util/MC.kt +++ b/src/main/kotlin/util/MC.kt @@ -30,6 +30,7 @@ import net.minecraft.util.Identifier import net.minecraft.util.Util import net.minecraft.util.math.BlockPos import net.minecraft.world.World +import moe.nea.firmament.Firmament import moe.nea.firmament.events.TickEvent import moe.nea.firmament.events.WorldReadyEvent import moe.nea.firmament.util.mc.TolerantRegistriesOps @@ -54,6 +55,10 @@ object MC { } fun sendChat(text: Text) { + if (TestUtil.isInTest) { + Firmament.logger.info("CHAT: ${text.string}") + return + } if (instance.isOnThread && inGameHud.chatHud != null && world != null) inGameHud.chatHud.addMessage(text) else |
