diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
25 files changed, 64 insertions, 75 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 590a94ccf..e14589155 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -533,7 +533,7 @@ class SkyHanniMod { loadModule(DamageIndicatorManager()) loadModule(ItemAbilityCooldown()) loadModule(DungeonHighlightClickedBlocks()) - loadModule(DungeonMilestonesDisplay()) + loadModule(DungeonMilestonesDisplay) loadModule(DungeonDeathCounter()) loadModule(DungeonCleanEnd()) loadModule(DungeonBossMessages()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 6720c81eb..7fc50447f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -276,7 +276,6 @@ class HypixelData { // So, as requested by Hannibal, use locraw from // NEU and have NEU send it. // Remove this when NEU dependency is removed - val currentTime = System.currentTimeMillis() if (LorenzUtils.onHypixel && locrawData == null && lastLocRaw.passedSince() > 15.seconds @@ -289,7 +288,7 @@ class HypixelData { } } - if (event.isMod(2) && LorenzUtils.inSkyBlock) { + if (LorenzUtils.inSkyBlock) { val originalLocation = ScoreboardData.sidebarLinesFormatted .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } ?.substring(5)?.removeColor() diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index 2ec0ea667..bc0f31e2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -69,14 +69,16 @@ object MinecraftData { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { + if (event.phase == TickEvent.Phase.START) return Minecraft.getMinecraft().thePlayer ?: return + + DelayedRun.checkRuns() totalTicks++ LorenzTickEvent(totalTicks).postAndCatch() } @SubscribeEvent fun onTick(event: LorenzTickEvent) { - DelayedRun.checkRuns() if (!LorenzUtils.inSkyBlock) return val hand = InventoryUtils.getItemInHand() val newItem = hand?.getInternalName() ?: NEUInternalName.NONE diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt index 069cae5f8..12b837da5 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt @@ -2,8 +2,7 @@ package at.hannibal2.skyhanni.events class LorenzTickEvent(private val tick: Int) : LorenzEvent() { - fun isMod(i: Int) = tick % i == 0 + fun isMod(i: Int, offset: Int = 0) = (tick + offset) % i == 0 - @Deprecated("Use SecondPassedEvent instead", ReplaceWith("")) - fun repeatSeconds(i: Int) = isMod(i * 20) + fun repeatSeconds(i: Int, offset: Int = 0) = isMod(i * 20, offset) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index a8b7cdada..fa7c55b51 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager +import at.hannibal2.skyhanni.utils.StringUtils.matches import net.minecraft.util.ChatComponentText import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -68,7 +69,7 @@ class PlayerChatModifier { string = string.replace("§[7ab6]((?:\\w+){2,16}) (§.)", "§b$1 $2") // TODO remove workaround - if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) { + if (!DungeonMilestonesDisplay.milestonePattern.matches(input)) { // all players same color in chat string = string.replace("§r§7: ", "§r§f: ") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt index cfa0ba5ff..bb78592fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt @@ -21,7 +21,7 @@ abstract class ChromaShader(vertex: String, fragment: String) : Shader(vertex, f } registerUniform(Uniform.UniformType.FLOAT, "timeOffset") { var ticks = - (MinecraftData.totalTicks / 2) + (Minecraft.getMinecraft() as AccessorMinecraft).timer.renderPartialTicks + (MinecraftData.totalTicks) + (Minecraft.getMinecraft() as AccessorMinecraft).timer.renderPartialTicks ticks = when (ChromaManager.config.chromaDirection) { Direction.FORWARD_RIGHT, Direction.BACKWARD_RIGHT -> ticks diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt index d5999c721..ca641889a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt @@ -35,10 +35,10 @@ class ArrowTrail { val secondsAlive = config.secondsAlive.toDouble().toDuration(DurationUnit.SECONDS) val time = SimpleTimeMark.now() val deathTime = time.plus(secondsAlive) - if (event.isMod(2)) { - listAllArrow.removeIf { it.deathTime.isInPast() } - listYourArrow.removeIf { it.deathTime.isInPast() } - } + + listAllArrow.removeIf { it.deathTime.isInPast() } + listYourArrow.removeIf { it.deathTime.isInPast() } + EntityUtils.getEntities<EntityArrow>().forEach { val line = Line(it.getPrevLorenzVec(), it.getLorenzVec(), deathTime) if (it.shootingEntity == Minecraft.getMinecraft().thePlayer) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt index 8510b6b6c..5f78d5886 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -92,7 +92,7 @@ class DungeonDeathCounter { if (!isEnabled()) return SkyHanniMod.feature.dungeon.deathCounterPos.renderString( - DungeonMilestonesDisplay.color + display, + DungeonMilestonesDisplay.colour + display, posLabel = "Dungeon Death Counter" ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 7d2f9410f..30e3dbc5e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -41,7 +41,6 @@ object DungeonLividFinder { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!inDungeon()) return - if (!event.isMod(2)) return val isCurrentlyBlind = isCurrentlyBlind() if (!gotBlinded) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt index dfaf5b02f..bdd681b72 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -9,34 +9,27 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonMilestonesDisplay { +object DungeonMilestonesDisplay { private val config get() = SkyHanniMod.feature.dungeon - companion object { + val milestonePattern by RepoPattern.pattern( + "dungeon.milestone", + "§e§l.*Milestone §r§e.§r§7: You have (?:tanked and )?(?:dealt|healed) §r§.*§r§7.*so far! §r§a.*" + ) - // TODO USE SH-REPO - private val milestonePatternList = listOf( - "§e§l(.*) Milestone §r§e.§r§7: You have dealt §r§c(.*)§r§7 Total Damage so far! §r§a(.*)".toPattern(), - "§e§lArcher Milestone §r§e.§r§7: You have dealt §r§c(.*)§r§7 Ranged Damage so far! §r§a(.*)".toPattern(), - "§e§lHealer Milestone §r§e.§r§7: You have healed §r§a(.*)§r§7 Damage so far! §r§a(.*)".toPattern(), - "§e§lTank Milestone §r§e.§r§7: You have tanked and dealt §r§c(.*)§r§7 Total Damage so far! §r§a(.*)s".toPattern() - ) - - private var display = "" - var color = "" - var currentMilestone = 0 - var timeReached = 0L - - fun isMilestoneMessage(message: String): Boolean = milestonePatternList.any { it.matches(message) } - } + private var display = "" + private var currentMilestone = 0 + private var timeReached = 0L + var colour = "" @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!event.isMod(5)) return - if (currentMilestone >= 3 && System.currentTimeMillis() > timeReached + 3_000 && display != "") { + if (currentMilestone >= 3 && System.currentTimeMillis() > timeReached + 3_000 && display.isNotEmpty()) { display = display.substring(1) } } @@ -45,7 +38,7 @@ class DungeonMilestonesDisplay { fun onChat(event: LorenzChatEvent) { if (!isEnabled()) return - if (isMilestoneMessage(event.message)) { + if (milestonePattern.matches(event.message)) { event.blockedReason = "dungeon_milestone" currentMilestone++ update() @@ -58,7 +51,7 @@ class DungeonMilestonesDisplay { timeReached = System.currentTimeMillis() } - color = when (currentMilestone) { + colour = when (currentMilestone) { 0, 1 -> "§c" 2 -> "§e" else -> "§a" @@ -83,7 +76,7 @@ class DungeonMilestonesDisplay { if (!isEnabled()) return config.showMileStonesDisplayPos.renderString( - color + display, + colour + display, posLabel = "Dungeon Milestone" ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt index 587522c00..3c2623fea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -14,7 +14,7 @@ class GriffinPetWarning { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!event.isMod(20)) return + if (!event.isMod(10)) return if (!SkyHanniMod.feature.event.diana.petWarning) return if (!DianaAPI.isDoingDiana()) return if (!DianaAPI.hasSpadeInHand()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 8c2546f6c..1fbdbaea4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -95,7 +95,7 @@ object GardenAPI { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!inGarden()) return - if (event.isMod(10)) { + if (event.isMod(10, 1)) { inBarn = barnArea.isPlayerInside() // We ignore random hypixel moments diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt index c42afe36c..5e6494f66 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt @@ -109,7 +109,7 @@ object ArmorDropTracker { if (!GardenAPI.inGarden()) return if (!config.enabled) return - if (event.isMod(30)) { + if (event.repeatSeconds(1)) { checkArmor() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt index bace754b3..710862f90 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt @@ -37,7 +37,7 @@ class CropSpeedMeter { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - if (!event.isMod(30)) return + if (!event.isMod(15)) return updateDisplay() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt index a6a1aaebe..15fcc42c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneFeatures.kt @@ -62,7 +62,6 @@ object FarmingLaneFeatures { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!GardenAPI.inGarden()) return - if (!event.isMod(2)) return if (!config.distanceDisplay && !config.laneSwitchNotification.enabled) return if (!calculateDistance()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt index 58473ca29..a6354084a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt @@ -27,7 +27,7 @@ class SprayDisplay { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!GardenAPI.inGarden() || !event.isMod(5)) return + if (!GardenAPI.inGarden() || !event.isMod(5, 3)) return if (config.displayEnabled) { display = GardenPlotAPI.getCurrentPlot()?.takeIf { !it.isBarn() }?.let { plot -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index fb1fe12bf..53e164ccc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -416,7 +416,7 @@ object GardenVisitorFeatures { fun onTick(event: LorenzTickEvent) { if (!GardenAPI.inGarden()) return if (!config.shoppingList.display && config.highlightStatus == HighlightMode.DISABLED) return - if (!event.isMod(10)) return + if (!event.isMod(10, 2)) return if (GardenAPI.onBarnPlot && config.highlightStatus != HighlightMode.DISABLED) { checkVisitorsReady() diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt index 88a44640a..8c6ff9029 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt @@ -7,8 +7,9 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -22,13 +23,14 @@ class ChickenHeadTimer { private var lastTime = SimpleTimeMark.farPast() private val cooldown = 5.seconds + private val chickenHead = "CHICKEN_HEAD".asInternalName() + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return if (!event.isMod(5)) return - val name = InventoryUtils.getHelmet()?.name ?: "" - hasChickenHead = name.contains("Chicken Head") + hasChickenHead = InventoryUtils.getHelmet()?.getInternalName() == chickenHead } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt index 5a4bf0f89..ca92ddb2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt @@ -71,7 +71,7 @@ class KingTalismanHelper { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!event.isMod(20)) return + if (!event.repeatSeconds(1)) return if (!isEnabled()) return val storage = storage ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt index 42bd78cfc..6fff7b69b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.misc.compacttablist import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeResets import at.hannibal2.skyhanni.utils.StringUtils.removeSFormattingCode @@ -50,12 +50,11 @@ object TabListReader { val renderColumns = mutableListOf<RenderColumn>() @SubscribeEvent - fun onTick(event: LorenzTickEvent) { + fun onTabUpdate(event: TabListUpdateEvent) { if (!LorenzUtils.inSkyBlock) return - if (!event.isMod(5)) return if (!config.enabled) return - var tabLines = TabListData.getTabList() + var tabLines = event.tabList if (tabLines.size < 80) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt index d64ce53d3..c037d5cfc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt @@ -17,9 +17,7 @@ class ShyCruxWarnings { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!RiftAPI.inRift() || !config.shyWarning) return - if (event.isMod(2)) { - checkForShy() - } + checkForShy() } private fun checkForShy() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index bf14e2277..9167f3b25 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -59,8 +59,8 @@ class ShowMotesNpcSellPrice { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isInventoryValueEnabled()) return - if (event.isMod(10)) - processItems() + if (!event.isMod(10, 1)) return + processItems() } @SubscribeEvent(priority = EventPriority.LOW) 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 77c616cd6..95c3bc9d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -51,7 +51,7 @@ object VampireSlayerFeatures { private val configOwnBoss get() = config.ownBoss private val configOtherBoss get() = config.othersBoss private val configCoopBoss get() = config.coopBoss - private val configBloodIcor get() = config.bloodIchor + private val configBloodIchor get() = config.bloodIchor private val configKillerSpring get() = config.killerSpring private val entityList = mutableListOf<EntityLivingBase>() @@ -77,13 +77,13 @@ object VampireSlayerFeatures { it.process() } } - if (configBloodIcor.highlight || configKillerSpring.highlight) { + if (configBloodIchor.highlight || configKillerSpring.highlight) { EntityUtils.getEntities<EntityArmorStand>().forEach { stand -> val vec = stand.position.toLorenzVec() val distance = start.distance(vec) val isIchor = stand.hasSkullTexture(bloodIchorTexture) if (isIchor || stand.hasSkullTexture(killerSpringTexture)) { - val color = (if (isIchor) configBloodIcor.color else configKillerSpring.color) + val color = (if (isIchor) configBloodIchor.color else configKillerSpring.color) .toChromaColor().withAlpha(config.withAlpha) if (distance <= 15) { RenderLivingEntityHelper.setEntityColor( @@ -297,14 +297,14 @@ object VampireSlayerFeatures { } } } - if (configBloodIcor.highlight || configKillerSpring.highlight) { + if (configBloodIchor.highlight || configKillerSpring.highlight) { Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>().forEach { stand -> val vec = stand.position.toLorenzVec() val distance = start.distance(vec) val isIchor = stand.hasSkullTexture(bloodIchorTexture) val isSpring = stand.hasSkullTexture(killerSpringTexture) if ((isIchor && config.bloodIchor.highlight) || (isSpring && config.killerSpring.highlight)) { - val color = (if (isIchor) configBloodIcor.color else configKillerSpring.color) + val color = (if (isIchor) configBloodIchor.color else configKillerSpring.color) .toChromaColor().withAlpha(config.withAlpha) if (distance <= 15) { RenderLivingEntityHelper.setEntityColor( @@ -313,7 +313,7 @@ object VampireSlayerFeatures { ) { isEnabled() } val linesColorStart = - (if (isIchor) configBloodIcor.linesColor else configKillerSpring.linesColor).toChromaColor() + (if (isIchor) configBloodIchor.linesColor else configKillerSpring.linesColor).toChromaColor() val text = if (isIchor) "§4Ichor" else "§4Spring" event.drawColor( stand.position.toLorenzVec().add(y = 2.0), @@ -327,7 +327,7 @@ object VampireSlayerFeatures { ignoreBlocks = false ) for ((player, stand2) in standList) { - if ((configBloodIcor.showLines && isIchor) || (configKillerSpring.showLines && isSpring)) + if ((configBloodIchor.showLines && isIchor) || (configKillerSpring.showLines && isSpring)) event.draw3DLine( event.exactLocation(player).add(y = 1.5), event.exactLocation(stand2).add(y = 1.5), @@ -338,10 +338,10 @@ object VampireSlayerFeatures { ) } } - if (configBloodIcor.renderBeam && isIchor && stand.isEntityAlive) { + if (configBloodIchor.renderBeam && isIchor && stand.isEntityAlive) { event.drawWaypointFilled( event.exactLocation(stand).add(0, y = -2, 0), - configBloodIcor.color.toChromaColor(), + configBloodIchor.color.toChromaColor(), beacon = true ) } 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 81d537e35..d3cecc658 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 @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.combat.damageindicator.BossType import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.SoundUtils.playSound import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -16,22 +17,19 @@ class BlazeSlayerFirePitsWarning { private val config get() = SkyHanniMod.feature.slayer.blazes - companion object { + private var lastFirePitsWarning = SimpleTimeMark.farPast() - private var lastFirePitsWarning = 0L - - fun fireFirePits() { - LorenzUtils.sendTitle("§cFire Pits!", 2.seconds) - } + private fun fireFirePits() { + LorenzUtils.sendTitle("§cFire Pits!", 2.seconds) + lastFirePitsWarning = SimpleTimeMark.now() } @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return + if (!event.isMod(10)) return - val difference = System.currentTimeMillis() - lastFirePitsWarning - - if (difference in 1..2_000 && event.isMod(10) && config.firePitsWarning) { + if (lastFirePitsWarning.passedSince() < 2.seconds) { SoundUtils.createSound("random.orb", 0.8f).playSound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index a96a31789..a2d275123 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -104,7 +104,7 @@ class TabListData { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!event.isMod(5)) return + if (!event.isMod(2)) return val tabList = readTabList() ?: return if (cache != tabList) { |