diff options
| author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-02 06:07:46 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-01 21:07:46 +0200 |
| commit | 8b28b68d6956ae406c0b13abece629a197670edf (patch) | |
| tree | 49ad7909383eecca20cad544535d935177e6feaf /src/main/java/at/hannibal2/skyhanni/features/misc | |
| parent | 60c5f9c351a7f59622a09cc10a5047c5dca279fa (diff) | |
| download | skyhanni-8b28b68d6956ae406c0b13abece629a197670edf.tar.gz skyhanni-8b28b68d6956ae406c0b13abece629a197670edf.tar.bz2 skyhanni-8b28b68d6956ae406c0b13abece629a197670edf.zip | |
Backend: Less fixed rate timer (#1264)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 7fe10ae5d..5b1f4e2ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -11,10 +11,10 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled -import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha import at.hannibal2.skyhanni.utils.ConfigUtils @@ -42,7 +42,6 @@ import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import kotlin.concurrent.fixedRateTimer import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -101,21 +100,14 @@ object TrevorFeatures { private val config get() = SkyHanniMod.feature.misc.trevorTheTrapper - init { - fixedRateTimer(name = "skyhanni-update-trapper", period = 1000L) { - if (onFarmingIsland() && config.trapperSolver) { - Minecraft.getMinecraft().addScheduledTask { - try { - updateTrapper() - TrevorTracker.update() - TrevorTracker.calculatePeltsPerHour() - if (questActive) TrevorSolver.findMob() - } catch (error: Throwable) { - ErrorManager.logErrorWithData(error, "Encountered an error when updating the trapper solver") - } - } - } - } + @SubscribeEvent + fun onSecondPassed(event: SecondPassedEvent) { + if (!onFarmingIsland()) return + if (!config.trapperSolver) return + updateTrapper() + TrevorTracker.update() + TrevorTracker.calculatePeltsPerHour() + if (questActive) TrevorSolver.findMob() } @SubscribeEvent |
