summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/bingo
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/bingo
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/bingo')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt20
3 files changed, 10 insertions, 24 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
index e650d71fb..7332c6571 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
@@ -26,7 +26,6 @@ class BingoCardDisplay {
private val MAX_PERSONAL_GOALS = 20
private val MAX_COMMUNITY_GOALS = 5
- private var tick = 0
private var display = emptyList<String>()
private val goalCompletePattern = "§6§lBINGO GOAL COMPLETE! §r§e(?<name>.*)".toPattern()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
index 12f74a59f..82d2f4760 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.api.CollectionAPI
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.SkillExperience
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
import at.hannibal2.skyhanni.features.bingo.nextstep.*
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -15,13 +16,9 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-
-
class BingoNextStepHelper {
private val config get() = SkyHanniMod.feature.bingo.bingoCard
- private var tick = 0
private var dirty = true
private val crystalObtainedPattern = " *§r§e(?<crystalName>Topaz|Sapphire|Jade|Amethyst|Amber) Crystal".toPattern()
@@ -111,17 +108,15 @@ class BingoNextStepHelper {
}
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
+ fun onTick(event: LorenzTickEvent) {
if (!LorenzUtils.isBingoProfile) return
if (!config.enabled) return
- if (event.phase != TickEvent.Phase.START) return
- tick++
- if (tick % 20 == 0) {
+ if (event.isMod(20)) {
update()
updateIslandsVisited()
}
- if (tick % 5 == 0) {
+ if (event.isMod(5)) {
updateCurrentSteps()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
index ead79267c..41a601b0b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
@@ -2,10 +2,7 @@ package at.hannibal2.skyhanni.features.bingo
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.TitleUtils
-import at.hannibal2.skyhanni.events.GuiRenderEvent
-import at.hannibal2.skyhanni.events.InventoryOpenEvent
-import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
-import at.hannibal2.skyhanni.events.ProfileJoinEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -19,11 +16,9 @@ import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
class MinionCraftHelper {
private var minionNamePattern = "(?<name>.*) Minion (?<number>.*)".toPattern()
- private var tick = 0
private var display = emptyList<String>()
private var hasMinionInInventory = false
private var hasItemsForMinion = false
@@ -38,19 +33,16 @@ class MinionCraftHelper {
}
@SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (event.phase != TickEvent.Phase.START) return
+ fun onTick(event: LorenzTickEvent) {
if (!LorenzUtils.isBingoProfile) return
if (!SkyHanniMod.feature.bingo.minionCraftHelperEnabled) return
- tick++
-
- if (tick % 10 == 0) {
+ if (event.isMod(10)) {
val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return
hasMinionInInventory = mainInventory.mapNotNull { it?.name }.any { isMinionName(it) }
}
- if (tick % (60 * 2) == 0) {
+ if (event.isMod(60 * 2)) {
val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return
hasItemsForMinion = loadFromInventory(mainInventory).first.isNotEmpty()
}
@@ -60,8 +52,8 @@ class MinionCraftHelper {
return
}
- if (tick % 3 != 0) return
-// if (tick % 60 != 0) return
+ if (!event.isMod(3)) return
+// if (!event.isMod(60)) return
val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return