From ae61341891fe50ce579654a145d2177e6595ea89 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sun, 7 Apr 2024 20:20:10 +0200 Subject: Improvement: Mob Detection logEvents to file (#1379) --- src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt | 3 +++ src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt | 12 +++++------- src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt | 6 +----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt index acd8cad6c..9ed5a4497 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data.mob import at.hannibal2.skyhanni.events.MobEvent import at.hannibal2.skyhanni.utils.CollectionUtils.takeIfAllNotNull import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand @@ -37,6 +38,8 @@ class MobData { const val DISPLAY_NPC_DETECTION_RANGE = 24.0 // 24.0 var externRemoveOfRetryAmount = 0 + + val logger = LorenzLogger("mob/detection") } internal enum class Result { diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt index 63a39d502..a1e894d32 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt @@ -86,12 +86,10 @@ class MobDebug { @SubscribeEvent fun onMobEvent(event: MobEvent) { if (!config.logEvents) return - LorenzDebug.log( - "Mob ${if (event is MobEvent.Spawn) "Spawn" else "Despawn"}: ${ - getMobInfo(event.mob).joinToString( - ", " - ) - }" - ) + val text = "Mob ${if (event is MobEvent.Spawn) "Spawn" else "Despawn"}: ${ + getMobInfo(event.mob).joinToString(", ") + }" + MobData.logger.log(text) + LorenzDebug.log(text) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt index c674c0593..d3f8601d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data.mob import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.mob.MobData.Companion.logger import at.hannibal2.skyhanni.data.mob.MobFilter.isDisplayNPC import at.hannibal2.skyhanni.data.mob.MobFilter.isRealPlayer import at.hannibal2.skyhanni.data.mob.MobFilter.isSkyBlockMob @@ -17,7 +18,6 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.put import at.hannibal2.skyhanni.utils.CollectionUtils.refreshReference import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.client.Minecraft @@ -37,8 +37,6 @@ import java.util.concurrent.atomic.AtomicBoolean private const val MAX_RETRIES = 20 * 5 -private const val MOB_DETECTION_LOG_PREFIX = "MobDetection: " - class MobDetection { /* Unsupported "Mobs" @@ -59,8 +57,6 @@ class MobDetection { private var shouldClear: AtomicBoolean = AtomicBoolean(false) - private val logger = LorenzLogger("mob/detection") - init { MobFilter.bossMobNameFilter MobFilter.mobNameFilter -- cgit