summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-25 04:15:38 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-25 04:15:38 +0200
commita2ea62c88e4b7d25b27ccfde3d4d94d39c0a419f (patch)
tree3771b517ce72fe5c9a8b7e7020d15cafdf3a36b8 /src/main/java/at/hannibal2/skyhanni/features/slayer
parentde61fd6bccbea2a3ceca5a0707a3176938f24ead (diff)
downloadskyhanni-a2ea62c88e4b7d25b27ccfde3d4d94d39c0a419f.tar.gz
skyhanni-a2ea62c88e4b7d25b27ccfde3d4d94d39c0a419f.tar.bz2
skyhanni-a2ea62c88e4b7d25b27ccfde3d4d94d39c0a419f.zip
We do love LorenzTickEvent now
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt7
5 files changed, 14 insertions, 31 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
index 0deb4fdea..2cb9bf05c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.data.TitleUtils
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -14,7 +15,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.entity.EntityLivingBase
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
class SlayerQuestWarning {
private val config get() = SkyHanniMod.feature.slayer
@@ -22,7 +22,6 @@ class SlayerQuestWarning {
private var lastWarning = 0L
private var currentReason = ""
private var dirtySidebar = false
- private var tick = 0
private var activeSlayer: SlayerType? = null
//TODO add check if player has clicked on an item, before mobs around you gets damage
@@ -63,11 +62,11 @@ class SlayerQuestWarning {
}
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
+ fun onTick(event: LorenzTickEvent) {
if (!(LorenzUtils.inSkyBlock)) return
if (dirtySidebar) {
- if (tick++ % 60 == 0) {
+ if (event.isMod(60)) {
checkSidebar()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
index 1d41aaeeb..ba56b561f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
@@ -5,10 +5,7 @@ import at.hannibal2.skyhanni.config.Storage
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.data.TitleUtils
-import at.hannibal2.skyhanni.events.GuiRenderEvent
-import at.hannibal2.skyhanni.events.InventoryOpenEvent
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.SlayerChangeEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
@@ -21,7 +18,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.removeWordsAtEnd
import io.github.moulberry.notenoughupdates.util.Constants
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
import kotlin.math.ceil
class SlayerRngMeterDisplay {
@@ -32,16 +28,11 @@ class SlayerRngMeterDisplay {
private val changedItemPattern = "§aYou set your §r.* RNG Meter §r§ato drop §r.*§a!".toPattern()
private var lastItemDroppedTime = 0L
- private var tick = 0
-
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (event.phase != TickEvent.Phase.START) return
-
+ fun onTick(event: LorenzTickEvent) {
if (!isEnabled()) return
- tick++
- if (tick % 20 == 0) {
+ if (event.isMod(20)) {
if (lastItemDroppedTime != 0L) {
if (System.currentTimeMillis() > lastItemDroppedTime + 4_000) {
lastItemDroppedTime = 0L
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
index 6316361fb..1a4a6c70f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
@@ -2,23 +2,21 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.entity.projectile.EntityFireball
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
class BlazeSlayerClearView {
-
- private var tick = 0
private var nearBlaze = false
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
+ fun onTick(event: LorenzTickEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (tick++ % 60 == 0) {
+ if (event.isMod(60)) {
nearBlaze = DamageIndicatorManager.getDistanceTo(
BossType.SLAYER_BLAZE_1,
BossType.SLAYER_BLAZE_2,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index 503975822..632433573 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -2,10 +2,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ClickType
-import at.hannibal2.skyhanni.events.BlockClickEvent
-import at.hannibal2.skyhanni.events.GuiRenderEvent
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.TitleReceivedEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LocationUtils
@@ -19,7 +16,6 @@ import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
class BlazeSlayerDaggerHelper {
@@ -47,7 +43,7 @@ class BlazeSlayerDaggerHelper {
}
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
+ fun onTick(event: LorenzTickEvent) {
if (!isEnabled()) return
val player = Minecraft.getMinecraft().thePlayer
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
index ff5558d80..9d61e1393 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
@@ -3,20 +3,19 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.TitleUtils
import at.hannibal2.skyhanni.events.BossHealthChangeEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
class BlazeSlayerFirePitsWarning {
private val config get() = SkyHanniMod.feature.slayer
companion object {
private var lastFirePitsWarning = 0L
- private var nextTickIn = 0
fun fireFirePits() {
TitleUtils.sendTitle("§cFire Pits!", 2_000)
@@ -24,14 +23,14 @@ class BlazeSlayerFirePitsWarning {
}
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
+ fun onTick(event: LorenzTickEvent) {
if (!isEnabled()) return
val difference = System.currentTimeMillis() - lastFirePitsWarning
if (difference > 0) {
if (difference <= 2_000) {
- if (nextTickIn++ % 10 == 0) {
+ if (event.isMod(10)) {
if (config.firePitsWarning) {
SoundUtils.createSound("random.orb", 0.8f).playSound()
}