diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/HotSwapDetection.kt | 50 |
2 files changed, 0 insertions, 52 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index addfbf1f0..40af07f90 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -329,7 +329,6 @@ import at.hannibal2.skyhanni.features.summonings.SummoningMobManager import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.HighlightMissingRepoItems -import at.hannibal2.skyhanni.test.HotSwapDetection import at.hannibal2.skyhanni.test.PacketTest import at.hannibal2.skyhanni.test.ParkourWaypointSaver import at.hannibal2.skyhanni.test.ShowItemUuid @@ -728,7 +727,6 @@ class SkyHanniMod { loadModule(TestShowSlotNumber()) loadModule(SkyHanniDebugsAndTests) loadModule(WorldEdit) - loadModule(HotSwapDetection) PreInitFinishedEvent().postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/test/HotSwapDetection.kt b/src/main/java/at/hannibal2/skyhanni/test/HotSwapDetection.kt index f1044057d..e69de29bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/HotSwapDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/HotSwapDetection.kt @@ -1,50 +0,0 @@ -package at.hannibal2.skyhanni.test - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.MinecraftData -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.Minecraft -import kotlin.concurrent.fixedRateTimer - -object HotSwapDetection { - private val config get() = SkyHanniMod.feature.dev.debug - - private var latestTick = 0 - private var beforeThatTick = 0 - private var lastTps = 0 - private var hotswap = false - - init { - fixedRateTimer(name = "skyhanni-hot-swap-detection", period = 250) { - val currentTick = MinecraftData.totalTicks - val diff = currentTick - latestTick - latestTick = currentTick - - // we count 2 client ticks per tick, we are bad - handleTps(diff * 2) - } - } - - private fun handleTps(tps: Int) { - Minecraft.getMinecraft().theWorld ?: return - if (!config.hotSwapDetection) return - - // ignore below one minute - if (latestTick < 20 * 60) return - - if (!hotswap) { - if (tps < 5) { - if (beforeThatTick > 18) { - LorenzUtils.debug("Detected hotswap now!") - hotswap = true - } - } - } else { - if (tps > 15) { - hotswap = false - } - } - beforeThatTick = lastTps - lastTps = tps - } -} |