summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-30 10:43:43 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-30 10:43:43 +0100
commit9505f1c311d53e908d4f47ff61bb132e9aa80282 (patch)
tree5ad7f8b88e8eec47f474c210fdf31ce8bbc70471 /src/main/java/at/hannibal2/skyhanni/features/slayer
parentd98227155bf96f824fca95de896d27095d254c54 (diff)
downloadskyhanni-9505f1c311d53e908d4f47ff61bb132e9aa80282.tar.gz
skyhanni-9505f1c311d53e908d4f47ff61bb132e9aa80282.tar.bz2
skyhanni-9505f1c311d53e908d4f47ff61bb132e9aa80282.zip
Using DelayedRun more often
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
index 59ca5b075..04275f1a9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen
import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsInRadiusWith
@@ -23,7 +24,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
-import at.hannibal2.skyhanni.utils.MinecraftDispatcher
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
@@ -36,7 +36,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.client.renderer.GlStateManager
@@ -136,21 +135,18 @@ object VampireSlayerFeatures {
else taggedEntityList.contains(this.entityId) && configOtherBoss.twinClawsSound
if (shouldSendTitle || shouldSendSound) {
- SkyHanniMod.coroutineScope.launch {
- delay(config.twinclawsDelay.milliseconds)
- withContext(MinecraftDispatcher) {
- if (nextClawSend < System.currentTimeMillis()) {
- if (shouldSendSound)
- playTwinclawsSound()
- if (shouldSendTitle) {
- LorenzUtils.sendTitle(
- "§6§lTWINCLAWS",
- (1750 - config.twinclawsDelay).milliseconds,
- 2.6
- )
- }
- nextClawSend = System.currentTimeMillis() + 5_000
+ DelayedRun.runDelayed(config.twinclawsDelay.milliseconds) {
+ if (nextClawSend < System.currentTimeMillis()) {
+ if (shouldSendSound)
+ playTwinclawsSound()
+ if (shouldSendTitle) {
+ LorenzUtils.sendTitle(
+ "§6§lTWINCLAWS",
+ (1750 - config.twinclawsDelay).milliseconds,
+ 2.6
+ )
}
+ nextClawSend = System.currentTimeMillis() + 5_000
}
}
}