diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-02-10 00:24:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-10 00:24:52 +0100 |
commit | 4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 (patch) | |
tree | e72dac91d07fc84bea80548c89e13276caa68b81 /src/main/java/at/hannibal2/skyhanni/features | |
parent | d3a7cc4ab970b457b7950489da781539e45e0dce (diff) | |
download | skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.gz skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.bz2 skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.zip |
Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
319 files changed, 1091 insertions, 710 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index 840253166..6a9c65b8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -25,9 +25,11 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarApi { + private var loadedNpcPriceData = false companion object { + val holder = BazaarDataHolder() var inBazaarInventory = false private var currentSearchedItem = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt index f78b682d7..de37b8b9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarBestSellMethod { + private var display = "" // Working with the last clicked item manually because diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt index 5df99f31e..b0e96ca1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -42,7 +43,7 @@ class BazaarCancelledBuyOrderClipboard { patternCancelledMessage.matchMatcher(event.message) { event.blockedReason = "bazaar cancelled buy order clipbaord" val coins = group("coins") - LorenzUtils.chat("Bazaar buy order cancelled. $latestAmount saved to clipboard. ($coins coins)") + ChatUtils.chat("Bazaar buy order cancelled. $latestAmount saved to clipboard. ($coins coins)") latestAmount?.let { OSUtils.copyToClipboard(it.replace(",", "")) } latestAmount = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt index 452003c1e..5a4f956a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt @@ -3,8 +3,8 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -16,6 +16,7 @@ import kotlin.concurrent.fixedRateTimer class BazaarDataHolder { companion object { + private val bazaarData = mutableMapOf<NEUInternalName, BazaarData>() private var npcPrices = mapOf<NEUInternalName, Double>() @@ -42,7 +43,7 @@ class BazaarDataHolder { RiftAPI.motesPrice = motesPrice } catch (e: Throwable) { e.printStackTrace() - LorenzUtils.error("Error while trying to read bazaar item list from api: " + e.message) + ChatUtils.error("Error while trying to read bazaar item list from api: " + e.message) } return list } @@ -62,7 +63,7 @@ class BazaarDataHolder { private fun createNewData(internalName: NEUInternalName): BazaarData? { val stack = internalName.getItemStackOrNull() if (stack == null) { - LorenzUtils.debug("Bazaar data is null: '$internalName'") + ChatUtils.debug("Bazaar data is null: '$internalName'") return null } val displayName = stack.name!!.removeColor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt index 74922ebe4..0f03c9b0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class BazaarOpenPriceWebsite { + private val config get() = SkyHanniMod.feature.bazaar private var lastClick = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt index fa0dd8187..da828ef31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -15,11 +16,13 @@ import net.minecraft.inventory.Slot import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarOrderHelper { + private val bazaarItemNamePattern = "§.§l(?<type>BUY|SELL) (?<name>.*)".toPattern() private val filledPattern = "§7Filled: §[a6].*§7/.* §a§l100%!".toPattern() private val pricePattern = "§7Price per unit: §6(?<number>.*) coins".toPattern() companion object { + fun isBazaarOrderInventory(inventoryName: String): Boolean = when (inventoryName) { "Your Bazaar Orders" -> true "Co-op Bazaar Orders" -> true @@ -56,7 +59,7 @@ class BazaarOrderHelper { private fun highlightItem(itemName: String, slot: Slot, buyOrSell: Pair<Boolean, Boolean>) { val data = BazaarApi.getBazaarDataByName(itemName) if (data == null) { - LorenzUtils.debug("Bazaar data is null for bazaarItemName '$itemName'") + ChatUtils.debug("Bazaar data is null for bazaarItemName '$itemName'") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt index 282791154..a86a05c60 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt @@ -18,6 +18,7 @@ import java.time.OffsetDateTime import java.time.ZoneOffset object BingoAPI { + private var ranks = mapOf<String, Int>() private var data: Map<String, BingoJson.BingoData> = emptyMap() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt index eb130b06b..7c0e74cae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt @@ -2,19 +2,21 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactBingoChat { + private val config get() = SkyHanniMod.feature.event.bingo.compactChat private var inSkillLevelUp = false private var inSkyBlockLevelUp = false private var inCollectionLevelUp = false private var collectionLevelUpLastLine: String? = null - private var newArea = 0//0 = nothing, 1 = after first message, 2 = after second message + private var newArea = 0// 0 = nothing, 1 = after first message, 2 = after second message private val healthPattern = " {3}§r§7§8\\+§a.* §c❤ Health".toPattern() private val strengthPattern = " {3}§r§7§8\\+§a. §c❁ Strength".toPattern() @@ -93,7 +95,7 @@ class CompactBingoChat { if (message.contains("Trade") || message.contains("Recipe")) { val text = message.removeColor().replace(" ", "") if (text == "Trade" || text == "Recipe") { - collectionLevelUpLastLine?.let { LorenzUtils.chat(it, false) } + collectionLevelUpLastLine?.let { ChatUtils.chat(it, false) } } } else { collectionLevelUpLastLine = message diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt index f7366235c..ab5e2f3bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt @@ -25,7 +25,7 @@ object FirstMinionTier { private fun addMoreMinions( tierOneMinionsFiltered: List<NEUInternalName>, help: Map<NEUInternalName, Int>, - minions: MutableMap<String, NEUInternalName> + minions: MutableMap<String, NEUInternalName>, ) { for (minionId in tierOneMinionsFiltered) { for (recipe in NEUItems.getRecipes(minionId)) { @@ -39,7 +39,7 @@ object FirstMinionTier { recipe: CraftingRecipe, help: Map<NEUInternalName, Int>, minions: MutableMap<String, NEUInternalName>, - minionId: NEUInternalName + minionId: NEUInternalName, ) { if (recipe.getCachedIngredients().any { help.contains(it.internalItemId.asInternalName()) }) { val name = recipe.output.itemStack.name!!.removeColor() @@ -51,7 +51,7 @@ object FirstMinionTier { private fun addMinion( tierOneMinionsFiltered: List<NEUInternalName>, minions: MutableMap<String, NEUInternalName>, - tierOneMinionsDone: MutableList<NEUInternalName> + tierOneMinionsDone: MutableList<NEUInternalName>, ) { for (minionId in tierOneMinionsFiltered) { val prefix = minionId.asString().dropLast(1) @@ -63,7 +63,7 @@ object FirstMinionTier { private fun getTierOneMinionsFiltered( tierOneMinions: MutableList<NEUInternalName>, - tierOneMinionsDone: MutableList<NEUInternalName> + tierOneMinionsDone: MutableList<NEUInternalName>, ) = tierOneMinions.filter { it !in tierOneMinionsDone } private fun helpMap(otherItems: Map<NEUInternalName, Int>) = 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 dd060aa9b..930ea6883 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class MinionCraftHelper { + private val config get() = SkyHanniMod.feature.event.bingo // TODO USE SH-REPO @@ -296,5 +297,4 @@ class MinionCraftHelper { } data.add("tierOneMinionsDone", newList) } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt index 94490b1d8..f7c166d37 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt @@ -9,10 +9,11 @@ import at.hannibal2.skyhanni.events.bingo.BingoCardUpdateEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -34,6 +35,7 @@ class BingoCardDisplay { private var hasHiddenPersonalGoals = false companion object { + private const val MAX_PERSONAL_GOALS = 20 private const val MAX_COMMUNITY_GOALS = 5 @@ -50,11 +52,11 @@ class BingoCardDisplay { fun toggleCommand() { if (!LorenzUtils.isBingoProfile) { - LorenzUtils.userError("This command only works on a bingo profile!") + ChatUtils.userError("This command only works on a bingo profile!") return } if (!config.enabled) { - LorenzUtils.userError("Bingo Card is disabled in the config!") + ChatUtils.userError("Bingo Card is disabled in the config!") return } toggleMode() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt index 9dc7ee907..be27e25a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal import at.hannibal2.skyhanni.features.bingo.card.goals.GoalType import at.hannibal2.skyhanni.features.bingo.card.goals.HiddenGoalData +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -22,6 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration class BingoCardReader { + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private val percentagePattern by RepoPattern.pattern("bingo.card.percentage", " {2}§8Top §.(?<percentage>.*)%") @@ -97,7 +99,7 @@ class BingoCardReader { val oldFormat = BingoAPI.getCommunityPercentageColor(old) val newFormat = BingoAPI.getCommunityPercentageColor(new) val color = if (new > old) "§c" else "§a" - LorenzUtils.chat("$color${bingoGoal.displayName}: $oldFormat §b->" + " $newFormat") + ChatUtils.chat("$color${bingoGoal.displayName}: $oldFormat §b->" + " $newFormat") } private fun readCommuntyGoalPercentage(lore: List<String>): Double? { diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt index b219f7d44..6148848b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt @@ -16,6 +16,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BingoCardTips { + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt index f6758360b..120e66112 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.bingo.card.goals import com.google.gson.annotations.Expose class BingoGoal { + @Expose lateinit var type: GoalType diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt index 0cd5df65a..6987edb82 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt @@ -17,15 +17,17 @@ import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.ObtainCrys import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.PartialProgressItemsStep import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.ProgressionStep import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.SkillLevelStep +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BingoNextStepHelper { + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private var dirty = true @@ -41,6 +43,7 @@ class BingoNextStepHelper { private val rhysTaskName = "30x Enchanted Minerals (Redstone, Lapis Lazuli, Coal) (for Rhys)" companion object { + private val finalSteps = mutableListOf<NextStep>() private var currentSteps = emptyList<NextStep>() var currentHelp = emptyList<String>() @@ -152,7 +155,7 @@ class BingoNextStepHelper { currentStep.amountHavingHidden -= 10 } } - //TODO add thys message + // TODO add thys message // if (event.message == "thys message") { // thys.done() // } @@ -202,7 +205,7 @@ class BingoNextStepHelper { done = true updateResult() if (!silent && config.stepHelper) { - LorenzUtils.chat("A bingo goal step is done! ($displayName)") + ChatUtils.chat("A bingo goal step is done! ($displayName)") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt index e6bb7075b..d3f33a27d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt @@ -5,5 +5,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil class CollectionStep(collectionName: String, amountNeeded: Int) : ProgressionStep(NumberUtil.format(amountNeeded) + " $collectionName Collection", amountNeeded.toLong()) { + val internalName by lazy { NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt index 548318a20..cf856f001 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt @@ -5,6 +5,7 @@ open class ItemsStep(displayName: String, val itemName: String, amountNeeded: Lo class PartialProgressItemsStep(displayName: String, itemName: String, amountNeeded: Long, variants: Map<String, Int>) : ItemsStep(displayName, itemName, amountNeeded, variants) { + var amountHavingHidden: Int = 0 override val amountNeeded: Long get() = super.amountNeeded - amountHavingHidden diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt index d0a73926a..b9e9b574e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt @@ -3,5 +3,5 @@ package at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps abstract class NextStep( val displayName: String, var done: Boolean = false, - val requirements: MutableList<NextStep> = mutableListOf() + val requirements: MutableList<NextStep> = mutableListOf(), ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt index e93aa24b0..c87a8683c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt @@ -5,6 +5,6 @@ import at.hannibal2.skyhanni.data.SkillExperience class SkillLevelStep( val skillName: String, private val skillLevelNeeded: Int, - skillExpNeeded: Long = SkillExperience.getExpForLevel(skillLevelNeeded) + skillExpNeeded: Long = SkillExperience.getExpForLevel(skillLevelNeeded), ) : ProgressionStep("$skillName $skillLevelNeeded", skillExpNeeded) diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt index 72b28d013..54dc6bed0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ArachneChatMessageHider { + private val config get() = SkyHanniMod.feature.chat private var hideArachneDeadMessage = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 2c0437e01..fdeeb25e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern class ChatFilter { + private val config get() = SkyHanniMod.feature.chat.filterType /// <editor-fold desc="Regex Patterns & Messages"> @@ -97,13 +98,13 @@ class ChatFilter { "§7Putting item in escrow...", "§7Putting coins in escrow...", - //Auction House + // Auction House "§7Setting up the auction...", "§7Processing purchase...", "§7Processing bid...", "§7Claiming BIN auction...", - //Bazaar + // Bazaar "§6[Bazaar] §r§7Submitting sell offer...", "§6[Bazaar] §r§7Submitting buy order...", "§6[Bazaar] §r§7Executing instant sell...", @@ -112,18 +113,18 @@ class ChatFilter { "§6[Bazaar] §r§7Claiming order...", "§6[Bazaar] §r§7Putting goods in escrow...", - //Bank + // Bank "§8Depositing coins...", "§8Withdrawing coins..." ) // Slayer private val slayerPatterns = listOf( - //start + // start " {2}§r§5§lSLAYER QUEST STARTED!".toPattern(), " {3}§5§l» §7Slay §c(.*) Combat XP §7worth of (.*)§7.".toPattern(), - //end + // end " {2}§r§a§lSLAYER QUEST COMPLETE!".toPattern(), " {3}§r§e(.*)Slayer LVL 9 §r§5- §r§a§lLVL MAXED OUT!".toPattern(), " {3}§r§5§l» §r§7Talk to Maddox to claim your (.*) Slayer XP!".toPattern() @@ -137,7 +138,7 @@ class ChatFilter { // Slayer Drop private val slayerDropPatterns = listOf( - //Zombie + // Zombie "§b§lRARE DROP! §r§7\\(§r§f§r§9Revenant Viscera§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§9Foul Flesh§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§9Foul Flesh§r§7\\) (.*)".toPattern(), @@ -147,7 +148,7 @@ class ChatFilter { "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§9Undead Catalyst§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§2◆ Pestilence Rune I§r§7\\) §r§b(.*)".toPattern(), - //Tarantula + // Tarantula "§6§lRARE DROP! §r§9Arachne's Keeper Fragment (.+)".toPattern(), "§6§lRARE DROP! §r§5Travel Scroll to Spider's Den Top of Nest (.+)".toPattern(), "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§a◆ Bite Rune I§r§7\\) (.+)".toPattern(), @@ -155,7 +156,7 @@ class ChatFilter { "§b§lRARE DROP! §r§7\\(§r§f§r§aToxic Arrow Poison§r§7\\) (.+)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§9Bane of Arthropods VI§r§7\\) (.+)".toPattern(), - //Enderman + // Enderman "§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§aTwilight Arrow Poison§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§fMana Steal I§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§5Sinful Dice§r§7\\) (.*)".toPattern(), @@ -167,7 +168,7 @@ class ChatFilter { "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§5◆ End Rune I§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§6Hazmat Enderman§r§7\\) .*".toPattern(), - //Blaze + // Blaze "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§fWisp's Ice-Flavored Water I Splash Potion§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§5Bundle of Magma Arrows§r§7\\) (.*)".toPattern(), "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§7\\d+x §r§f§r§9(Glowstone|Blaze Rod|Magma Cream|Nether Wart) Distillate§r§7\\) (.*)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt index b9a9a6e0b..e40854c9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.data.ChatManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils @@ -15,6 +16,7 @@ import net.minecraft.util.IChatComponent import org.lwjgl.input.Mouse class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult>) : GuiScreen() { + private var scroll = -1.0 private val w = 500 private var wasMouseButtonDown = false @@ -61,11 +63,11 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult if (mouseX in 0..w && mouseY in 0..(size * 10) && (isMouseButtonDown && !wasMouseButtonDown)) { if (KeyboardManager.isShiftKeyDown()) { OSUtils.copyToClipboard(IChatComponent.Serializer.componentToJson(msg.message)) - LorenzUtils.chat("Copied structured chat line to clipboard", false) + ChatUtils.chat("Copied structured chat line to clipboard", false) } else { val message = LorenzUtils.stripVanillaMessage(msg.message.formattedText) OSUtils.copyToClipboard(message) - LorenzUtils.chat("Copied chat line to clipboard", false) + ChatUtils.chat("Copied chat line to clipboard", false) } } mouseY -= size * 10 @@ -112,10 +114,8 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult return modifiedSplitText.size } - override fun handleMouseInput() { super.handleMouseInput() setScroll(scroll - Mouse.getEventDWheel()) } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt index 5d5580772..2d275d9b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatPeek.kt @@ -2,17 +2,17 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.GuiEditManager -import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui +import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.NEUItems import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiEditSign import org.lwjgl.input.Keyboard - object ChatPeek { + @JvmStatic fun peek(): Boolean { val key = SkyHanniMod.feature.chat.peekChat @@ -27,4 +27,4 @@ object ChatPeek { return key.isKeyHeld() } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt index 1399ae216..b4b8b10eb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -67,13 +68,12 @@ class CompactBestiaryChatMessage { val list = bestiaryDescription.map { it.replace("§f", "").trim() } val title = list[1] - LorenzUtils.hoverableChat("§6§lBESTIARY §r$title", list.dropLast(1), command, false) + ChatUtils.hoverableChat("§6§lBESTIARY §r$title", list.dropLast(1), command, false) bestiaryDescription.clear() acceptMoreDescription = true - } else { milestoneMessage?.let { - LorenzUtils.chat("§6§lBESTIARY MILESTONE $it", false) + ChatUtils.chat("§6§lBESTIARY MILESTONE $it", false) milestoneMessage = null } milestonePattern.matchEntire(message)?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt index 4cd9e757d..8b4762948 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName @@ -9,6 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactSplashPotionMessage { + private val config get() = SkyHanniMod.feature.chat.compactPotionMessages private val potionEffectPatternList = listOf( @@ -32,14 +34,14 @@ class CompactSplashPotionMessage { private fun sendMessage(message: String) { if (config.clickableChatMessage) { - LorenzUtils.hoverableChat( + ChatUtils.hoverableChat( message, listOf("§eClick to view your potion effects."), "/effects", prefix = false ) } else { - LorenzUtils.chat(message, prefix = false) + ChatUtils.chat(message, prefix = false) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index 0c20c849f..3f0c4b700 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils @@ -43,7 +44,7 @@ class PlayerDeathMessages { val reason = group("reason").removeColor() val color = SkyHanniMod.feature.markedPlayers.chatColor.getChatColor() - LorenzUtils.chat(" §c☠ $color$name §7$reason", false) + ChatUtils.chat(" §c☠ $color$name §7$reason", false) event.blockedReason = "marked_player_death" return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt index a4b7604ce..8859220ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ActionBarStatsData import at.hannibal2.skyhanni.events.ActionBarValueUpdate -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkyblockXPInChat { @@ -14,6 +14,6 @@ class SkyblockXPInChat { fun onActionBarValueUpdate(event: ActionBarValueUpdate) { if (event.updated != ActionBarStatsData.SKYBLOCK_XP) return if (!config) return - LorenzUtils.chat(event.updated.value) + ChatUtils.chat(event.updated.value) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt index 3cc67e617..01d893467 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.SkyHanniMod.Companion.coroutineScope import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.APIUtil -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.transformIf +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.transformIf import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.getPlayerNameFromChatMessage import com.google.gson.JsonArray @@ -20,6 +20,7 @@ import java.net.URLDecoder import java.net.URLEncoder class Translator { + private val messageContentRegex = Regex(".*: (.*)") // Logic for listening for a user click on a chat message is from NotEnoughUpdates @@ -54,8 +55,8 @@ class Translator { return style } - companion object { + private val config get() = SkyHanniMod.feature.chat /* @@ -144,15 +145,15 @@ class Translator { coroutineScope.launch { val translation = getTranslationToEnglish(message) - if (translation == "Unable to translate!") LorenzUtils.userError("Unable to translate message :( (is it in English?)") - else LorenzUtils.chat("Found translation: §f$translation") + if (translation == "Unable to translate!") ChatUtils.userError("Unable to translate message :( (is it in English?)") + else ChatUtils.chat("Found translation: §f$translation") } } fun fromEnglish(args: Array<String>) { if (!isEnabled()) return if (args.size < 2 || args[0].length != 2) { // args[0] is the language code - LorenzUtils.userError("Usage: /shcopytranslation <two letter language code (at the end of a translation)> <message>") + ChatUtils.userError("Usage: /shcopytranslation <two letter language code (at the end of a translation)> <message>") return } val language = args[0] @@ -163,7 +164,7 @@ class Translator { coroutineScope.launch { val translation = getTranslationFromEnglish(message, language) - LorenzUtils.chat("Copied translation to clipboard: $translation") + ChatUtils.chat("Copied translation to clipboard: $translation") OSUtils.copyToClipboard(translation) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt index f70c10ea0..11e51e686 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -47,6 +47,7 @@ class WatchdogHider { } companion object { + private const val watchdogStartLine = "§f" private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]" private const val watchdogEndLine = "§c" diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt index 4a80f8084..024835aeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.chat.playerchat +import at.hannibal2.skyhanni.data.jsonobjects.repo.PlayerChatFilterJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.MultiFilter -import at.hannibal2.skyhanni.data.jsonobjects.repo.PlayerChatFilterJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PlayerChatFilter { 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 c95763adf..a9c302021 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 @@ -69,7 +69,7 @@ class PlayerChatModifier { // TODO remove workaround if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) { - //all players same color in chat + // all players same color in chat string = string.replace("§r§7: ", "§r§f: ") } } @@ -93,6 +93,4 @@ class PlayerChatModifier { event.move(3, "chat.playerRankHider", "chat.playerMessage.playerRankHider") event.move(3, "chat.chatFilter", "chat.playerMessage.chatFilter") } - - } 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 902caadf0..61e69a67b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt @@ -15,6 +15,7 @@ import net.minecraft.client.Minecraft */ object ChromaShader : Shader("chroma", "chroma") { + val config get() = SkyHanniMod.feature.chroma val INSTANCE: ChromaShader get() = this diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index 49526c6f8..a5b0cd386 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -9,12 +9,12 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -168,7 +168,8 @@ object BestiaryData { for ((lineIndex, line) in stack.getLore().withIndex()) { val loreLine = line.removeColor() if (loreLine.startsWith("Kills: ")) { - actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatNumber() ?: 0 + actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatNumber() + ?: 0 } if (!loreLine.startsWith(" ")) continue val previousLine = stack.getLore()[lineIndex - 1] @@ -437,7 +438,7 @@ object BestiaryData { val name: String, val familiesFound: Long, val totalFamilies: Long, - val familiesCompleted: Long + val familiesCompleted: Long, ) data class BestiaryMob( @@ -447,7 +448,7 @@ object BestiaryData { var totalKills: Long, var killNeededForNextLevel: Long, var currentKillToNextLevel: Long, - var actualRealTotalKill: Long + var actualRealTotalKill: Long, ) { fun killNeededToMax(): Long { @@ -482,5 +483,4 @@ object BestiaryData { } private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt index 8f419f803..5562a4bf4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt @@ -8,9 +8,10 @@ enum class BossType( val fullName: String, val bossTypeToggle: Type, val shortName: String = fullName, - val showDeathTime: Boolean = false + val showDeathTime: Boolean = false, ) { - //Nether Mini Bosses + + // Nether Mini Bosses NETHER_BLADESOUL("§8Bladesoul", Type.NETHER_MINI_BOSSES), NETHER_MAGMA_BOSS("§4Magma Boss", Type.NETHER_MINI_BOSSES), NETHER_ASHFANG("§cAshfang", Type.NETHER_MINI_BOSSES), @@ -20,7 +21,7 @@ enum class BossType( NETHER_VANQUISHER("§5Vanquisher", Type.VANQUISHER), END_ENDSTONE_PROTECTOR("§cEndstone Protector", Type.ENDERSTONE_PROTECTOR), - END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON),//TODO fix totally + END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON),// TODO fix totally SLAYER_ZOMBIE_1("§aRevenant Horror 1", Type.REVENANT_HORROR, "§aRev 1", showDeathTime = true), SLAYER_ZOMBIE_2("§eRevenant Horror 2", Type.REVENANT_HORROR, "§eRev 2", showDeathTime = true), @@ -66,7 +67,6 @@ enum class BossType( HUB_HEADLESS_HORSEMAN("§6Headless Horseman", Type.HEADLESS_HORSEMAN), - DUNGEON_F1_BONZO_FIRST("§cFunny Bonzo", Type.DUNGEON_FLOOR_1), DUNGEON_F1_BONZO_SECOND("§cSad Bonzo", Type.DUNGEON_FLOOR_1), @@ -106,7 +106,7 @@ enum class BossType( LEECH_SUPREME("§cLeech Supreme", Type.THE_RIFT_BOSSES), BACTE("§aBacte", Type.THE_RIFT_BOSSES), - WINTER_REINDRAKE("Reindrake", Type.REINDRAKE),//TODO fix totally + WINTER_REINDRAKE("Reindrake", Type.REINDRAKE),// TODO fix totally GARDEN_PEST_BEETLE("§cBeetle", Type.GARDEN_PESTS), GARDEN_PEST_CRICKET("§cCricket", Type.GARDEN_PESTS), @@ -119,11 +119,10 @@ enum class BossType( GARDEN_PEST_SLUG("§cSlug", Type.GARDEN_PESTS), GARDEN_PEST_EARTHWORM("§cEarthworm", Type.GARDEN_PESTS), - //TODO arachne - - //TODO corelone - //TODO bal + // TODO arachne + // TODO corelone + // TODO bal /** * TODO dungeon mini bosses @@ -136,5 +135,5 @@ enum class BossType( * */ - //TODO diana mythological creatures + // TODO diana mythological creatures } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt index 1595b728a..9bf83e04e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt @@ -8,5 +8,4 @@ class DamageCounter { var currentHealing = 0L var oldDamages = LinkedList<OldDamage>() var firstTick = 0L - -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 3e6b2e6da..b87002c0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -18,6 +18,9 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.CollectionUtils.put import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen @@ -28,10 +31,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor 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.put import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.LorenzUtils.ticks import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -41,6 +41,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils.format +import at.hannibal2.skyhanni.utils.TimeUtils.ticks import at.hannibal2.skyhanni.utils.getLorenzVec import com.google.gson.JsonArray import net.minecraft.client.Minecraft @@ -71,6 +72,7 @@ class DamageIndicatorManager { private val enderSlayerHitsNumberPattern = ".* §[5fd]§l(?<hits>\\d+) Hits?".toPattern() companion object { + private var data = mapOf<UUID, EntityData>() private val damagePattern = "[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)".toPattern() @@ -129,7 +131,7 @@ class DamageIndicatorManager { GlStateManager.disableDepth() GlStateManager.disableCull() - //TODO config to define between 100ms and 5 sec + // TODO config to define between 100ms and 5 sec val filter = data.filter { val waitForRemoval = if (it.value.dead && !noDeathDisplay(it.value.bossType)) 4_000 else 100 (System.currentTimeMillis() > it.value.timeLastTick + waitForRemoval) || (it.value.dead && noDeathDisplay(it.value.bossType)) @@ -169,7 +171,7 @@ class DamageIndicatorManager { for (data in data.values) { - //TODO test end stone protector in hole? - maybe change eye pos + // TODO test end stone protector in hole? - maybe change eye pos // data.ignoreBlocks = // data.bossType == BossType.END_ENDSTONE_PROTECTOR && Minecraft.getMinecraft().thePlayer.isSneaking @@ -266,7 +268,6 @@ class DamageIndicatorManager { diff += 9f } } - } GlStateManager.enableDepth() GlStateManager.enableCull() @@ -285,7 +286,7 @@ class DamageIndicatorManager { BossType.SLAYER_BLAZE_QUAZII_3, BossType.SLAYER_BLAZE_QUAZII_4, - //TODO f3/m3 4 guardians, f2/m2 4 boss room fighters + // TODO f3/m3 4 guardians, f2/m2 4 boss room fighters -> true else -> false @@ -399,7 +400,7 @@ class DamageIndicatorManager { val thorn = checkThorn(health, maxHealth) if (thorn == null) { val floor = DungeonAPI.dungeonFloor - LorenzUtils.error("problems with thorn detection! ($floor, $health/$maxHealth)") + ChatUtils.error("problems with thorn detection! ($floor, $health/$maxHealth)") } return thorn } @@ -437,7 +438,7 @@ class DamageIndicatorManager { BossType.SLAYER_ZOMBIE_5 -> { if ((entity as EntityZombie).hasNameTagWith(3, "§fBoom!")) { - //TODO fix + // TODO fix // val ticksAlive = entity.ticksExisted % (20 * 5) // val remainingTicks = (5 * 20).toLong() - ticksAlive // val format = formatDelay(remainingTicks * 50) @@ -545,9 +546,9 @@ class DamageIndicatorManager { } } + " §f" - //hide while in the middle + // hide while in the middle // val position = entity.getLorenzVec() - //TODO other logic or something + // TODO other logic or something // entityData.healthLineHidden = position.x == -368.0 && position.z == -804.0 var calcHealth = -1 @@ -562,7 +563,7 @@ class DamageIndicatorManager { calcHealth = 0 break } else { - LorenzUtils.error("unknown magma boss health sidebar format!") + ChatUtils.error("unknown magma boss health sidebar format!") break } @@ -641,7 +642,7 @@ class DamageIndicatorManager { entityData.namePrefix = "" } - //Hit phase + // Hit phase var hitPhaseText: String? = null val armorStandHits = entity.getNameTagWith(3, " Hit") if (armorStandHits != null) { @@ -659,7 +660,7 @@ class DamageIndicatorManager { hitPhaseText = NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits" } - //Laser phase + // Laser phase if (config.enderSlayer.laserPhaseTimer && entity.ridingEntity != null) { val totalTimeAlive = 8.2.seconds @@ -776,7 +777,7 @@ class DamageIndicatorManager { } } } else { - LorenzUtils.error("Invalid/impossible thorn floor!") + ChatUtils.error("Invalid/impossible thorn floor!") return null } val color = NumberUtil.percentageColor(health.toLong(), maxHealth.toLong()) @@ -791,7 +792,7 @@ class DamageIndicatorManager { damageCounter.currentDamage += damage } if (healing > 0) { - //Hide auto heal every 10 ticks (with rounding errors) + // Hide auto heal every 10 ticks (with rounding errors) if ((healing == 15_000L || healing == 15_001L) && entityData.bossType == BossType.SLAYER_ZOMBIE_5) return val damageCounter = entityData.damageCounter @@ -905,7 +906,6 @@ class DamageIndicatorManager { result } - } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt index af07242a6..1ab969946 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt @@ -25,6 +25,7 @@ class EntityData( var firstDeath: Boolean = false, // TODO this defines if hp is very low, replace dead with this later var deathLocation: LorenzVec? = null, ) { + val timeToKill by lazy { "§e" + foundTime.passedSince().format(TimeUnit.SECOND, showMilliSeconds = true) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt index 3bc048aa0..6c284d596 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt @@ -45,20 +45,20 @@ import java.util.UUID class MobFinder { - //F1 + // F1 private var floor1bonzo1 = false private var floor1bonzo1SpawnTime = 0L private var floor1bonzo2 = false private var floor1bonzo2SpawnTime = 0L - //F2 + // F2 private var floor2summons1 = false private var floor2summons1SpawnTime = 0L private var floor2summonsDiedOnce = mutableListOf<EntityOtherPlayerMP>() private var floor2secondPhase = false private var floor2secondPhaseSpawnTime = 0L - //F3 + // F3 private var floor3GuardianShield = false private var floor3GuardianShieldSpawnTime = 0L private var guardians = mutableListOf<EntityGuardian>() @@ -69,13 +69,13 @@ class MobFinder { private var floor3ProfessorGuardian = false private var floor3ProfessorGuardianEntity: EntityGuardian? = null - //F5 + // F5 private var floor5lividEntity: EntityOtherPlayerMP? = null private var floor5lividEntitySpawnTime = 0L private val correctLividPattern = "§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!".toPattern() - //F6 + // F6 private var floor6Giants = false private var floor6GiantsSpawnTime = 0L private var floor6GiantsSeparateDelay = mutableMapOf<UUID, Pair<Long, BossType>>() @@ -166,7 +166,7 @@ class MobFinder { } if (floor2secondPhase && entity is EntityOtherPlayerMP) { - //TODO only show scarf after (all/at least x) summons are dead? + // TODO only show scarf after (all/at least x) summons are dead? if (entity.name == "Scarf ") { return EntityResult( floor2secondPhaseSpawnTime, @@ -343,7 +343,7 @@ class MobFinder { } } - //TODO testing and use sidebar data + // TODO testing and use sidebar data private fun tryAddEntityDragon(entity: EntityLivingBase) = when { IslandType.THE_END.isInIsland() -> EntityResult(bossType = BossType.END_ENDER_DRAGON) IslandType.WINTER.isInIsland() -> EntityResult(bossType = BossType.WINTER_REINDRAKE) @@ -482,22 +482,21 @@ class MobFinder { var pos = 0 - val type: BossType if (loc.x > middle.x && loc.z > middle.z) { - //first + // first pos = 2 type = BossType.DUNGEON_F6_GIANT_3 } else if (loc.x > middle.x && loc.z < middle.z) { - //second + // second pos = 3 type = BossType.DUNGEON_F6_GIANT_4 } else if (loc.x < middle.x && loc.z < middle.z) { - //third + // third pos = 0 type = BossType.DUNGEON_F6_GIANT_1 } else if (loc.x < middle.x && loc.z > middle.z) { - //fourth + // fourth pos = 1 type = BossType.DUNGEON_F6_GIANT_2 } else { @@ -505,7 +504,6 @@ class MobFinder { type = BossType.DUNGEON_F6_GIANT_1 } - val extraDelay = 900L * pos val pair = Pair(extraDelay, type) floor6GiantsSeparateDelay[uuid] = pair @@ -516,7 +514,7 @@ class MobFinder { fun handleChat(message: String) { if (!LorenzUtils.inDungeons) return when (message) { - //F1 + // F1 "§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I'm basically unbeatable." -> { floor1bonzo1 = true floor1bonzo1SpawnTime = System.currentTimeMillis() + 11_250 @@ -535,7 +533,7 @@ class MobFinder { floor1bonzo2 = false } - //F2 + // F2 "§c[BOSS] Scarf§r§f: ARISE, MY CREATIONS!" -> { floor2summons1 = true floor2summons1SpawnTime = System.currentTimeMillis() + 3_500 @@ -554,7 +552,7 @@ class MobFinder { floor2secondPhase = false } - //F3 + // F3 "§c[BOSS] The Professor§r§f: I was burdened with terrible news recently..." -> { floor3GuardianShield = true floor3GuardianShieldSpawnTime = System.currentTimeMillis() + 15_400 @@ -582,13 +580,13 @@ class MobFinder { floor3ProfessorGuardian = false } - //F5 + // F5 "§c[BOSS] Livid§r§f: This Orb you see, is Thorn, or what is left of him." -> { floor5lividEntity = DungeonLividFinder.lividEntity floor5lividEntitySpawnTime = System.currentTimeMillis() + 13_000 } - //F6 + // F6 "§c[BOSS] Sadan§r§f: ENOUGH!" -> { floor6Giants = true floor6GiantsSpawnTime = System.currentTimeMillis() + 7_400 @@ -614,7 +612,6 @@ class MobFinder { if (LorenzUtils.inDungeons && floor3ProfessorGuardian && entity is EntityGuardian && floor3ProfessorGuardianEntity == null) { floor3ProfessorGuardianEntity = entity floor3ProfessorGuardianPrepare = false - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index 87f83208a..adb0edd38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -11,12 +11,12 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.SackChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -28,6 +28,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object EnderNodeTracker { + private val config get() = SkyHanniMod.feature.combat.enderNodeTracker private var miteGelInInventory = 0 @@ -191,7 +192,8 @@ object EnderNodeTracker { EnderNode.END_LEGGINGS, EnderNode.END_BOOTS, EnderNode.ENDER_NECKLACE, - EnderNode.ENDER_GAUNTLET -> true + EnderNode.ENDER_GAUNTLET, + -> true else -> false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index be138463f..5c1e0976e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -24,6 +24,9 @@ import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.formatText import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.isUsingCTGhostCounter import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.preFormat import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.prettyTime +import at.hannibal2.skyhanni.utils.ChatUtils.chat +import at.hannibal2.skyhanni.utils.ChatUtils.clickableChat +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CombatUtils._isKilling import at.hannibal2.skyhanni.utils.CombatUtils.calculateETA import at.hannibal2.skyhanni.utils.CombatUtils.calculateXP @@ -38,9 +41,6 @@ import at.hannibal2.skyhanni.utils.CombatUtils.xpGainHourLast import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.chat -import at.hannibal2.skyhanni.utils.LorenzUtils.clickableChat import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -131,7 +131,10 @@ object GhostCounter { } val avgMagicFind = when (Option.TOTALDROPS.get()) { 0.0 -> "0" - else -> "${((((storage?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100).roundToPrecision(2)}" + else -> { + val mf = (((storage?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100 + mf.roundToPrecision(2).toString() + } } val xpHourFormatting = textFormatting.xpHourFormatting @@ -424,7 +427,7 @@ object GhostCounter { Option.KILLCOMBO.set(0.0) update() } - //replace with BestiaryLevelUpEvent ? + // replace with BestiaryLevelUpEvent ? bestiaryPattern.matchMatcher(event.message) { val currentLevel = group("nextLevel").toInt() when (val nextLevel = if (currentLevel >= 25) 26 else currentLevel + 1) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt index 9c5de8c43..61e03cf97 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.combat.ghostcounter import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.ProfileStorageData -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision @@ -65,7 +65,7 @@ object GhostUtil { val c = ProfileStorageData.profileSpecific?.ghostCounter ?: return if (isUsingCTGhostCounter()) { if (c.ctDataImported) { - LorenzUtils.userError("You already imported GhostCounterV3 data!") + ChatUtils.userError("You already imported GhostCounterV3 data!") return } val json = ConfigManager.gson.fromJson( @@ -83,9 +83,9 @@ object GhostUtil { ?: json["TotalMF"].asDouble GhostData.Option.TOTALDROPS.add(json["TotalDrops"].asDouble) c.ctDataImported = true - LorenzUtils.chat("§aImported data successfully!") + ChatUtils.chat("§aImported data successfully!") } else - LorenzUtils.error("GhostCounterV3 ChatTriggers module not found!") + ChatUtils.error("GhostCounterV3 ChatTriggers module not found!") } fun String.formatText(option: GhostData.Option) = formatText(option.getInt(), option.getInt(true)) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt index af7c4804d..e3d76a41e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt @@ -25,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class AreaMiniBossFeatures { + private val config get() = SkyHanniMod.feature.combat.mobs private var lastSpawnTime = SimpleTimeMark.farPast() private var miniBossType: AreaMiniBossType? = null @@ -92,8 +93,9 @@ class AreaMiniBossFeatures { val health: Int, val color: LorenzColor, val colorOpacity: Int, - vararg val spawnLocations: LorenzVec + vararg val spawnLocations: LorenzVec, ) { + GOLDEN_GHOUL( EntityZombie::class.java, 45_000, LorenzColor.YELLOW, 127, LorenzVec(-99.7, 39.0, -86.4), diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt index 657e13d73..aa861a29b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt @@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangMinisNametagHider { + private val config get() = SkyHanniMod.feature.combat.mobs @SubscribeEvent(priority = EventPriority.HIGH) @@ -25,4 +26,4 @@ class AshfangMinisNametagHider { event.isCanceled = true } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt index b55fc7c03..d7ecc8f52 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt @@ -18,6 +18,7 @@ import net.minecraft.entity.monster.EntitySpider import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class MobHighlight { + private val config get() = SkyHanniMod.feature.combat.mobs @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt index 81426c90f..08c8ddf31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt @@ -22,12 +22,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds
class SpawnTimers {
+
private val config get() = SkyHanniMod.feature.combat.mobs
private val arachneAltarLocation = LorenzVec(-283f, 51f, -179f)
private var arachneSpawnTime = SimpleTimeMark.farPast()
- private val arachneFragmentMessage = "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$".toPattern()
- private val arachneCrystalMessage = "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$".toPattern()
+ private val arachneFragmentMessage =
+ "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$".toPattern()
+ private val arachneCrystalMessage =
+ "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$".toPattern()
private var saveNextTickParticles = false
private var particleCounter = 0
private var tickTime: Long = 0
@@ -76,7 +79,7 @@ class SpawnTimers { if (particleCounter == 0 && tickTime == 0L) tickTime = System.currentTimeMillis()
if (System.currentTimeMillis() > tickTime + 60) {
- arachneSpawnTime = if (particleCounter <= 20) {
+ arachneSpawnTime = if (particleCounter <= 20) {
SimpleTimeMark.now() + 21.seconds
} else {
SimpleTimeMark.now() + 37.seconds
@@ -95,5 +98,6 @@ class SpawnTimers { }
}
- fun isEnabled() = IslandType.SPIDER_DEN.isInIsland() && LorenzUtils.skyBlockArea == "Arachne's Sanctuary" && config.showArachneSpawnTimer
+ fun isEnabled() =
+ IslandType.SPIDER_DEN.isInIsland() && LorenzUtils.skyBlockArea == "Arachne's Sanctuary" && config.showArachneSpawnTimer
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt index 5f3217cdf..6b352ca8c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PartyCommands { + private val config get() = SkyHanniMod.feature.commands fun kickOffline() { @@ -61,7 +62,8 @@ object PartyCommands { return } if (!event.message.startsWith("/party kick ", ignoreCase = true) - && !event.message.startsWith("/p kick ", ignoreCase = true)) { + && !event.message.startsWith("/p kick ", ignoreCase = true) + ) { return } val args = event.message.split(" ") diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt index a41547c68..34797780b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -12,11 +12,11 @@ class SendCoordinatedCommand { val message = event.message if (message == "/sendcoords") { event.isCanceled = true - LorenzUtils.sendMessageToServer(getCoordinates()) + LorenzUtils.sendCommandToServer(getCoordinates()) } else if (message.startsWith("/sendcoords ")) { event.isCanceled = true val description = message.split(" ").drop(1).joinToString(" ") - LorenzUtils.sendMessageToServer("${getCoordinates()} $description") + LorenzUtils.sendCommandToServer("${getCoordinates()} $description") } } @@ -27,5 +27,4 @@ class SendCoordinatedCommand { val z = location.z.toInt() return "x: $x, y: $y, z: $z" } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index c486f6f50..26873a2ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ViewRecipeCommand { + private val config get() = SkyHanniMod.feature.commands @SubscribeEvent @@ -16,7 +17,7 @@ object ViewRecipeCommand { if (message == message.uppercase()) return if (message.startsWith("/viewrecipe ", ignoreCase = true)) { event.isCanceled = true - LorenzUtils.sendMessageToServer(message.uppercase()) + LorenzUtils.sendCommandToServer(message.uppercase()) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt index 4cb06b568..183238762 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt @@ -14,7 +14,7 @@ class WarpIsCommand { if (event.message.lowercase() == "/warp is") { event.isCanceled = true - LorenzUtils.sendMessageToServer("/is") + LorenzUtils.sendCommandToServer("/is") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt index c1aab3a1c..ff3b4fac3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.MessageSendToServerEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment @@ -60,7 +61,7 @@ object WikiManager { fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) { if (!LorenzUtils.inSkyBlock) return val gui = event.gui as? GuiContainer ?: return - if (NEUItems.neuHasFocus()) return //because good heavens if this worked on neuitems... + if (NEUItems.neuHasFocus()) return // because good heavens if this worked on neuitems... val stack = gui.slotUnderMouse?.stack ?: return if (!config.wikiKeybind.isKeyHeld()) return @@ -78,7 +79,7 @@ object WikiManager { fun otherWikiCommands(args: Array<String>, useFandom: Boolean, wikithis: Boolean = false) { if (wikithis && !LorenzUtils.inSkyBlock) { - LorenzUtils.chat("§cYou must be in SkyBlock to do this!") + ChatUtils.chat("§cYou must be in SkyBlock to do this!") return } @@ -87,7 +88,7 @@ object WikiManager { if (wikithis) { val itemInHand = InventoryUtils.getItemInHand() ?: run { - LorenzUtils.chat("§cYou must be holding an item to use this command!") + ChatUtils.chat("§cYou must be holding an item to use this command!") return } wikiTheItem(itemInHand, false, useFandom = useFandom) @@ -107,7 +108,7 @@ object WikiManager { val wiki = if (useFandom) "SkyBlock Fandom Wiki" else "Official SkyBlock Wiki" val urlPrefix = if (useFandom) FANDOM_URL_PREFIX else OFFICIAL_URL_PREFIX if (search == "") { - LorenzUtils.clickableLinkChat( + ChatUtils.clickableLinkChat( "§7Click §e§lHERE §7to visit the §6$wiki§7!", urlPrefix, "§7The $wiki!" ) return @@ -116,7 +117,7 @@ object WikiManager { val urlSearchPrefix = if (useFandom) "$urlPrefix$FANDOM_SEARCH_PREFIX" else "$urlPrefix$OFFICIAL_SEARCH_PREFIX" val searchUrl = "$urlSearchPrefix${URLEncoder.encode(search, "UTF-8")}&scope=internal" - LorenzUtils.clickableLinkChat( + ChatUtils.clickableLinkChat( "§7Click §e§lHERE §7to find §a$displaySearch §7on the §6$wiki§7!", searchUrl, "§7View §a$displaySearch §7on the §6$wiki§7!", diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt index f3738c6b4..e4b0071ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GetFromSacksTabComplete { + private val config get() = SkyHanniMod.feature.commands.tabComplete private var sackList = emptyList<String>() private val commands = arrayOf("gfs", "getfromsacks") @@ -36,7 +37,7 @@ object GetFromSacksTabComplete { if (realName == rawName) return if (realName !in sackList) return event.isCanceled = true - LorenzUtils.sendMessageToServer(message.replace(rawName, realName)) + LorenzUtils.sendCommandToServer(message.replace(rawName, realName)) } fun isEnabled() = LorenzUtils.inSkyBlock && config.gfsSack diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt index 9df128920..3384db554 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt @@ -4,14 +4,15 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.EntityUtils.isNPC -import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PlayerTabComplete { + private val config get() = SkyHanniMod.feature.commands.tabComplete private var vipVisits = listOf<String>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt index c5487fdb8..53a0a8f84 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.features.commands.tabcomplete import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.jsonobjects.repo.WarpsJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.data.jsonobjects.repo.WarpsJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object WarpTabComplete { + private val config get() = SkyHanniMod.feature.commands.tabComplete private var warps = listOf<String>() 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 da18e8d28..482799d27 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.SimpleTimeMark diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 9e77ab6e4..7f617fc64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -5,10 +5,10 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation @@ -20,6 +20,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds class CosmeticFollowingLine { + private val config get() = SkyHanniMod.feature.misc.cosmetic.followingLine private var locations = mapOf<LorenzVec, LocationSpot>() @@ -49,7 +50,7 @@ class CosmeticFollowingLine { private fun renderFar( event: LorenzRenderWorldEvent, firstPerson: Boolean, - color: Color + color: Color, ) { val last7 = locations.keys.toList().takeLast(7) val last2 = locations.keys.toList().takeLast(2) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index c1d8415e0..bb38d09b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -10,12 +10,11 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf -import at.hannibal2.skyhanni.utils.LorenzUtils.getOrNull import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -25,6 +24,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonAPI { + private val floorPattern = " §7⏣ §cThe Catacombs §7\\((?<floor>.*)\\)".toPattern() private val uniqueClassBonus = "^Your ([A-Za-z]+) stats are doubled because you are the only player using this class!$".toRegex() @@ -37,6 +37,7 @@ class DungeonAPI { private val totalKillsPattern = "§7Total Kills: §e(?<kills>.*)".toPattern() companion object { + var dungeonFloor: String? = null var started = false var inBossRoom = false @@ -170,7 +171,7 @@ class DungeonAPI { private fun readOneMaxCollection( bossCollections: MutableMap<DungeonFloor, Int>, inventoryItems: Map<Int, ItemStack>, - inventoryName: String + inventoryName: String, ) { inventoryItems[48]?.let { item -> if (item.name == "§aGo Back") { @@ -248,6 +249,7 @@ class DungeonAPI { F7("Necron"); companion object { + fun byBossName(bossName: String) = DungeonFloor.entries.firstOrNull { it.bossName == bossName } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt index 51ee98029..48765a095 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt @@ -16,7 +16,7 @@ class DungeonBossMessages { ) private val messageList = listOf( - //M7 – Dragons + // M7 – Dragons "§cThe Crystal withers your soul as you hold it in your hands!", "§cIt doesn't seem like that is supposed to go there." ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt index a133cb6be..acdc50f95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt @@ -224,7 +224,7 @@ class DungeonChatFilter { } } - private fun String.isFiltered(key: MessageTypes) : Boolean { + private fun String.isFiltered(key: MessageTypes): Boolean { return config.dungeonFilteredMessageTypes.contains(key) && this.isPresent(key) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index 4ee2c8761..7e436eb36 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -78,7 +79,7 @@ class DungeonCleanEnd { if (event.health <= 0.5) { val dungeonFloor = DungeonAPI.dungeonFloor - LorenzUtils.chat("§eFloor $dungeonFloor done!", false) + ChatUtils.chat("§eFloor $dungeonFloor done!", false) bossDone = true } } @@ -126,5 +127,4 @@ class DungeonCleanEnd { event.move(3, "dungeon.cleanEndToggle", "dungeon.cleanEnd.enabled") event.move(3, "dungeon.cleanEndF3IgnoreGuardians", "dungeon.cleanEnd.F3IgnoreGuardians") } - } 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 794736954..8510b6b6c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.DungeonStartEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -55,7 +56,7 @@ class DungeonDeathCounter { if (isDeathMessage(event.message)) { deaths++ - LorenzUtils.chat("§c§l$deaths. DEATH!", false) + ChatUtils.chat("§c§l$deaths. DEATH!", false) update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt index 0413be873..4521aa2b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt @@ -21,6 +21,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonFinderFeatures {
+
private val config get() = SkyHanniMod.feature.dungeon.partyFinder
private val pricePattern = "([0-9]{2,3}K|[0-9]{1,3}M|[0-9]+\\.[0-9]M|[0-9] ?mil)".toRegex(RegexOption.IGNORE_CASE)
@@ -170,7 +171,6 @@ class DungeonFinderFeatures { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(2, "dungeon.partyFinderColoredClassLevel", "dungeon.partyFinder.coloredClassLevel")
}
-
}
fun getColor(level: Int): String {
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 0c5b4fc52..291b7775b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -29,6 +29,7 @@ import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object DungeonLividFinder { + private val config get() = SkyHanniMod.feature.dungeon.lividFinder private val blockLocation = LorenzVec(6, 109, 43) 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 fc5462901..3547a4827 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer class DungeonMilestonesDisplay { + private val config get() = SkyHanniMod.feature.dungeon companion object { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt index 46e2e0514..eda282161 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonRankTabListColor { + private val config get() = SkyHanniMod.feature.dungeon.tabList private val pattern = "§r(?<playerName>.*) §r§f\\(§r§d(?<className>.*) (?<classLevel>.*)§r§f\\)§r".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt index 445b9676f..103bf35df 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt @@ -12,6 +12,7 @@ import net.minecraft.scoreboard.Team import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonTeammateOutlines {
+
private val config get() = SkyHanniMod.feature.dungeon
@SubscribeEvent
@@ -35,5 +36,4 @@ class DungeonTeammateOutlines { Minecraft.getMinecraft().fontRendererObj.getColorCode(colorFormat[1])
else null
}
-
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt index 9cc992922..4447db0b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt @@ -11,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TerracottaPhase { + private val config get() = SkyHanniMod.feature.dungeon.terracottaPhase private var inTerracottaPhase = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt index 78fbbe836..2442027e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt @@ -27,6 +27,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object UniqueGiftingOpportunitiesFeatures { + private val playerList: MutableSet<String>? get() = ProfileStorageData.playerSpecific?.winter?.playersThatHaveBeenGifted @@ -62,7 +63,6 @@ object UniqueGiftingOpportunitiesFeatures { val matchedPlayer = EntityUtils.getEntitiesNearby<EntityPlayer>(entity.getLorenzVec(), 2.0) .singleOrNull { !it.isNPC() } ?: return addGiftedPlayer(matchedPlayer.name) - } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt index 71d8040f3..0123e94d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt @@ -21,6 +21,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds object Year300RaffleEvent { + private val config get() = SkyHanniMod.feature.event.century val displayItem by lazy { NEUItems.getItemStackOrNull("EPOCH_CAKE_ORANGE") ?: ItemStack(Items.clock) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt index db6de093f..8fabffb8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt @@ -5,5 +5,4 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark object BurrowAPI { var lastBurrowRelatedChatMessage = SimpleTimeMark.farPast() - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index 1b9e12195..43ae77b5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft @@ -50,8 +51,8 @@ class BurrowWarpHelper { if (lastWarpTime.passedSince() < 1.seconds) { lastWarp?.let { it.unlocked = false - LorenzUtils.chat("Detected not having access to warp point §b${it.displayName}§e!") - LorenzUtils.chat("Use §c/shresetburrowwarps §eonce you have activated this travel scroll.") + ChatUtils.chat("Detected not having access to warp point §b${it.displayName}§e!") + ChatUtils.chat("Use §c/shresetburrowwarps §eonce you have activated this travel scroll.") lastWarp = null currentWarp = null } @@ -89,6 +90,7 @@ class BurrowWarpHelper { } companion object { + private val config get() = SkyHanniMod.feature.event.diana var currentWarp: WarpPoint? = null @@ -116,7 +118,7 @@ class BurrowWarpHelper { fun resetDisabledWarps() { WarpPoint.entries.forEach { it.unlocked = true } - LorenzUtils.chat("Reset disabled burrow warps.") + ChatUtils.chat("Reset disabled burrow warps.") } } @@ -127,6 +129,7 @@ class BurrowWarpHelper { val ignored: () -> Boolean = { false }, var unlocked: Boolean = true, ) { + HUB("Hub", LorenzVec(-3, 70, -70), 2), CASTLE("Castle", LorenzVec(-250, 130, 45), 10), CRYPT("Crypt", LorenzVec(-190, 74, -88), 15, { config.ignoredWarps.crypt }), diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index 1ab8c0154..a41ee2689 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -6,8 +6,9 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -23,6 +24,7 @@ import com.google.gson.annotations.Expose import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object DianaProfitTracker { + private val config get() = SkyHanniMod.feature.event.diana.dianaProfitTracker private var allowedDrops = listOf<NEUInternalName>() @@ -41,6 +43,7 @@ object DianaProfitTracker { { it.diana.dianaProfitTracker }) { drawDisplay(it) } class Data : ItemTrackerData() { + override fun resetItems() { burrowsDug = 0 } @@ -94,7 +97,7 @@ object DianaProfitTracker { val internalName = event.internalName if (!isAllowedItem(internalName)) { - LorenzUtils.debug("Ignored non-diana item pickup: '$internalName'") + ChatUtils.debug("Ignored non-diana item pickup: '$internalName'") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 468dadc18..5d53ce823 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -16,13 +16,14 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine @@ -38,6 +39,7 @@ import org.lwjgl.input.Keyboard import kotlin.time.Duration.Companion.seconds object GriffinBurrowHelper { + private val config get() = SkyHanniMod.feature.event.diana var targetLocation: LorenzVec? = null @@ -280,7 +282,6 @@ object GriffinBurrowHelper { } } } - } } @@ -303,28 +304,28 @@ object GriffinBurrowHelper { fun setTestBurrow(strings: Array<String>) { if (!IslandType.HUB.isInIsland()) { - LorenzUtils.userError("You can only create test burrows on the hub island!") + ChatUtils.userError("You can only create test burrows on the hub island!") return } if (!isEnabled()) { if (!config.alwaysDiana) { - LorenzUtils.clickableChat("§cEnable Always Diana in the config!", "sh always diana") + ChatUtils.clickableChat("§cEnable Always Diana in the config!", "sh always diana") } else { - LorenzUtils.userError("Have an Ancestral Spade in the inventory!") + ChatUtils.userError("Have an Ancestral Spade in the inventory!") } return } if (strings.size != 1) { - LorenzUtils.userError("/shtestburrow <type>") + ChatUtils.userError("/shtestburrow <type>") return } val type: BurrowType = when (strings[0].lowercase()) { "reset" -> { resetAllData() - LorenzUtils.chat("Manually reset all burrow waypoints.") + ChatUtils.chat("Manually reset all burrow waypoints.") return } @@ -332,7 +333,7 @@ object GriffinBurrowHelper { "2", "mob" -> BurrowType.MOB "3", "treasure" -> BurrowType.TREASURE else -> { - LorenzUtils.userError("Unknown burrow type! Try 1-3 instead.") + ChatUtils.userError("Unknown burrow type! Try 1-3 instead.") return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index c49f6c551..9c83dfeda 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -23,6 +23,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class GriffinBurrowParticleFinder { + private val config get() = SkyHanniMod.feature.event.diana private val recentlyDugParticleBurrows = TimeLimitedSet<LorenzVec>(1.minutes) @@ -180,7 +181,6 @@ class GriffinBurrowParticleFinder { burrows.remove(location) } } - } } 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 d49e3199a..587522c00 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 @@ -2,12 +2,14 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class GriffinPetWarning { + private var lastWarnTime = SimpleTimeMark.farPast() @SubscribeEvent @@ -20,7 +22,7 @@ class GriffinPetWarning { if (!DianaAPI.hasGriffinPet() && lastWarnTime.passedSince() > 30.seconds) { lastWarnTime = SimpleTimeMark.now() LorenzUtils.sendTitle("§cGriffin Pet!", 3.seconds) - LorenzUtils.chat("Reminder to use a Griffin pet for Mythological Ritual!") + ChatUtils.chat("Reminder to use a Griffin pet for Mythological Ritual!") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt index 44f95cfcd..534dc4c91 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt @@ -10,6 +10,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightInquisitors { + private val config get() = SkyHanniMod.feature.event.diana @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index d7a161957..9276823fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -8,11 +8,12 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -28,6 +29,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object InquisitorWaypointShare { + private val config get() = SkyHanniMod.feature.event.diana.inquisitorSharing // TODO USE SH-REPO @@ -50,14 +52,14 @@ object InquisitorWaypointShare { val fromPlayer: String, val displayName: String, val location: LorenzVec, - val spawnTime: SimpleTimeMark + val spawnTime: SimpleTimeMark, ) private var test = false fun test() { test = !test - LorenzUtils.chat("Inquisitor Test " + if (test) "Enabled" else "Disabled") + ChatUtils.chat("Inquisitor Test " + if (test) "Enabled" else "Disabled") } @SubscribeEvent @@ -149,7 +151,7 @@ object InquisitorWaypointShare { val keyName = KeyboardManager.getKeyName(config.keyBindShare) val message = "§l§bYou found a Inquisitor! Press §l§chere §l§bor §c$keyName to share the location!" - LorenzUtils.clickableChat(message, "shshareinquis") + ChatUtils.clickableChat(message, "shshareinquis") } } @@ -193,18 +195,18 @@ object InquisitorWaypointShare { lastShareTime = System.currentTimeMillis() if (inquisitor == -1) { - LorenzUtils.error("No Inquisitor Found!") + ChatUtils.error("No Inquisitor Found!") return } val inquisitor = EntityUtils.getEntityByID(inquisitor) if (inquisitor == null) { - LorenzUtils.chat("§cInquisitor out of range!") + ChatUtils.chat("§cInquisitor out of range!") return } if (inquisitor.isDead) { - LorenzUtils.chat("§cInquisitor is dead") + ChatUtils.chat("§cInquisitor is dead") return } val location = inquisitor.getLorenzVec() @@ -234,7 +236,7 @@ object InquisitorWaypointShare { val name = rawName.cleanPlayerName() val displayName = rawName.cleanPlayerName(displayName = true) if (!waypoints.containsKey(name)) { - LorenzUtils.chat("$displayName §l§efound an inquisitor at §l§c$x $y $z!") + ChatUtils.chat("$displayName §l§efound an inquisitor at §l§c$x $y $z!") if (name != LorenzUtils.getPlayerName()) { LorenzUtils.sendTitle("§dINQUISITOR §efrom §b$displayName", 5.seconds) SoundUtils.playBeepSound() @@ -259,7 +261,7 @@ object InquisitorWaypointShare { fun maybeRemove(inquis: SharedInquisitor) { if (inquisitorsNearby.isEmpty()) { waypoints = waypoints.editCopy { remove(inquis.fromPlayer) } - LorenzUtils.chat("Inquisitor from ${inquis.displayName} not found, deleting.") + ChatUtils.chat("Inquisitor from ${inquis.displayName} not found, deleting.") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index 1d2884bc1..dbcc1574e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -4,10 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -34,10 +35,12 @@ object MythologicalCreatureTracker { private val config get() = SkyHanniMod.feature.event.diana.mythologicalMobtracker - private val tracker = SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) - { drawDisplay(it) } + private val tracker = + SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) + { drawDisplay(it) } class Data : TrackerData() { + override fun reset() { count.clear() } @@ -86,7 +89,7 @@ object MythologicalCreatureTracker { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.showPercentage) { + ConditionalUtils.onToggle(config.showPercentage) { tracker.update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt index 2fa31408d..125bf718f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.BurrowGuessEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.util.EnumParticleTypes @@ -109,7 +109,7 @@ class SoopyGuessBurrow { distance2 = (Math.E / slope) - firstParticlePoint?.distance(pos)!! if (distance2!! > 1000) { - LorenzUtils.debug("Soopy distance2 is $distance2") + ChatUtils.debug("Soopy distance2 is $distance2") distance2 = null guessPoint = null @@ -227,7 +227,7 @@ class SoopyGuessBurrow { i++ } - //Why does this happen? + // Why does this happen? if (pr1.isEmpty()) return val p1 = pr1.last() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt index fb2852cea..4bc5225b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt @@ -10,9 +10,10 @@ import net.minecraft.entity.passive.EntityVillager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightJerries { + private val config get() = SkyHanniMod.feature.event.jerry - //RED RED WHITE LIGHT_PURPLE are fallbacks in case Hypixel admins do a little trolling + // RED RED WHITE LIGHT_PURPLE are fallbacks in case Hypixel admins do a little trolling private val listOfLorenzColors = listOf( LorenzColor.RED, LorenzColor.RED, @@ -37,4 +38,4 @@ class HighlightJerries { RenderLivingEntityHelper.setEntityColor(entity, color) { config.highlightJerries } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt index de1b9df1a..219a22285 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt @@ -8,6 +8,7 @@ enum class FrozenTreasure( val defaultAmount: Int, val iceMultiplier: Int = 0, ) { + WHITE_GIFT("WHITE_GIFT", "§fWhite Gift", 1), GREEN_GIFT("GREEN_GIFT", "§aGreen Gift", 1), RED_GIFT("RED_GIFT", "§9§cRed Gift", 1), diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index f628c8a4b..7b3f236f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -9,9 +9,9 @@ import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ConfigUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -25,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer object FrozenTreasureTracker { + private val config get() = SkyHanniMod.feature.event.winter.frozenTreasureTracker private var estimatedIce = 0L private var lastEstimatedIce = 0L diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt index da537d4c0..af2c17be0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec data class EventWaypoint( val name: String, val position: LorenzVec, - var isFound: Boolean = false + var isFound: Boolean = false, ) fun loadEventWaypoints(waypoints: Map<String, List<EventWaypointsJson.Waypoint>>): Map<String, MutableSet<EventWaypoint>> { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt index 39ff40765..a6fa577e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.event.lobby.waypoints.EventWaypoint import at.hannibal2.skyhanni.features.event.lobby.waypoints.loadEventWaypoints import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils @@ -20,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // todo: create abstract class for this and BasketWaypoints class PresentWaypoints { + private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.christmasPresent private var presentLocations = mapOf<String, MutableSet<EventWaypoint>>() private var presentEntranceLocations = mapOf<String, MutableSet<EventWaypoint>>() @@ -67,7 +69,7 @@ class PresentWaypoints { private fun handleAllPresentsFound() { // If all presents are found, disable the feature - LorenzUtils.chat("Congratulations! As all presents are found, we are disabling the Christmas Present Waypoints feature.") + ChatUtils.chat("Congratulations! As all presents are found, we are disabling the Christmas Present Waypoints feature.") config.allWaypoints = false config.allEntranceWaypoints = false } @@ -90,7 +92,7 @@ class PresentWaypoints { } private fun LorenzRenderWorldEvent.drawWaypoints( - waypoints: Set<EventWaypoint>, shouldDraw: Boolean, color: LorenzColor, prefix: String + waypoints: Set<EventWaypoint>, shouldDraw: Boolean, color: LorenzColor, prefix: String, ) { if (!shouldDraw) return waypoints.forEach { waypoint -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt index e2904f99e..3907986d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt @@ -5,8 +5,9 @@ import at.hannibal2.skyhanni.utils.LorenzVec enum class BasketEntrances( val basketEntranceName: String, val waypoint: LorenzVec, - vararg val basket: Basket + vararg val basket: Basket, ) { + BASKET_ENTER_23("#23, #24 (behind the lava)", LorenzVec(-138, 74, -4), Basket.BASKET_23, Basket.BASKET_24), BASKET_ENTER_24("#24 (within this tunnel)", LorenzVec(-80, 72, -4), Basket.BASKET_24), BASKET_ENTER_25_1("#25 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), Basket.BASKET_25), diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt index d9d90ca4a..2d96a88b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BasketWaypoints { + private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.halloweenBasket private var closest: Basket? = null private var isHalloween: Boolean = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt index f0334549e..d8ff05378 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt @@ -10,7 +10,8 @@ import at.hannibal2.skyhanni.utils.TabListData import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TheGreatSpook { -// §r§cPrimal Fears§r§7: §r§6§lREADY!! + + // §r§cPrimal Fears§r§7: §r§6§lREADY!! private val config get() = SkyHanniMod.feature.event.spook private var displayTimer = "" private var displayFearStat = "" @@ -40,6 +41,7 @@ class TheGreatSpook { private fun checkTabList(matchString: String): String { return (TabListData.getTabList().find { it.contains(matchString) } ?: "").trim() } + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (isTimerEnabled()) config.positionTimer.renderString(displayTimer, posLabel = "Primal Fear Timer") diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt index 91c892ca2..2839797f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt @@ -19,6 +19,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class JyrreTimer { + private val config get() = SkyHanniMod.feature.event.winter.jyrreTimer private val drankBottlePattern by RepoPattern.pattern( "event.winter.drank.jyrre", diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt index 0198c96b3..4bc6c02b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ScoreboardChangeEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -16,6 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class NewYearCakeReminder { + private val config get() = SkyHanniMod.feature.event.winter private val sidebarDetectionPattern by RepoPattern.pattern( "event.winter.newyearcake.reminder.sidebar", @@ -72,7 +74,7 @@ class NewYearCakeReminder { if (lastReminderSend.passedSince() < 30.seconds) return lastReminderSend = SimpleTimeMark.now() - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Reminding you to grab the free New Year Cake. Click here to open the baker menu!", "openbaker" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt index 6d010fae7..a383d8683 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -17,6 +18,7 @@ import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds class AccountUpgradeReminder { + private var inInventory = false private var duration: Duration? = null private var lastReminderSend = SimpleTimeMark.farPast() @@ -30,7 +32,6 @@ class AccountUpgradeReminder { } } - @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return @@ -53,7 +54,7 @@ class AccountUpgradeReminder { if (lastReminderSend.passedSince() < 30.seconds) return lastReminderSend = SimpleTimeMark.now() - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "The §a$upgrade §eupgrade has completed! §c(Click to disable these reminders)", "shstopaccountupgradereminder" ) @@ -107,6 +108,7 @@ class AccountUpgradeReminder { } companion object { + private val durationRegex = "§8Duration: (\\d{1,3})d".toRegex() private val startedRegex = "§eYou started the §r§a(.+) §r§eupgrade!".toRegex() private val claimedRegex = "§eYou claimed the §r§a.+ §r§eupgrade!".toRegex() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index 5bd8be726..bef023755 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -9,12 +9,13 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -33,6 +34,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CityProjectFeatures { + private var display = emptyList<List<Any>>() private var inInventory = false private var lastReminderSend = 0L @@ -48,10 +50,11 @@ class CityProjectFeatures { ) companion object { + private val config get() = SkyHanniMod.feature.event.cityProject fun disable() { config.dailyReminder = false - LorenzUtils.chat("Disabled city project reminder messages!") + ChatUtils.chat("Disabled city project reminder messages!") } } @@ -76,7 +79,7 @@ class CityProjectFeatures { if (lastReminderSend + 30_000 > System.currentTimeMillis()) return lastReminderSend = System.currentTimeMillis() - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Daily City Project Reminder! (Click here to disable this reminder)", "shstopcityprojectreminder" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt index e68edf39e..1fdb7ad16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LorenzUtils object ReminderUtils { + // TODO: add arachne fight, add slayer boss spawned fun isBusy(): Boolean = LorenzUtils.inDungeons || LorenzUtils.inKuudraFight || FarmingContestAPI.inContest || RiftAPI.inRift() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 24506a22b..d4b741472 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -4,15 +4,16 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChumBucketHider { + private val config get() = SkyHanniMod.feature.fishing.chumBucketHider private val titleEntity = mutableListOf<Entity>() private val hiddenEntities = mutableListOf<Entity>() @@ -73,7 +74,7 @@ class ChumBucketHider { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() } + ConditionalUtils.onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() } } private fun reset() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt index abcf3a234..173f5a0d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt @@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object FishingAPI { + val lavaBlocks = listOf(Blocks.lava, Blocks.flowing_lava) private val waterBlocks = listOf(Blocks.water, Blocks.flowing_water) @@ -121,5 +122,4 @@ object FishingAPI { } return 1 } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt index 1177ad7e2..348ec0342 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI.isBait import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -19,6 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class FishingBaitWarnings { + private val config get() = SkyHanniMod.feature.fishing.fishingBaitWarnings private var bobber: EntityFishHook? = null private var lastBait: String? = null @@ -76,13 +78,13 @@ class FishingBaitWarnings { private fun showBaitChangeWarning(before: String, after: String) { SoundUtils.playClickSound() LorenzUtils.sendTitle("§eBait changed!", 2.seconds) - LorenzUtils.chat("Fishing Bait changed: $before -> $after") + ChatUtils.chat("Fishing Bait changed: $before -> $after") } private fun showNoBaitWarning() { SoundUtils.playErrorSound() LorenzUtils.sendTitle("§cNo bait is used!", 2.seconds) - LorenzUtils.chat("You do not use any fishing baits!") + ChatUtils.chat("You do not use any fishing baits!") } private fun isEnabled() = LorenzUtils.inSkyBlock && FishingAPI.isFishing() && !LorenzUtils.inKuudraFight diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt index 38775705d..bbd029100 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt @@ -16,6 +16,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds object FishingDetection { + var isFishing = false private var holdingRod = false private var lastRodCastLocation: LorenzVec? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt index be076222f..73fe5e23a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt @@ -13,6 +13,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class FishingHookDisplay { + private val config get() = SkyHanniMod.feature.fishing.fishingHookDisplay private var armorStand: EntityArmorStand? = null private val potentionArmorStands = mutableListOf<EntityArmorStand>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt index 2b633f0a4..4257d7790 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -22,6 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class FishingTimer { + private val config get() = SkyHanniMod.feature.fishing.barnTimer private val barnLocation = LorenzVec(108, 89, -252) @@ -76,7 +77,8 @@ class FishingTimer { } } - private fun countMobs() = EntityUtils.getEntities<EntityArmorStand>().map { entity -> FishingAPI.seaCreatureCount(entity) }.sum() + private fun countMobs() = + EntityUtils.getEntities<EntityArmorStand>().map { entity -> FishingAPI.seaCreatureCount(entity) }.sum() private fun isRightLocation(): Boolean { inHollows = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt index 0d9bbb9c9..325411045 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt @@ -9,13 +9,13 @@ import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor 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.ignoreDerpy import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -31,6 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class SeaCreatureFeatures { + private val config get() = SkyHanniMod.feature.fishing.rareCatches private var rareSeaCreatures = listOf<EntityLivingBase>() private var lastRareCatch = SimpleTimeMark.farPast() @@ -58,7 +59,8 @@ class SeaCreatureFeatures { if (config.alertOtherCatches && lastRareCatch.passedSince() > 1.seconds) { val creature = SeaCreatureManager.allFishingMobs[creatureType.nametag] - LorenzUtils.sendTitle("${creature?.rarity?.chatColorCode ?: "§6"}RARE SEA CREATURE!", 1.5.seconds, 3.6, 7f) + val text = "${creature?.rarity?.chatColorCode ?: "§6"}RARE SEA CREATURE!" + LorenzUtils.sendTitle(text, 1.5.seconds, 3.6, 7f) if (config.playSound) SoundUtils.playBeepSound() } } @@ -104,8 +106,9 @@ class SeaCreatureFeatures { enum class RareSeaCreatureType( val clazz: Class<out EntityLivingBase>, val nametag: String, - vararg val health: Int + vararg val health: Int, ) { + WATER_HYDRA(EntityZombie::class.java, "Water Hydra", 500_000), SEA_EMPEROR(EntityGuardian::class.java, "Sea Emperor", 750_000, 800_000), SEA_EMPEROR_RIDER(EntitySkeleton::class.java, "Sea Emperor", 750_000, 800_000), diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index 5843bb97c..bfff1d7be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -62,6 +62,7 @@ class SeaCreatureManager { } companion object { + private val seaCreatureMap = mutableMapOf<String, SeaCreature>() var allFishingMobs = mapOf<String, SeaCreature>() var allVariants = mapOf<String, List<String>>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt index 1b1689e1f..72997fc6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt @@ -7,6 +7,7 @@ import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SeaCreatureMessageShortener { + private val config get() = SkyHanniMod.feature.fishing @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt index f84a72d53..8f201648b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt @@ -5,12 +5,14 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SharkFishCounter { + private var counter = mutableListOf(0, 0, 0, 0) private var display = "" private var hasWaterRodInHand = false @@ -56,7 +58,7 @@ class SharkFishCounter { val g = counter[3] // Great White val total = count.addSeparators() val funnyComment = funnyComment(count) - LorenzUtils.chat("You caught $total §f(§a$n §9$b §5$t §6$g§f) §esharks during this fishing contest. $funnyComment") + ChatUtils.chat("You caught $total §f(§a$n §9$b §5$t §6$g§f) §esharks during this fishing contest. $funnyComment") counter = mutableListOf(0, 0, 0, 0) display = "" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt index 97945eb21..e2d1b297e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds class ShowFishingItemName { + private val config get() = SkyHanniMod.feature.fishing.fishedItemName private var hasRodInHand = false private var cache = TimeLimitedCache<EntityItem, Pair<LorenzVec, String>>(750.milliseconds) @@ -81,5 +82,4 @@ class ShowFishingItemName { } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index 5a92ae51a..f8e5f8a2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -7,9 +7,10 @@ import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -31,6 +32,7 @@ import kotlin.time.Duration.Companion.seconds typealias CategoryName = String object FishingProfitTracker { + val config get() = SkyHanniMod.feature.fishing.fishingProfitTracker private val coinsChatPattern = ".* CATCH! §r§bYou found §r§6(?<coins>.*) Coins§r§b\\.".toPattern() @@ -42,6 +44,7 @@ object FishingProfitTracker { { it.fishing.fishingProfitTracker }) { drawDisplay(it) } class Data : ItemTrackerData() { + override fun resetItems() { totalCatchAmount = 0 } @@ -190,7 +193,7 @@ object FishingProfitTracker { if (FishingAPI.lastActiveFishingTime.passedSince() > 10.minutes) return if (!isAllowedItem(internalName)) { - LorenzUtils.debug("Ignored non-fishing item pickup: $internalName'") + ChatUtils.debug("Ignored non-fishing item pickup: $internalName'") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 8bfcadde7..34c94d198 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -9,13 +9,14 @@ import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase @@ -33,11 +34,15 @@ object SeaCreatureTracker { private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker }) { drawDisplay(it) } - private val trophyArmorNames by RepoPattern.pattern("fishing.trophyfishing.armor", "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)") + private val trophyArmorNames by RepoPattern.pattern( + "fishing.trophyfishing.armor", + "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)" + ) private var lastArmorCheck = SimpleTimeMark.farPast() private var isTrophyFishing = false class Data : TrackerData() { + override fun reset() { amount.clear() } @@ -143,7 +148,7 @@ object SeaCreatureTracker { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.showPercentage) { + ConditionalUtils.onToggle(config.showPercentage) { tracker.update() } } @@ -172,7 +177,7 @@ object SeaCreatureTracker { } @SubscribeEvent - fun onTick (event: LorenzTickEvent) { + fun onTick(event: LorenzTickEvent) { if (lastArmorCheck.passedSince() < 3.seconds) return lastArmorCheck = SimpleTimeMark.now() isTrophyFishing = isWearingTrophyArmor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt index 99b8240a6..bdd085ac1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class OdgerWaypoint { + private val config get() = SkyHanniMod.feature.fishing.trophyFishing private val location = LorenzVec(-373, 207, -808) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 2775becc7..dcafc6603 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard class TrophyFishFillet { + @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt index 6be896fb3..311661ed7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt @@ -1,12 +1,12 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson +import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.splitLines -import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson -import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo import net.minecraft.event.HoverEvent import net.minecraft.util.ChatComponentText import net.minecraft.util.ChatStyle diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index c152de886..507e3e7bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -6,10 +6,10 @@ import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.ChatMessagesC import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.fishes import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getTooltip +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.ordinal import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -18,6 +18,7 @@ import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TrophyFishMessages { + private val trophyFishPattern = "§6§lTROPHY FISH! §r§bYou caught an? §r(?<displayName>§[0-9a-f](?:§k)?[\\w -]+) §r(?<displayRarity>§[0-9a-f]§l\\w+)§r§b\\.".toPattern() private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages @@ -51,12 +52,15 @@ class TrophyFishMessages { var edited = original if (config.enabled) { - edited = ChatComponentText("§6§lTROPHY FISH! " + when (config.design) { - DesignFormat.STYLE_1 -> if (amount == 1) "§c§lFIRST §r$displayRarity $displayName" - else "§7$amount. §r$displayRarity $displayName" - DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})" - else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b." - }) + edited = ChatComponentText( + "§6§lTROPHY FISH! " + when (config.design) { + DesignFormat.STYLE_1 -> if (amount == 1) "§c§lFIRST §r$displayRarity $displayName" + else "§7$amount. §r$displayRarity $displayName" + + DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})" + else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b." + } + ) } if (config.totalAmount) { @@ -79,7 +83,7 @@ class TrophyFishMessages { private fun shouldBlockTrophyFish(rarity: TrophyRarity, amount: Int) = config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1 - || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1 + || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1 @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt index 7f3ff8524..e376d97f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt @@ -11,6 +11,7 @@ enum class TrophyRarity(val formatCode: String) { val formattedString get() = "$formatCode${name.firstLetterUppercase()}" companion object { + fun getByName(rawName: String) = entries.firstOrNull { rawName.uppercase().endsWith(it.name) } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index e92fda526..19d658c2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -6,13 +6,14 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems @@ -23,10 +24,12 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaMedalProfit { + private val config get() = GardenAPI.config.anitaShop private var display = emptyList<List<Any>>() companion object { + var inInventory = false } @@ -104,7 +107,7 @@ class AnitaMedalProfit { for (rawItemName in requiredItems) { val pair = ItemUtils.readItemAmount(rawItemName) if (pair == null) { - LorenzUtils.error("Could not read item '$rawItemName'") + ChatUtils.error("Could not read item '$rawItemName'") continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt index 73fd9804c..9fddb9fc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.Season -import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AtmosphericFilterDisplay { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt index 22d553ea4..c11c2640d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt @@ -7,8 +7,9 @@ enum class CropAccessory( val internalName: NEUInternalName?, private val affectedCrops: Set<CropType>, private val fortune: Double, - val upgradeCost: Pair<String, Int>? + val upgradeCost: Pair<String, Int>?, ) { + NONE(null, emptySet(), 0.0, null), CROPIE( "CROPIE_TALISMAN".asInternalName(), @@ -29,6 +30,7 @@ enum class CropAccessory( } companion object { + fun getByName(internalName: NEUInternalName) = entries.firstOrNull { internalName == it.internalName } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt index 3a7226cc4..968fb1b29 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt @@ -15,34 +15,45 @@ enum class CropType( val simpleName: String, val replenish: Boolean = false, ) { - WHEAT("Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0, + + WHEAT( + "Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0, { ItemStack(Items.wheat) }, "wheat" ), - CARROT("Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0, + CARROT( + "Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0, { ItemStack(Items.carrot) }, "carrot", replenish = true ), - POTATO("Potato", "THEORETICAL_HOE_POTATO", "CROPIE", 3.0, + POTATO( + "Potato", "THEORETICAL_HOE_POTATO", "CROPIE", 3.0, { ItemStack(Items.potato) }, "potato", replenish = true ), - NETHER_WART("Nether Wart", "THEORETICAL_HOE_WARTS", "FERMENTO", 2.5, + NETHER_WART( + "Nether Wart", "THEORETICAL_HOE_WARTS", "FERMENTO", 2.5, { ItemStack(Items.nether_wart) }, "wart", replenish = true ), - PUMPKIN("Pumpkin", "PUMPKIN_DICER", "SQUASH", 1.0, + PUMPKIN( + "Pumpkin", "PUMPKIN_DICER", "SQUASH", 1.0, { ItemStack(Blocks.pumpkin) }, "pumpkin" ), - MELON("Melon", "MELON_DICER", "SQUASH", 5.0, + MELON( + "Melon", "MELON_DICER", "SQUASH", 5.0, { ItemStack(Items.melon) }, "melon" ), - COCOA_BEANS("Cocoa Beans", "COCO_CHOPPER", "SQUASH", 3.0, + COCOA_BEANS( + "Cocoa Beans", "COCO_CHOPPER", "SQUASH", 3.0, { ItemStack(Items.dye, 1, EnumDyeColor.BROWN.dyeDamage) }, "cocoa", replenish = true ), - SUGAR_CANE("Sugar Cane", "THEORETICAL_HOE_CANE", "FERMENTO", 2.0, + SUGAR_CANE( + "Sugar Cane", "THEORETICAL_HOE_CANE", "FERMENTO", 2.0, { ItemStack(Items.reeds) }, "cane" ), - CACTUS("Cactus", "CACTUS_KNIFE", "FERMENTO", 2.0, + CACTUS( + "Cactus", "CACTUS_KNIFE", "FERMENTO", 2.0, { ItemStack(Blocks.cactus) }, "cactus" ), - MUSHROOM("Mushroom", "FUNGI_CUTTER", "FERMENTO", 1.0, + MUSHROOM( + "Mushroom", "FUNGI_CUTTER", "FERMENTO", 1.0, { ItemStack(Blocks.red_mushroom_block) }, "mushroom" ), ; @@ -54,6 +65,7 @@ enum class CropType( override fun toString(): String = cropName companion object { + fun getByNameOrNull(itemName: String): CropType? { if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM if (itemName == "Seeds") return WHEAT diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index c7f05d807..5b066b142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -14,11 +14,11 @@ import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.pests.PestAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -36,6 +36,7 @@ import kotlin.math.log10 import kotlin.time.Duration.Companion.seconds class FarmingFortuneDisplay { + private val tabFortuneUniversalPattern = " Farming Fortune: §r§6☘(?<fortune>\\d+)".toPattern() private val tabFortuneCropPattern = " (?<crop>Wheat|Carrot|Potato|Pumpkin|Sugar Cane|Melon|Cactus|Cocoa Beans|Mushroom|Nether Wart) Fortune: §r§6☘(?<fortune>\\d+)".toPattern() @@ -170,6 +171,7 @@ class FarmingFortuneDisplay { } companion object { + private val config get() = GardenAPI.config.farmingFortunes private val latestFF: MutableMap<CropType, Double>? get() = GardenAPI.storage?.latestTrueFarmingFortune diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt index 7f7832ff1..61e3d1caa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.command.CommandBase @@ -12,12 +12,12 @@ object FarmingMilestoneCommand { fun onCommand(crop: String?, current: String?, target: String?, needsTime: Boolean) { if (crop == null) { - LorenzUtils.userError("No crop type entered") + ChatUtils.userError("No crop type entered") return } val enteredCrop = CropType.entries.firstOrNull { it.simpleName == crop.lowercase() } ?: run { - LorenzUtils.userError("Invalid crop type entered") + ChatUtils.userError("Invalid crop type entered") return } @@ -30,7 +30,7 @@ object FarmingMilestoneCommand { val cropsForTier = GardenCropMilestones.getCropsForTier(currentCropMilestone, enteredCrop) val output = (cropsForTier - currentProgress).formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed to reach the next milestone") + ChatUtils.chat("§7$output needed to reach the next milestone") return } @@ -38,11 +38,11 @@ object FarmingMilestoneCommand { val cropsForTier = GardenCropMilestones.getCropsForTier(currentMilestone, enteredCrop) val output = cropsForTier.formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed for milestone §7$currentMilestone") + ChatUtils.chat("§7$output needed for milestone §7$currentMilestone") return } if (currentMilestone >= targetMilestone) { - LorenzUtils.userError("Entered milestone is greater than or the same as target milestone") + ChatUtils.userError("Entered milestone is greater than or the same as target milestone") return } @@ -50,7 +50,7 @@ object FarmingMilestoneCommand { val targetAmount = GardenCropMilestones.getCropsForTier(targetMilestone, enteredCrop) val output = (targetAmount - currentAmount).formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed for milestone §7$currentMilestone §a-> §7$targetMilestone") + ChatUtils.chat("§7$output needed for milestone §7$currentMilestone §a-> §7$targetMilestone") } fun onComplete(strings: Array<String>): List<String> { 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 dffb6f0ef..cf9fbea6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -24,13 +24,13 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzRarity -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName @@ -45,6 +45,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object GardenAPI { + var toolInHand: String? = null var itemInHand: ItemStack? = null var cropInHand: CropType? = null @@ -159,7 +160,7 @@ object GardenAPI { storage?.cropsPerSecond?.clear() GardenBestCropTime.reset() updateGardenTool() - LorenzUtils.chat("Manually reset all crop speed data!") + ChatUtils.chat("Manually reset all crop speed data!") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index 495d82bb6..838b3f6ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -7,13 +7,14 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenCropMilestoneFix { + private val tabListPattern = " Milestone: §r§a(?<crop>.*) (?<tier>.*): §r§3(?<percentage>.*)%".toPattern() private val levelUpPattern = " {2}§r§b§lGARDEN MILESTONE §3(?<crop>.*) §8.*➜§3(?<tier>.*)".toPattern() @@ -51,7 +52,7 @@ class GardenCropMilestoneFix { val crop = CropType.getByNameOrNull(cropName) if (crop == null) { - LorenzUtils.debug("GardenCropMilestoneFix: crop is null: '$cropName'") + ChatUtils.debug("GardenCropMilestoneFix: crop is null: '$cropName'") return } @@ -81,11 +82,11 @@ class GardenCropMilestoneFix { crop.setCounter(tabListValue) GardenCropMilestoneDisplay.update() if (!loadedCrops.contains(crop)) { - LorenzUtils.chat("Loaded ${crop.cropName} milestone data from $source!") + ChatUtils.chat("Loaded ${crop.cropName} milestone data from $source!") loadedCrops.add(crop) } } else if (diff >= minDiff) { - LorenzUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}") + ChatUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}") crop.setCounter(tabListValue) GardenCropMilestoneDisplay.update() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt index 6629f1b00..42d417a5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -12,16 +12,17 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropTimeCommand { + private val config get() = GardenAPI.config.moneyPerHours fun onCommand(args: Array<String>) { if (!config.display) { - LorenzUtils.userError("shcroptime requires 'Show money per Hour' feature to be enabled to work!") + ChatUtils.userError("shcroptime requires 'Show money per Hour' feature to be enabled to work!") return } if (args.size < 2) { - LorenzUtils.userError("Usage: /shcroptime <amount> <item>") + ChatUtils.userError("Usage: /shcroptime <amount> <item>") return } @@ -29,12 +30,12 @@ object GardenCropTimeCommand { val amount = try { rawAmount.formatNumber() } catch (e: NumberFormatException) { - LorenzUtils.userError("Not a valid number: '$rawAmount'") + ChatUtils.userError("Not a valid number: '$rawAmount'") return } val multipliers = CropMoneyDisplay.multipliers if (multipliers.isEmpty()) { - LorenzUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") + ChatUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") return } @@ -69,10 +70,10 @@ object GardenCropTimeCommand { } if (map.isEmpty()) { - LorenzUtils.userError("No crop item found for '$rawSearchName'.") + ChatUtils.userError("No crop item found for '$rawSearchName'.") return } - LorenzUtils.chat("Crop Speed for ${map.size} items:\n" + map.sorted().keys.joinToString("\n")) + ChatUtils.chat("Crop Speed for ${map.size} items:\n" + map.sorted().keys.joinToString("\n")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt index 768dcbc49..4bf34a5ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt @@ -2,25 +2,26 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropsInCommand { + private val config get() = GardenAPI.config.moneyPerHours fun onCommand(args: Array<String>) { if (!config.display) { - LorenzUtils.userError("shcropsin requires 'Show money per Hour' feature to be enabled to work!") + ChatUtils.userError("shcropsin requires 'Show money per Hour' feature to be enabled to work!") return } if (args.size < 2) { - LorenzUtils.userError("Usage: /shcropsin <time> <item>") + ChatUtils.userError("Usage: /shcropsin <time> <item>") return } @@ -28,12 +29,12 @@ object GardenCropsInCommand { val seconds = try { TimeUtils.getDuration(rawTime).inWholeSeconds } catch (e: NumberFormatException) { - LorenzUtils.userError("Not a valid time: '$rawTime'") + ChatUtils.userError("Not a valid time: '$rawTime'") return } val multipliers = CropMoneyDisplay.multipliers if (multipliers.isEmpty()) { - LorenzUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") + ChatUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") return } @@ -51,7 +52,7 @@ object GardenCropsInCommand { val speed = crop.getSpeed() - if (speed == null){ + if (speed == null) { map["$itemName §cNo speed data!"] = -1 } else { val fullAmount = seconds * speed / baseAmount @@ -61,10 +62,10 @@ object GardenCropsInCommand { } if (map.isEmpty()) { - LorenzUtils.userError("No crops found for '$rawSearchName'") + ChatUtils.userError("No crops found for '$rawSearchName'") return } - LorenzUtils.chat("Crops farmed in $rawTime:\n" + map.sorted().keys.joinToString("\n")) + ChatUtils.chat("Crops farmed in $rawTime:\n" + map.sorted().keys.joinToString("\n")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index f674340d7..21fb1a78a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -18,12 +19,22 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds class GardenLevelDisplay { + private val config get() = GardenAPI.config.gardenLevels - private val expToNextLevelPattern by RepoPattern.pattern("garden.level.inventory.nextxp", ".* §e(?<nextLevelExp>.*)§6/.*") + private val expToNextLevelPattern by RepoPattern.pattern( + "garden.level.inventory.nextxp", + ".* §e(?<nextLevelExp>.*)§6/.*" + ) private val overflowPattern by RepoPattern.pattern("garden.level.inventory.overflow", ".*§r §6(?<overflow>.*)") - private val currentLevelPattern by RepoPattern.pattern("garden.level.inventory.currentlevel", "Garden Level (?<currentLevel>.*)") + private val currentLevelPattern by RepoPattern.pattern( + "garden.level.inventory.currentlevel", + "Garden Level (?<currentLevel>.*)" + ) private var display = "" - private val visitorRewardPattern by RepoPattern.pattern("garden.level.chat.increase", " {4}§r§8\\+§r§2(?<exp>.*) §r§7Garden Experience") + private val visitorRewardPattern by RepoPattern.pattern( + "garden.level.chat.increase", + " {4}§r§8\\+§r§2(?<exp>.*) §r§7Garden Experience" + ) @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { @@ -46,7 +57,7 @@ class GardenLevelDisplay { val newLevel = GardenAPI.getGardenLevel() if (newLevel == oldLevel + 1 && newLevel > 15) { LorenzUtils.runDelayed(50.milliseconds) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( " \n§b§lGARDEN LEVEL UP §8$oldLevel ➜ §b$newLevel\n" + " §8+§aRespect from Elite Farmers and SkyHanni members :)\n ", "/gardenlevels", diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index e2fa5b63f..22c6cb7fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -46,6 +47,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds object GardenNextJacobContest { + private var dispatcher = Dispatchers.IO private var display = emptyList<Any>() private var simpleDisplay = emptyList<String>() @@ -193,7 +195,7 @@ object GardenNextJacobContest { if (!askToSendContests()) { sendContests() } else { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "§2Click here to submit this year's farming contests. Thank you for helping everyone out!", "shsendcontests" ) @@ -243,7 +245,7 @@ object GardenNextJacobContest { if (array[0] == "enable") { config.shareAutomatically = ShareContestsEntry.AUTO SkyHanniMod.feature.storage.contestSendingAsked = true - LorenzUtils.chat("§2Enabled automatic sharing of future contests!") + ChatUtils.chat("§2Enabled automatic sharing of future contests!") } return } @@ -251,7 +253,7 @@ object GardenNextJacobContest { sendContests() } if (!SkyHanniMod.feature.storage.contestSendingAsked && config.shareAutomatically == ShareContestsEntry.ASK) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "§2Click here to automatically share future contests!", "shsendcontests enable" ) @@ -374,7 +376,7 @@ object GardenNextJacobContest { lastWarningTime = now() val cropText = crops.joinToString("§7, ") { (if (it == boostedCrop) "§6" else "§a") + it.cropName } - LorenzUtils.chat("Next farming contest: $cropText") + ChatUtils.chat("Next farming contest: $cropText") LorenzUtils.sendTitle("§eFarming Contest!", 5.seconds) SoundUtils.playBeepSound() @@ -503,12 +505,12 @@ object GardenNextJacobContest { newContests[timeMark + contestDuration] = FarmingContest(timeMark + contestDuration, crops) } } else { - LorenzUtils.chat("This year's contests aren't available to fetch automatically yet, please load them from your calendar or wait 10 minutes.") - LorenzUtils.clickableChat("Click here to open your calendar!", "calendar") + ChatUtils.chat("This year's contests aren't available to fetch automatically yet, please load them from your calendar or wait 10 minutes.") + ChatUtils.clickableChat("Click here to open your calendar!", "calendar") } if (newContests.count() == maxContestsPerYear) { - LorenzUtils.chat("Successfully loaded this year's contests from elitebot.dev automatically!") + ChatUtils.chat("Successfully loaded this year's contests from elitebot.dev automatically!") contests = newContests fetchedFromElite = true @@ -519,7 +521,7 @@ object GardenNextJacobContest { } } catch (e: Exception) { e.printStackTrace() - LorenzUtils.error("Failed to fetch upcoming contests. Please report this error if it continues to occur.") + ChatUtils.error("Failed to fetch upcoming contests. Please report this error if it continues to occur.") } } @@ -549,13 +551,13 @@ object GardenNextJacobContest { val result = withContext(dispatcher) { APIUtil.postJSONIsSuccessful(url, body) } if (result) { - LorenzUtils.chat("Successfully submitted this years upcoming contests, thank you for helping everyone out!") + ChatUtils.chat("Successfully submitted this years upcoming contests, thank you for helping everyone out!") } else { - LorenzUtils.error("Something went wrong submitting upcoming contests!") + ChatUtils.error("Something went wrong submitting upcoming contests!") } } catch (e: Exception) { e.printStackTrace() - LorenzUtils.error("Failed to submit upcoming contests. Please report this error if it continues to occur.") + ChatUtils.error("Failed to submit upcoming contests. Please report this error if it continues to occur.") null } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index c0ce6e821..56d3fe17d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -6,6 +6,8 @@ import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -22,6 +24,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds class GardenOptimalSpeed { + private val config get() = GardenAPI.config.optimalSpeeds private val configCustomSpeed get() = config.customSpeed private var sneakingTime = 0.seconds @@ -87,7 +90,7 @@ class GardenOptimalSpeed { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { for (value in CropType.entries) { - LorenzUtils.onToggle(value.getConfig()) { + ConditionalUtils.onToggle(value.getConfig()) { if (value == cropInHand) { optimalSpeed = value.getOptimalSpeed() } @@ -147,7 +150,7 @@ class GardenOptimalSpeed { if (sneaking) text += " §7[Sneaking]" text += " §e(§f$optimalSpeed §eis optimal)" - LorenzUtils.chat(text) + ChatUtils.chat(text) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt index f2f294d86..f1edf26e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt @@ -55,12 +55,12 @@ object GardenPlotAPI { var sprayType: SprayType?, @Expose - var sprayHasNotified: Boolean + var sprayHasNotified: Boolean, ) data class SprayData( val expiry: SimpleTimeMark, - val type: SprayType + val type: SprayType, ) private fun Plot.getData() = GardenAPI.storage?.plotData?.getOrPut(id) { PlotData(id, "$id", 0, null, null, false) } @@ -172,7 +172,7 @@ object GardenPlotAPI { plot: Plot, lineColor: Color, cornerColor: Color, - showBuildLimit: Boolean = false + showBuildLimit: Boolean = false, ) { // These don't refer to Minecraft chunks but rather garden plots, but I use @@ -244,7 +244,7 @@ object GardenPlotAPI { p2: LorenzVec, color: Color, lineWidth: Int, - depth: Boolean + depth: Boolean, ) { if (isOutOfBorders(p1)) return if (isOutOfBorders(p2)) return @@ -259,5 +259,4 @@ object GardenPlotAPI { else -> false } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt index a0d0b710d..563258b95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.features.misc.LockMouseLook +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -12,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class GardenWarpCommands { + private val config get() = GardenAPI.config.gardenCommands // TODO repo @@ -28,7 +30,7 @@ class GardenWarpCommands { if (message == "/home") { event.isCanceled = true LorenzUtils.sendCommandToServer("warp garden") - LorenzUtils.chat("§aTeleported you to the spawn location!", prefix = false) + ChatUtils.chat("§aTeleported you to the spawn location!", prefix = false) } if (message == "/barn") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt index d053a4ede..e93d7ce67 100755 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt @@ -11,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class GardenYawAndPitch { + private val config get() = GardenAPI.config.yawPitchDisplay private var lastChange = SimpleTimeMark.farPast() private var lastYaw = 0f diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt index e43563b14..df2e20365 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/SensitivityReducer.kt @@ -7,9 +7,9 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.HypixelJoinEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft @@ -48,14 +48,17 @@ object SensitivityReducer { if (isToggled) toggle(false) return } + SensitivityReducerConfig.Mode.TOOL -> { if (isHoldingTool() && !isToggled) toggle(true) else if (isToggled && !isHoldingTool()) toggle(false) } + SensitivityReducerConfig.Mode.KEYBIND -> { if (config.keybind.isKeyHeld() && !isToggled) toggle(true) else if (isToggled && !config.keybind.isKeyHeld()) toggle(false) } + else -> return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index ffd83126f..56568f017 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -20,6 +20,7 @@ import java.text.DecimalFormat import kotlin.math.roundToInt class ToolTooltipTweaks { + private val config get() = GardenAPI.config.tooltipTweak private val tooltipFortunePattern = "^§5§o§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?$".toRegex() @@ -75,7 +76,6 @@ class ToolTooltipTweaks { val totalFortune = displayedFortune + hiddenFortune - val ffdString = if (ffdFortune != 0) " §2(+${ffdFortune.formatStat()})" else "" val reforgeString = if (reforgeFortune != 0.0) " §9(+${reforgeFortune.formatStat()})" else "" val cropString = if (hiddenFortune != 0.0) " §6[+${hiddenFortune.roundToInt()}]" else "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt index c9a362e43..085095f4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt @@ -10,6 +10,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes object ComposterAPI { + var tabListData = mapOf<ComposterDisplay.DataType, String>() val composterUpgrades: MutableMap<ComposterUpgrade, Int>? get() = GardenAPI.storage?.composterUpgrades @@ -36,14 +37,14 @@ object ComposterAPI { getFuel(), fractionRemaining, fuelRequiredPer(null), timePerCompost ) - return nextCompostTime + minOf(remainingTimeByOrganicMatter, remainingTimeByFuel) + return nextCompostTime + minOf(remainingTimeByOrganicMatter, remainingTimeByFuel) } private fun getDurationUntilEndOfResource( amount: Long, fractionOfCompostRemaining: Double, requiredPer: Double, - timePerCompost: Duration + timePerCompost: Duration, ): Duration { val resourceConsumedByNextCompost = fractionOfCompostRemaining * requiredPer val resourceRemainingAfterNextCompostFinishes = amount - resourceConsumedByNextCompost diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 39eddc488..2e8ca1d11 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -4,8 +4,9 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -17,6 +18,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds class ComposterDisplay { + private val config get() = GardenAPI.config.composters private val storage get() = GardenAPI.storage private var display = emptyList<List<Any>>() @@ -120,7 +122,7 @@ class ComposterDisplay { if (config.notifyLow.title) { LorenzUtils.sendTitle("§cYour Organic Matter is low", 4.seconds) } - LorenzUtils.chat("§cYour Organic Matter is low!") + ChatUtils.chat("§cYour Organic Matter is low!") storage.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 } @@ -130,7 +132,7 @@ class ComposterDisplay { if (config.notifyLow.title) { LorenzUtils.sendTitle("§cYour Fuel is low", 4.seconds) } - LorenzUtils.chat("§cYour Fuel is low!") + ChatUtils.chat("§cYour Fuel is low!") storage.informedAboutLowFuel = System.currentTimeMillis() + 60_000 * 5 } } @@ -177,7 +179,7 @@ class ComposterDisplay { if (System.currentTimeMillis() < storage.lastComposterEmptyWarningTime + 1000 * 60 * 2) return storage.lastComposterEmptyWarningTime = System.currentTimeMillis() - LorenzUtils.chat(warningMessage) + ChatUtils.chat(warningMessage) LorenzUtils.sendTitle("§eComposter Warning!", 3.seconds) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt index 2cd0b4a60..f883f5de1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ComposterInventoryNumbers { + private val valuePattern = ".* §e(?<having>.*)§6/(?<total>.*)".toPattern() private val compostsPattern = "§7§7Compost Available: §a(?<amount>.*)".toPattern() @@ -46,7 +47,6 @@ class ComposterInventoryNumbers { val havingFormat = NumberUtil.format(having) val total = group("total").removeColor() - val color = if (slotNumber == 46) { // Organic Matter event.offsetY = -95 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index bdbc94ee7..a2efc46cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -19,16 +19,17 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.composter.ComposterAPI.getLevel import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.NONE import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -55,6 +56,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.DurationUnit object ComposterOverlay { + private var organicMatterFactors: Map<NEUInternalName, Double> = emptyMap() private var fuelFactors: Map<NEUInternalName, Double> = emptyMap() private var organicMatter: Map<NEUInternalName, Double> = emptyMap() @@ -94,11 +96,11 @@ object ComposterOverlay { fun onCommand(args: Array<String>) { if (args.size != 1) { - LorenzUtils.userError("Usage: /shtestcomposter <offset>") + ChatUtils.userError("Usage: /shtestcomposter <offset>") return } testOffset = args[0].toInt() - LorenzUtils.chat("Composter test offset set to $testOffset.") + ChatUtils.chat("Composter test offset set to $testOffset.") } @SubscribeEvent @@ -388,7 +390,7 @@ object ComposterOverlay { } val testOffset = if (testOffset_ > map.size) { - LorenzUtils.error("Invalid Composter Overlay Offset! $testOffset cannot be greater than ${map.size}!") + ChatUtils.error("Invalid Composter Overlay Offset! $testOffset cannot be greater than ${map.size}!") ComposterOverlay.testOffset = 0 0 } else testOffset_ @@ -410,7 +412,7 @@ object ComposterOverlay { factors: Map<NEUInternalName, Double>, missing: Double, onClick: (NEUInternalName) -> Unit, - bigList: MutableList<List<Any>> + bigList: MutableList<List<Any>>, ): NEUInternalName? { var i = 0 var first: NEUInternalName? = null @@ -453,7 +455,7 @@ object ComposterOverlay { itemName: String, list: MutableList<Any>, itemsNeeded: Double, - onClick: (NEUInternalName) -> Unit + onClick: (NEUInternalName) -> Unit, ) { val format = NumberUtil.format(totalPrice) val selected = if (internalName == currentOrganicMatterItem || internalName == currentFuelItem) "§n" else "" @@ -470,13 +472,15 @@ object ComposterOverlay { private fun retrieveMaterials(internalName: NEUInternalName, itemName: String, itemsNeeded: Int) { if (itemsNeeded == 0) return - if (config.retrieveFrom == ComposterConfig.RetrieveFromEntry.BAZAAR && !LorenzUtils.noTradeMode && !internalName.equals("BIOFUEL")) { + if (config.retrieveFrom == ComposterConfig.RetrieveFromEntry.BAZAAR && + !LorenzUtils.noTradeMode && !internalName.equals("BIOFUEL") + ) { BazaarApi.searchForBazaarItem(itemName, itemsNeeded) return } val having = InventoryUtils.countItemsInLowerInventory { it.getInternalName() == internalName } if (having >= itemsNeeded) { - LorenzUtils.chat("$itemName §8x${itemsNeeded} §ealready found in inventory!") + ChatUtils.chat("$itemName §8x${itemsNeeded} §ealready found in inventory!") return } @@ -487,9 +491,11 @@ object ComposterOverlay { if (sackStatus == SackStatus.MISSING || sackStatus == SackStatus.OUTDATED) { LorenzUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - having}") // TODO Add sack type repo data - val sackType = if (internalName.equals("VOLTA") || internalName.equals("OIL_BARREL") || internalName.equals("BIOFUEL")) "Mining §eor §9Dwarven" - else "Enchanted Agronomy" - LorenzUtils.clickableChat( + + val isDwarvenMineable = + internalName.let { it.equals("VOLTA") || it.equals("OIL_BARREL") || it.equals("BIOFUEL") } + val sackType = if (isDwarvenMineable) "Mining §eor §9Dwarven" else "Enchanted Agronomy" + ChatUtils.clickableChat( "Sacks could not be loaded. Click here and open your §9$sackType Sack §eto update the data!", "sax" ) @@ -497,9 +503,9 @@ object ComposterOverlay { } else if (amountInSacks == 0L) { SoundUtils.playErrorSound() if (LorenzUtils.noTradeMode) { - LorenzUtils.chat("No $itemName §efound in sacks.") + ChatUtils.chat("No $itemName §efound in sacks.") } else { - LorenzUtils.chat("No $itemName §efound in sacks. Opening Bazaar.") + ChatUtils.chat("No $itemName §efound in sacks. Opening Bazaar.") BazaarApi.searchForBazaarItem(itemName, itemsNeeded) } return @@ -508,9 +514,9 @@ object ComposterOverlay { LorenzUtils.sendCommandToServer("gfs ${internalName.asString()} ${itemsNeeded - having}") if (amountInSacks <= itemsNeeded - having) { if (LorenzUtils.noTradeMode) { - LorenzUtils.chat("You're out of $itemName §ein your sacks!") + ChatUtils.chat("You're out of $itemName §ein your sacks!") } else { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "You're out of $itemName §ein your sacks! Click here to buy more on the Bazaar!", "bz ${itemName.removeColor()}" ) @@ -544,7 +550,7 @@ object ComposterOverlay { organicMatterFactors = updateOrganicMatterFactors(organicMatter) } catch (e: Exception) { e.printStackTrace() - LorenzUtils.error("error in RepositoryReloadEvent") + ChatUtils.error("error in RepositoryReloadEvent") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index e57789884..8ab53cb9c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -18,6 +19,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenComposterInventoryFeatures { + private val config get() = GardenAPI.config.composters @SubscribeEvent @@ -45,12 +47,12 @@ class GardenComposterInventoryFeatures { if (line.endsWith(" Copper")) continue if (line == "") break val (itemName, amount) = ItemUtils.readItemAmount(line) ?: run { - LorenzUtils.error("Could not read item '$line'") + ChatUtils.error("Could not read item '$line'") continue } val internalName = NEUItems.getInternalNameOrNull(itemName) if (internalName == null) { - LorenzUtils.error( + ChatUtils.error( "Error reading internal name for item '$itemName§c' " + "(in GardenComposterInventoryFeatures)" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt index d2d866f36..b70fc9934 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt @@ -8,11 +8,11 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import io.github.moulberry.notenoughupdates.util.SkyBlockTime @@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes object FarmingContestAPI { + private val timePattern = "§a(?<month>.*) (?<day>.*)(?:rd|st|nd|th), Year (?<year>.*)".toPattern() private val contests = mutableMapOf<Long, FarmingContest>() private val cropPattern = "§8(?<crop>.*) Contest".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt index f3ce88b13..8b8150cc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt @@ -7,10 +7,10 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getLatestTrueFarmingFortune import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getLatestBlocksPerSecond +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.ceil class JacobContestFFNeededDisplay { + private val config get() = GardenAPI.config private var display = emptyList<List<Any>>() private var lastToolTipTime = 0L @@ -95,7 +96,8 @@ class JacobContestFFNeededDisplay { if (blocksPerSecond == null || trueFF == null) { add(listOf("§cMissing data from above!")) } else { - val predictedScore = ((100.0 + trueFF) * blocksPerSecond * crop.baseDrops * 20 * 60 / 100).toInt().addSeparators() + val predictedScore = + ((100.0 + trueFF) * blocksPerSecond * crop.baseDrops * 20 * 60 / 100).toInt().addSeparators() add(listOf("§6Predicted ", crop.icon, "§6crops: $predictedScore")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt index e5df0f58a..31f0e3d31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.FarmingContestEvent import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class JacobContestStatsSummary { + private val config get() = GardenAPI.config private var blocksBroken = 0 private var startTime = SimpleTimeMark.farPast() @@ -32,7 +33,7 @@ class JacobContestStatsSummary { when (event.phase) { FarmingContestPhase.START -> { - LorenzUtils.chat("Started tracking your Jacob Contest Blocks Per Second!") + ChatUtils.chat("Started tracking your Jacob Contest Blocks Per Second!") startTime = SimpleTimeMark.now() } @@ -40,16 +41,16 @@ class JacobContestStatsSummary { val duration = startTime.passedSince() val blocksPerSecond = (blocksBroken.toDouble() / duration.inWholeSeconds).round(2) val cropName = event.crop.cropName - LorenzUtils.chat("Stats for $cropName Contest:") + ChatUtils.chat("Stats for $cropName Contest:") val time = duration.format() - LorenzUtils.chat("§7Blocks Broken in total: §e${blocksBroken.addSeparators()}") + ChatUtils.chat("§7Blocks Broken in total: §e${blocksBroken.addSeparators()}") val color = getBlocksPerSecondColor(blocksPerSecond) - LorenzUtils.chat("§7Average Blocks Per Second: $color$blocksPerSecond") - LorenzUtils.chat("§7Participated for §b$time") + ChatUtils.chat("§7Average Blocks Per Second: $color$blocksPerSecond") + ChatUtils.chat("§7Participated for §b$time") } FarmingContestPhase.CHANGE -> { - LorenzUtils.chat("You changed the crop during the contest, resetting the Blocks Per Second calculation..") + ChatUtils.chat("You changed the crop during the contest, resetting the Blocks Per Second calculation..") startTime = SimpleTimeMark.now() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index f45fc93e9..7f6a91c33 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -6,11 +6,11 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getLatestTrueFarmingFortune import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getLatestBlocksPerSecond +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -23,6 +23,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class JacobContestTimeNeeded { + private val config get() = GardenAPI.config private var display = emptyList<List<Any>>() private var currentBracket = ContestBracket.GOLD @@ -64,7 +65,7 @@ class JacobContestTimeNeeded { private fun testCrop( crop: CropType, sorted: MutableMap<CropType, Duration>, - map: MutableMap<CropType, Renderable> + map: MutableMap<CropType, Renderable>, ) { val bps = crop.getBps() @@ -109,7 +110,7 @@ class JacobContestTimeNeeded { crop: CropType, averages: Map<ContestBracket, Int>, sorted: MutableMap<CropType, Duration>, - map: MutableMap<CropType, Renderable> + map: MutableMap<CropType, Renderable>, ) { var lowBPSWarning = listOf<String>() val rawSpeed = speed.toDouble() @@ -136,7 +137,7 @@ class JacobContestTimeNeeded { var bracketText = "${bracket.displayName} $color$formatDuration" var blocksPerSecond = crop.getBps() if (blocksPerSecond == null) { - marking += "§0§l !" //hoping this never shows + marking += "§0§l !" // hoping this never shows blocksPerSecond = 19.9 lowBPSWarning = listOf("§cYour Blocks/second is too low,", "§cshowing 19.9 Blocks/second instead!") } else { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index f45e909ff..727aae614 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -24,6 +24,7 @@ import java.text.SimpleDateFormat import java.util.Locale class JacobFarmingContestsInventory { + private val realTime = mutableMapOf<Int, String>() private val formatDay = SimpleDateFormat("dd MMMM yyyy", Locale.US) 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 64b4c12ce..7e91764dd 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 @@ -12,11 +12,11 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker @@ -36,6 +36,7 @@ object ArmorDropTracker { { drawDisplay(it) } class Data : TrackerData() { + override fun reset() { drops.clear() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 9c3d91065..c592b7837 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -17,14 +17,15 @@ import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.isSpeedDataEmpty import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.moveEntryToTop +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.moveEntryToTop -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems @@ -41,13 +42,13 @@ import kotlinx.coroutines.launch import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object CropMoneyDisplay { + var multipliers = mapOf<NEUInternalName, Int>() private var showCalculation = false - fun toggleShowCalculation() { showCalculation = !showCalculation - LorenzUtils.chat("Show crop money calculation: " + if (showCalculation) "enabled" else "disabled") + ChatUtils.chat("Show crop money calculation: " + if (showCalculation) "enabled" else "disabled") update() } @@ -166,7 +167,7 @@ object CropMoneyDisplay { if (moneyPerHourData.isEmpty()) { if (!isSpeedDataEmpty()) { val message = "money/hr empty but speed data not empty, retry" - LorenzUtils.debug(message) + ChatUtils.debug(message) newDisplay.addAsSingletonList("§eStill Loading...") ready = false loaded = false 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 2d1580974..250725520 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 @@ -7,13 +7,14 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CropSpeedMeter { + private var display = emptyList<String>() private var currentCrop: CropType? = null private var currentBlocks = 0 @@ -112,14 +113,14 @@ class CropSpeedMeter { } companion object { + var enabled = false private var startCrops = mapOf<CropType, Long>() fun toggle() { enabled = !enabled - LorenzUtils.chat("Crop Speed Meter " + if (enabled) "§aEnabled" else "§cDisabled") + ChatUtils.chat("Crop Speed Meter " + if (enabled) "§aEnabled" else "§cDisabled") startCrops = emptyMap() - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt index f7b22bac4..000772cbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt @@ -7,10 +7,10 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker @@ -20,12 +20,14 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern object DicerRngDropTracker { + private val itemDrops = mutableListOf<ItemDrop>() private val config get() = GardenAPI.config.dicerCounters private val tracker = SkyHanniTracker("Dicer RNG Drop Tracker", { Data() }, { it.garden.dicerDropTracker }) { drawDisplay(it) } class Data : TrackerData() { + override fun reset() { drops.clear() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index c84470be4..e43bbb7dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.OSUtils @@ -91,6 +92,7 @@ class FarmingWeightDisplay { } companion object { + private val config get() = GardenAPI.config.eliteFarmingWeights private val localCounter = mutableMapOf<CropType, Long>() private var dispatcher = Dispatchers.IO @@ -229,8 +231,8 @@ class FarmingWeightDisplay { // Check that the provided string is valid val parsed = value.toIntOrNull() ?: 0 if (parsed < 1 || parsed > goal) { - LorenzUtils.error("Invalid Farming Weight Overtake Goal!") - LorenzUtils.chat( + ChatUtils.error("Invalid Farming Weight Overtake Goal!") + ChatUtils.chat( "§eEdit the Overtake Goal config value with a valid number [1-10000] to use this feature!", false ) @@ -330,7 +332,7 @@ class FarmingWeightDisplay { } private fun farmingChatMessage(message: String) { - LorenzUtils.hoverableChat( + ChatUtils.hoverableChat( message, listOf( "§eClick to open your Farming Weight", @@ -403,8 +405,8 @@ class FarmingWeightDisplay { private fun showLbChange(direction: String, oldPosition: Int) { farmingChatMessage( "§7Since your last visit to the §aGarden§7, " + - "you have $direction §7on the §dFarming Leaderboard§7. " + - "§7(§e#${oldPosition.addSeparators()} §7-> §e#${leaderboardPosition.addSeparators()}§7)" + "you have $direction §7on the §dFarming Leaderboard§7. " + + "§7(§e#${oldPosition.addSeparators()} §7-> §e#${leaderboardPosition.addSeparators()}§7)" ) } @@ -479,10 +481,10 @@ class FarmingWeightDisplay { private fun error() { apiError = true - LorenzUtils.error( + ChatUtils.error( "Loading the farming weight data from elitebot.dev failed!\n" - + "§eYou can re-enter the garden to try to fix the problem.\n" + - "§cIf this message repeats, please report it on Discord!", + + "§eYou can re-enter the garden to try to fix the problem.\n" + + "§cIf this message repeats, please report it on Discord!", ) } @@ -530,7 +532,7 @@ class FarmingWeightDisplay { lastName = name OSUtils.openBrowser("https://elitebot.dev/@$name/") - LorenzUtils.chat("Opening Farming Profile of player §b$name") + ChatUtils.chat("Opening Farming Profile of player §b$name") } private val factorPerCrop = mutableMapOf<CropType, Double>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index 4e820c245..c5547fc9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -11,17 +11,19 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ConfigUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenBestCropTime { + var display = emptyList<List<Any>>() companion object { + private val config get() = GardenAPI.config.cropMilestones val timeTillNextCrop = mutableMapOf<CropType, Long>() @@ -116,7 +118,6 @@ class GardenBestCropTime { val currentTier = GardenCropMilestones.getTierForCropCount(crop.getCounter(), crop) val nextTier = if (config.bestShowMaxedNeeded.get()) 46 else currentTier + 1 - val cropName = if (!config.next.bestCompact) crop.cropName + " " else "" val tier = if (!config.next.bestCompact) "$currentTier➜$nextTier§r " else "" list.add("$color$contestFormat$cropName$tier§b$duration") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index adfe0518d..b27d3e863 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -20,9 +20,10 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.setSpeed import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SoundUtils @@ -34,6 +35,7 @@ import java.util.Collections import kotlin.time.Duration.Companion.seconds object GardenCropMilestoneDisplay { + private var progressDisplay = emptyList<List<Any>>() private var mushroomCowPerkDisplay = emptyList<List<Any>>() private val cultivatingData = mutableMapOf<CropType, Long>() @@ -45,7 +47,7 @@ object GardenCropMilestoneDisplay { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle( + ConditionalUtils.onToggle( config.bestShowMaxedNeeded, config.highestTimeFormat, ) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index 5e0cedacc..8232f5fc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -13,13 +13,14 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer object GardenCropSpeed { + private val config get() = GardenAPI.config private val cropsPerSecond: MutableMap<CropType, Int>? get() = GardenAPI.storage?.cropsPerSecond private val latestBlocksPerSecond: MutableMap<CropType, Double>? get() = GardenAPI.storage?.latestBlocksPerSecond @@ -42,7 +43,9 @@ object GardenCropSpeed { fixedRateTimer(name = "skyhanni-crop-milestone-speed", period = 1000L) { if (isEnabled()) { if (GardenAPI.mushroomCowPet) { - CropType.MUSHROOM.setCounter(CropType.MUSHROOM.getCounter() + blocksBroken * (lastBrokenCrop?.multiplier ?: 1)) + CropType.MUSHROOM.setCounter( + CropType.MUSHROOM.getCounter() + blocksBroken * (lastBrokenCrop?.multiplier ?: 1) + ) } checkSpeed() update() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt index 6bbde660f..c9e4e30ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt @@ -13,6 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable import java.util.IdentityHashMap object GardenCustomKeybinds { + private val config get() = GardenAPI.config.keyBind private val mcSettings get() = Minecraft.getMinecraft().gameSettings diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt index f1fdd112a..de1730c93 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt @@ -4,22 +4,23 @@ import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenStartLocation { + private val config get() = GardenAPI.config.cropStartLocation fun setLocationCommand() { if (!GardenAPI.inGarden()) { - LorenzUtils.userError("This Command only works in the garden!") + ChatUtils.userError("This Command only works in the garden!") return } if (!config.enabled) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "This feature is disabled. Enable it in the config: §e/sh crop start location", "sh crop start location", prefixColor = "§c" @@ -29,18 +30,18 @@ object GardenStartLocation { val startLocations = GardenAPI.storage?.cropStartLocations if (startLocations == null) { - LorenzUtils.userError("The config is not yet loaded, retry in a second.") + ChatUtils.userError("The config is not yet loaded, retry in a second.") return } val crop = GardenAPI.getCurrentlyFarmedCrop() if (crop == null) { - LorenzUtils.userError("Hold a crop specific farming tool in the hand!") + ChatUtils.userError("Hold a crop specific farming tool in the hand!") return } startLocations[crop] = LocationUtils.playerLocation() - LorenzUtils.chat("You changed your Crop Start Location for ${crop.cropName}!") + ChatUtils.chat("You changed your Crop Start Location for ${crop.cropName}!") } @SubscribeEvent @@ -52,7 +53,7 @@ object GardenStartLocation { if (!startLocations.contains(crop)) { startLocations[crop] = LocationUtils.playerLocation() - LorenzUtils.chat("Auto updated your Crop Start Location for ${crop.cropName}") + ChatUtils.chat("Auto updated your Crop Start Location for ${crop.cropName}") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt index aaa1a734c..a1181b1d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemBlink import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class WildStrawberryDyeNotification { + private var lastCloseTime = 0L val item by lazy { "DYE_WILD_STRAWBERRY".asInternalName() } @@ -37,7 +39,7 @@ class WildStrawberryDyeNotification { if (internalName == item) { val name = itemStack.name!! LorenzUtils.sendTitle(name, 5.seconds) - LorenzUtils.chat("You found a $name§e!") + ChatUtils.chat("You found a $name§e!") SoundUtils.playBeepSound() ItemBlink.setBlink(itemStack, 5_000) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt index aeae6de44..f0a69aa3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class WrongFungiCutterWarning { + private var mode = FungiMode.UNKNOWN private var lastPlaySoundTime = 0L @@ -74,6 +75,7 @@ class WrongFungiCutterWarning { ; companion object { + fun getOrNull(mode: String) = entries.firstOrNull { it.name == mode } ?: error("Unknown fungi mode: '$mode'") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index d8fd9f13d..d2eba9974 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull @@ -27,6 +28,7 @@ import kotlin.math.round import kotlin.time.Duration.Companion.days class CaptureFarmingGear { + private val farmingItems get() = GardenAPI.storage?.fortune?.farmingItems private val outdatedItems get() = GardenAPI.storage?.fortune?.outdatedItems @@ -52,6 +54,7 @@ class CaptureFarmingGear { ) companion object { + private val strengthPattern = " Strength: §r§c❁(?<strength>.*)".toPattern() private val farmingSets = arrayListOf( "FERMENTO", "SQUASH", "CROPIE", "MELON", "FARM", @@ -66,8 +69,8 @@ class CaptureFarmingGear { val currentCrop = itemStack.getCropType() if (currentCrop == null) { - //todo better fall back items - //todo Daedalus axe + // todo better fall back items + // todo Daedalus axe } else { for (item in FarmingItems.entries) { if (item.name == currentCrop.name) { @@ -96,13 +99,13 @@ class CaptureFarmingGear { fun reverseCarrotFortune() { val storage = GardenAPI.storage?.fortune ?: return storage.carrotFortune = !storage.carrotFortune - LorenzUtils.chat("Toggled exportable carrot fortune to: ${storage.carrotFortune}") + ChatUtils.chat("Toggled exportable carrot fortune to: ${storage.carrotFortune}") } fun reversePumpkinFortune() { val storage = GardenAPI.storage?.fortune ?: return storage.pumpkinFortune = !storage.pumpkinFortune - LorenzUtils.chat("Toggled expired pumpkin fortune to: ${storage.pumpkinFortune}") + ChatUtils.chat("Toggled expired pumpkin fortune to: ${storage.pumpkinFortune}") } private fun getUniqueVisitorsForTier(tier: Int): Int { @@ -164,7 +167,7 @@ class CaptureFarmingGear { private fun anita( items: Map<Int, ItemStack>, - storage: Storage.ProfileSpecific.GardenStorage.Fortune + storage: Storage.ProfileSpecific.GardenStorage.Fortune, ) { var level = -1 for ((_, item) in items) { @@ -186,7 +189,7 @@ class CaptureFarmingGear { private fun configurePlots( items: Map<Int, ItemStack>, - storage: Storage.ProfileSpecific.GardenStorage.Fortune + storage: Storage.ProfileSpecific.GardenStorage.Fortune, ) { var plotsUnlocked = 24 for (slot in items) { @@ -213,7 +216,7 @@ class CaptureFarmingGear { private fun skills( items: Map<Int, ItemStack>, - storage: Storage.ProfileSpecific.GardenStorage.Fortune + storage: Storage.ProfileSpecific.GardenStorage.Fortune, ) { for ((_, item) in items) { if (item.displayName.contains("Farming ")) { @@ -225,7 +228,7 @@ class CaptureFarmingGear { private fun pets( farmingItems: MutableMap<FarmingItems, ItemStack>, items: Map<Int, ItemStack>, - outdatedItems: MutableMap<FarmingItems, Boolean> + outdatedItems: MutableMap<FarmingItems, Boolean>, ) { // If they've 2 of same pet, one will be overwritten // optimize @@ -275,7 +278,7 @@ class CaptureFarmingGear { private fun equipmentAndStats( items: Map<Int, ItemStack>, farmingItems: MutableMap<FarmingItems, ItemStack>, - outdatedItems: MutableMap<FarmingItems, Boolean> + outdatedItems: MutableMap<FarmingItems, Boolean>, ) { for ((_, slot) in items) { val split = slot.getInternalName().asString().split("_") @@ -337,11 +340,11 @@ class CaptureFarmingGear { } if (msg == "[NPC] Carrolyn: Thank you for the carrots.") { storage.carrotFortune = true - LorenzUtils.chat("§aYou have already given Carrolyn enough Exportable Carrots.") + ChatUtils.chat("§aYou have already given Carrolyn enough Exportable Carrots.") } if (msg == "[NPC] Carrolyn: Thank you for the pumpkins.") { storage.pumpkinFortune = true - LorenzUtils.chat("§aYou have already given Carrolyn enough Expired Pumpkins.") + ChatUtils.chat("§aYou have already given Carrolyn enough Expired Pumpkins.") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index d93dfd36a..9cbce06de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -19,6 +19,7 @@ import java.io.IOException open class FFGuideGUI : GuiScreen() { companion object { + val pages = mutableMapOf<FortuneGuidePage, FFGuidePage>() var guiLeft = 0 @@ -31,7 +32,7 @@ open class FFGuideGUI : GuiScreen() { var selectedPage = FortuneGuidePage.OVERVIEW var currentCrop: CropType? = null - //todo set this to what they have equip + // todo set this to what they have equip var currentPet = FarmingItems.ELEPHANT var currentArmor = 0 var currentEquipment = 0 @@ -473,6 +474,7 @@ open class FFGuideGUI : GuiScreen() { } abstract class FFGuidePage { + abstract fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index fdef21a09..0732535f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack import kotlin.math.floor object FFStats { + private val mathCrops = listOf(CropType.WHEAT, CropType.CARROT, CropType.POTATO, CropType.SUGAR_CANE, CropType.NETHER_WART) private val dicerCrops = listOf(CropType.PUMPKIN, CropType.MELON) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt index d640d9741..1e911688a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt @@ -8,7 +8,7 @@ enum class FarmingReforges( val rare: Int, val epic: Int, val legendary: Int, - val mythic: Int + val mythic: Int, ) { // if reforge item is an empty string it means it will never be called, just for upgrading and recomb stats BLESSED("Blessed", "BLESSED_FRUIT", 5, 7, 9, 13, 16, 20), BOUNTIFUL("Bountiful", "GOLDEN_BALL", 1, 2, 3, 5, 7, 10), @@ -31,4 +31,4 @@ operator fun FarmingReforges.get(index: Int, current: Double = 0.0): Double? { 5 -> mythic - current else -> null } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt index fb3c30123..e0b74ce8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt @@ -4,12 +4,13 @@ enum class FarmingSets( val helmetIncrease: Double, val chestplateIncrease: Double, val leggingsIncrease: Double, - val bootsIncrease: Double + val bootsIncrease: Double, ) { + MELON(15.0, 20.0, 20.0, 15.0), CROPIE(15.0, 20.0, 20.0, 15.0), SQUASH(15.0, 20.0, 20.0, 15.0), FERMENTO(15.0, 20.0, 20.0, 15.0), FARMER(0.0, 0.0, 0.0, 0.0), RANCHERS(0.0, 0.0, 0.0, 0.0) -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt index af02f7577..1288b95bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt @@ -9,7 +9,7 @@ enum class FortuneStats(val label: String, val tooltip: String) { CROP_TOTAL("§6Crop Farming Fortune", "§7§2Farming fortune for this crop"), ACCESSORY("§2Talisman Bonus", "§7§2Fortune from your talisman\n§2You get 10☘ per talisman tier"), CROP_UPGRADE("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n§2You get 5☘ per level"), - BASE_TOOL("§2Base tool fortune","§7§2Crop specific fortune from your tool"), + BASE_TOOL("§2Base tool fortune", "§7§2Crop specific fortune from your tool"), REFORGE("§2Tool reforge", "§7§2Fortune from reforging your tool"), FFD("§2Farming for Dummies", "§7§2Fortune for each applied book\n§2You get 1☘ per applied book"), COUNTER("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n§2You get 16☘ per digit - 4"), diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrade.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrade.kt index 70ce14178..e503dfc82 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrade.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrade.kt @@ -7,5 +7,5 @@ data class FortuneUpgrade( val itemQuantity: Int, val fortuneIncrease: Double, var cost: Int? = null, - var costPerFF: Int? = null // also the same as time to repay -)
\ No newline at end of file + var costPerFF: Int? = null, // also the same as time to repay +) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index c7ff7275a..f137651a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -23,6 +23,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated import net.minecraft.item.ItemStack object FortuneUpgrades { + private val equipment = listOf(FarmingItems.NECKLACE, FarmingItems.CLOAK, FarmingItems.BELT, FarmingItems.BRACELET) private val armor = listOf(FarmingItems.HELMET, FarmingItems.CHESTPLATE, FarmingItems.LEGGINGS, FarmingItems.BOOTS) private val axeCrops = listOf(CropType.MELON, CropType.PUMPKIN, CropType.COCOA_BEANS) @@ -59,7 +60,7 @@ object FortuneUpgrades { genericUpgrades.populateAndSort(0) } - //todo fix NEU price data not being loaded if run too early + // todo fix NEU price data not being loaded if run too early private fun MutableList<FortuneUpgrade>.populateAndSort(style: Int) { this.map { upgrade -> val cost = (NEUItems.getPrice(upgrade.requiredItem) * (upgrade.itemQuantity)).toInt() @@ -94,7 +95,7 @@ object FortuneUpgrades { val visitors = GardenAPI.storage?.uniqueVisitors?.toDouble() ?: 0.0 for (piece in equipment) { val item = piece.getItem() - //todo tell them to buy the missing item + // todo tell them to buy the missing item if (!item.getInternalName().contains("LOTUS")) return val enchantments = item.getEnchantments() ?: emptyMap() val greenThumbLvl = enchantments["green_thumb"] ?: 0 @@ -119,12 +120,12 @@ object FortuneUpgrades { } } } - //todo adding armor tier upgrades later + // todo adding armor tier upgrades later private fun getArmorUpgrades() { for (piece in armor) { val item = piece.getItem() - //todo skip if it doesnt exist -> tell them to buy it later + // todo skip if it doesnt exist -> tell them to buy it later if (FFGuideGUI.isFallbackItem(item)) return @@ -142,17 +143,17 @@ object FortuneUpgrades { } } - //todo needs to be called when switching pets + // todo needs to be called when switching pets private fun getPetUpgrades() { if (currentPet.getItem().getInternalName().contains(";")) { when (FFStats.currentPetItem) { "GREEN_BANDANA" -> {} "YELLOW_BANDANA" -> { - //todo once auction stuff is done + // todo once auction stuff is done } else -> { - //give pet yellow bandana + // give pet yellow bandana } } } @@ -273,7 +274,7 @@ object FortuneUpgrades { item: ItemStack, reforge: FarmingReforges, list: MutableList<FortuneUpgrade>, - copperPrice: Int? = null + copperPrice: Int? = null, ) { FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) val increase = reforge[item.getItemRarityOrCommon().id, FarmingFortuneDisplay.reforgeFortune] ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt index 670756832..fb52aa54c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.TimeUtils class OverviewPage : FFGuideGUI.FFGuidePage() { + private var equipmentFF = mutableMapOf<FFTypes, Double>() private var armorFF = mutableMapOf<FFTypes, Double>() @@ -215,7 +216,8 @@ class OverviewPage : FFGuideGUI.FFGuidePage() { val maxEquipmentReforgeFortune = 15.0 val maxGreenThumbFortune = GardenAPI.totalAmountVisitorsExisting.toDouble() / 4 - val maxFortunePerPiece = maxEquipmentBaseFortune + maxEquipmentAbilityFortune + maxEquipmentReforgeFortune + maxGreenThumbFortune + val maxFortunePerPiece = + maxEquipmentBaseFortune + maxEquipmentAbilityFortune + maxEquipmentReforgeFortune + maxGreenThumbFortune line = if (currentEquipment == 0) "§7§2Total fortune from all your equipment\n§2Select a piece for more info" else "§7§2Total fortune from your\n${equipmentItem.getItem().displayName}" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt index dd6664bc7..0ded703ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt @@ -12,6 +12,7 @@ import net.minecraft.util.MathHelper import java.text.DecimalFormat class UpgradePage : FFGuideGUI.FFGuidePage() { + private var pageScroll = 0 private var scrollVelocity = 0.0 private val maxNoInputFrames = 100 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index f47e45bf4..c9271231c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -6,8 +6,8 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradeCostsJson.Price import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.indexOfFirst import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.indexOfFirst import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaExtraFarmingFortune { + private val config get() = GardenAPI.config.anitaShop private var levelPrice = mapOf<Int, Price>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt index ded515cec..b6ff2169b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt @@ -9,8 +9,8 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.indexOfFirst import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.indexOfFirst import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.StringUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenCropMilestoneInventory { + private var average = -1.0 private val config get() = GardenAPI.config diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt index 7ace9f0db..b87b7bf33 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenInventoryNumbers { + private val config get() = GardenAPI.config.number private var patternUpgradeTier = "§7Current Tier: §[ea](?<tier>.*)§7/§a.*".toPattern() @@ -59,5 +60,4 @@ class GardenInventoryNumbers { event.move(3, "garden.numberCropUpgrades", "garden.number.cropUpgrades") event.move(3, "garden.numberComposterUpgrades", "garden.number.composterUpgrades") } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt index 037031360..91c65b8a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt @@ -2,10 +2,10 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -41,7 +41,7 @@ class GardenNextPlotPrice { val format = NumberUtil.format(price) list[i] = list[i] + " §7(§6$format§7)" } ?: { - LorenzUtils.error("Could not read item '$line'") + ChatUtils.error("Could not read item '$line'") } break } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt index c7ff13dc6..db5cec5a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent import io.github.moulberry.notenoughupdates.events.SlotClickEvent @@ -105,7 +105,7 @@ object GardenPlotIcon { event.isCanceled = true copyStack = event.slot.stack ?: return // TODO different format, not bold or show not in chat at all. - LorenzUtils.chat("§6§lClick an item in the desk menu to replace it with that item!") + ChatUtils.chat("§6§lClick an item in the desk menu to replace it with that item!") return } if (event.slotId != 53) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 0aba4b861..b304dd43e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -5,11 +5,11 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getPrice @@ -21,11 +21,13 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkyMartCopperPrice { + private val copperPattern = "§c(?<amount>.*) Copper".toPattern() private var display = emptyList<List<Any>>() private val config get() = GardenAPI.config.skyMart companion object { + var inInventory = false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt index f886648d0..dca966be1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName object PestAPI { + val config get() = GardenAPI.config.pests var scoreboardPests = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index cc7019cf1..63a4b66d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -17,10 +17,10 @@ import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.pests import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.renderPlot import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.sendTeleportTo import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -51,7 +51,7 @@ class PestFinder { PestSpawnTimer.lastSpawnTime = SimpleTimeMark.now() val plot = GardenPlotAPI.getPlotByName(event.plotName) if (plot == null) { - LorenzUtils.userError("Open Desk to load plot names and pest locations!") + ChatUtils.userError("Open Desk to load plot names and pest locations!") return } plot.pests += event.amountPests @@ -75,7 +75,6 @@ class PestFinder { } } update() - } private fun update() { @@ -162,7 +161,7 @@ class PestFinder { } } if (fixed) { - LorenzUtils.debug("Auto fixed all plots with pests.") + ChatUtils.debug("Auto fixed all plots with pests.") } } @@ -178,7 +177,7 @@ class PestFinder { private fun removeNearestPest() { val plot = getNearestInfectedPest() ?: run { - LorenzUtils.error("Can not remove nearest pest: No infected plots detected.") + ChatUtils.error("Can not remove nearest pest: No infected plots detected.") return } plot.pests-- @@ -218,7 +217,6 @@ class PestFinder { val location = playerLocation.copy(x = middle.x, z = middle.z) event.drawWaypointFilled(location, LorenzColor.RED.toColor()) event.drawDynamicText(location, "§c$pestsName §7in §b$plotName", 1.5) - } } @@ -235,12 +233,12 @@ class PestFinder { lastKeyPress = SimpleTimeMark.now() val plot = getNearestInfectedPest() ?: run { - LorenzUtils.userError("No infected plots detected to warp to!") + ChatUtils.userError("No infected plots detected to warp to!") return } if (plot.isPlayerInside()) { - LorenzUtils.userError("You stand already on the infected plot!") + ChatUtils.userError("You stand already on the infected plot!") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt index 52d530131..df044dbc1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.features.garden.pests.PestSpawnConfig.ChatMe import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.garden.pests.PestSpawnEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils @@ -14,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class PestSpawn { + private val config get() = PestAPI.config.pestSpawn private val patternOnePest = "§6§l.*! §7A §6Pest §7has appeared in §aPlot §7- §b(?<plot>.*)§7!".toPattern() @@ -55,7 +57,7 @@ class PestSpawn { } if (config.chatMessageFormat == PestSpawnConfig.ChatMessageFormatEntry.COMPACT) { - LorenzUtils.clickableChat(message, "tptoplot $plotName") + ChatUtils.clickableChat(message, "tptoplot $plotName") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt index 726032591..deb5af218 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawnTimer.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PestSpawnTimer { + private val config get() = PestAPI.config.pestTimer var lastSpawnTime = SimpleTimeMark.farPast() 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 fa48a0518..754398106 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 @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isSprayExpired import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.markExpiredSprayAsNotified import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.name import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.plots -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils.timerColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SprayDisplay { + private val config get() = PestAPI.config.spray private var display: String? = null @@ -63,6 +64,6 @@ class SprayDisplay { val plotString = StringUtils.createCommaSeparatedList(expiredPlots.map { "§b${it.name}" }, "§7") val sprayString = if (expiredPlots.size > 1) "sprays" else "spray" val out = "$wasAwayString $sprayString on §aPlot §7- $plotString §7expired." - LorenzUtils.chat(out) + ChatUtils.chat(out) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt index b5e317f30..462dccb16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class SprayFeatures { + private val config get() = PestAPI.config.spray private var display: String? = null @@ -49,7 +50,6 @@ class SprayFeatures { display = "§a${type.displayName} §7(§6$pests§7)" lastChangeTime = SimpleTimeMark.now() - } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayType.kt index eec073cf3..cb17de882 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayType.kt @@ -9,6 +9,7 @@ enum class SprayType(val displayName: String) { ; companion object { - fun getByName(name: String) = entries.firstOrNull {it.displayName == name} + + fun getByName(name: String) = entries.firstOrNull { it.displayName == name } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt index c35b2d78a..2a5278c47 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenVisitorColorNames { + private var visitorColours = mutableMapOf<String, String>() // name -> color code var visitorItems = mutableMapOf<String, List<String>>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 35f53038d..d8042272e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -11,11 +11,11 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenVisitorDropStatistics { + private val config get() = GardenAPI.config.visitors.dropsStatistics private var display = emptyList<List<Any>>() 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 d9eb440e8..f5e283ae4 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 @@ -25,6 +25,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.InventoryUtils @@ -37,7 +39,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems @@ -70,6 +71,7 @@ import kotlin.time.Duration.Companion.seconds private val config get() = VisitorAPI.config class GardenVisitorFeatures { + private var display = emptyList<List<Any>>() private val newVisitorArrivedMessage = ".* §r§ehas arrived on your §r§bGarden§r§e!".toPattern() private val copperPattern = " §8\\+§c(?<amount>.*) Copper".toPattern() @@ -206,7 +208,7 @@ class GardenVisitorFeatures { private fun MutableList<List<Any>>.drawVisitors( newVisitors: MutableList<String>, - shoppingList: MutableMap<NEUInternalName, Int> + shoppingList: MutableMap<NEUInternalName, Int>, ) { if (newVisitors.isNotEmpty()) { if (shoppingList.isNotEmpty()) { @@ -226,7 +228,7 @@ class GardenVisitorFeatures { if (items == null) { val text = "Visitor '$visitor' has no items in repo!" logger.log(text) - LorenzUtils.debug(text) + ChatUtils.debug(text) list.add(" §7(§c?§7)") continue } @@ -345,7 +347,7 @@ class GardenVisitorFeatures { if (wasEmpty) { visitor.hasReward()?.let { reward -> if (config.rewardWarning.notifyInChat) { - LorenzUtils.chat("Found Visitor Reward ${reward.displayName}§e!") + ChatUtils.chat("Found Visitor Reward ${reward.displayName}§e!") } } } @@ -438,7 +440,7 @@ class GardenVisitorFeatures { } if (config.notificationChat) { val displayName = GardenVisitorColorNames.getColoredName(name) - LorenzUtils.chat("$displayName §eis visiting your garden!") + ChatUtils.chat("$displayName §eis visiting your garden!") } if (System.currentTimeMillis() > LorenzUtils.lastWorldSwitch + 2_000) { @@ -465,7 +467,7 @@ class GardenVisitorFeatures { if (config.shoppingList.display) { partialAcceptedPattern.matchMatcher(event.message) { - LorenzUtils.chat("Talk to the visitor again to update the number of items needed!") + ChatUtils.chat("Talk to the visitor again to update the number of items needed!") } } } @@ -676,6 +678,5 @@ class GardenVisitorFeatures { event.move(18, "garden.visitors.needs", "garden.visitors.shoppingList") } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 67a450146..6518a2bd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -28,6 +28,7 @@ import kotlin.time.DurationUnit import kotlin.time.toDuration class GardenVisitorTimer { + private val config get() = GardenAPI.config.visitors.timer private val pattern = "§b§lVisitors: §r§f\\((?<time>.*)\\)".toPattern() private var display = "" @@ -38,7 +39,7 @@ class GardenVisitorTimer { private var lastTimerValue = "" private var lastTimerUpdate = SimpleTimeMark.farPast() - //TODO nea? + // TODO nea? // private val visitorInterval by dynamic(GardenAPI::config, Storage.ProfileSpecific.GardenStorage::visitorInterval) private var visitorInterval: Duration? get() = GardenAPI.storage?.visitorInterval?.toDuration(DurationUnit.MILLISECONDS) @@ -49,6 +50,7 @@ class GardenVisitorTimer { } companion object { + var lastVisitors: Int = -1 } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt index bd0fe5704..f381723cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.getSkinTexture import at.hannibal2.skyhanni.utils.LorenzColor @@ -25,6 +26,7 @@ import net.minecraft.network.play.client.C02PacketUseEntity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightVisitorsOutsideOfGarden { + private var visitorJson = mapOf<String?, List<GardenJson.GardenVisitor>>() private val config get() = GardenAPI.config.visitors @@ -96,7 +98,7 @@ class HighlightVisitorsOutsideOfGarden { if (isVisitor(entity) || (entity is EntityArmorStand && isVisitorNearby(entity.getLorenzVec()))) { event.isCanceled = true if (packet.action == C02PacketUseEntity.Action.INTERACT) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Blocked you from interacting with a visitor. Sneak to bypass or click here to change settings.", "/sh block interacting with visitors" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt index 5fe8f1dd0..19edd0d28 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt @@ -5,11 +5,11 @@ import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorOpenEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -24,6 +24,7 @@ import kotlin.time.Duration.Companion.seconds * Fixing the visitor detection problem with Anita and Jacob, as those two are on the garden twice when visiting. */ object NPCVisitorFix { + private val storage get() = ProfileStorageData.profileSpecific?.garden private val staticVisitors = listOf("Jacob", "Anita") private val barnSkinChangePattern by RepoPattern.pattern("garden.barn.skin.change", "§aChanging Barn skin to §r.*") @@ -51,7 +52,7 @@ object NPCVisitorFix { } storage.npcVisitorLocations[name] = location - LorenzUtils.chat("Saved $name NPC location. Real $name visitors are now getting detected correctly.") + ChatUtils.chat("Saved $name NPC location. Real $name visitors are now getting detected correctly.") } private var lastVisitorOpen = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt index c3c832d78..012773b39 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt @@ -7,15 +7,17 @@ import at.hannibal2.skyhanni.events.garden.visitor.VisitorRefusedEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.NEUInternalName import net.minecraft.item.ItemStack object VisitorAPI { + private var visitors = mapOf<String, Visitor>() var inInventory = false val config get() = GardenAPI.config.visitors @@ -54,7 +56,7 @@ object VisitorAPI { if (visitor == null) { // workaround if the tab list has not yet updated when opening the visitor addVisitor(name) - LorenzUtils.debug("Found visitor from npc that is not in tab list. Adding it still.") + ChatUtils.debug("Found visitor from npc that is not in tab list. Adding it still.") visitor = visitors[name] } @@ -99,7 +101,7 @@ object VisitorAPI { } class VisitorOffer( - val offerItem: ItemStack + val offerItem: ItemStack, ) class Visitor( @@ -111,6 +113,7 @@ object VisitorAPI { val shoppingList: MutableMap<NEUInternalName, Int> = mutableMapOf(), var offer: VisitorOffer? = null, ) { + var lore: List<String> = emptyList() var allRewards = listOf<NEUInternalName>() var lastLore = listOf<String>() @@ -160,7 +163,7 @@ object VisitorAPI { continue } - //hide own player name + // hide own player name if (name.contains(LorenzUtils.getPlayerName())) { logger.log("Ignore wrong own name: '$name'") continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index c71cf1c86..78cf473ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI.VisitorStatus import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI.config import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld @@ -37,10 +38,12 @@ import org.lwjgl.input.Keyboard private val config get() = VisitorAPI.config class VisitorListener { + private var lastClickedNpc = 0 private val logger = LorenzLogger("garden/visitors/listener") companion object { + private val VISITOR_INFO_ITEM_SLOT = 13 private val VISITOR_ACCEPT_ITEM_SLOT = 29 private val VISITOR_REFUSE_ITEM_SLOT = 33 @@ -138,13 +141,13 @@ class VisitorListener { visitor.hasReward()?.let { if (config.rewardWarning.preventRefusing) { if (config.rewardWarning.bypassKey.isKeyHeld()) { - LorenzUtils.chat("§cBypassed blocking refusal of visitor ${visitor.visitorName} §7(${it.displayName}§7)") + ChatUtils.chat("§cBypassed blocking refusal of visitor ${visitor.visitorName} §7(${it.displayName}§7)") return } event.isCanceled = true - LorenzUtils.chat("§cBlocked refusing visitor ${visitor.visitorName} §7(${it.displayName}§7)") + ChatUtils.chat("§cBlocked refusing visitor ${visitor.visitorName} §7(${it.displayName}§7)") if (config.rewardWarning.bypassKey == Keyboard.KEY_NONE) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "§eIf you want to deny this visitor, set a keybind in §e/sh bypass", "sh bypass", false diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt index 3f5f5eb17..76ef14237 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt @@ -5,7 +5,12 @@ import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack -enum class VisitorReward(private val rawInternalName: String, val displayName: String, private val legacyId: Int = -1) : HasLegacyId { +enum class VisitorReward( + private val rawInternalName: String, + val displayName: String, + private val legacyId: + Int = -1 +) : HasLegacyId { FLOWERING_BOUQUET("FLOWERING_BOUQUET", "§9Flowering Bouquet", legacyId = 0), OVERGROWN_GRASS("OVERGROWN_GRASS", "§9Overgrown Grass", legacyId = 1), GREEN_BANDANA("GREEN_BANDANA", "§9Green Bandana", legacyId = 2), @@ -23,6 +28,7 @@ enum class VisitorReward(private val rawInternalName: String, val displayName: S // val displayName by lazy { itemStack.nameWithEnchantment ?: internalName.asString() } companion object { + fun getByInternalName(internalName: NEUInternalName) = entries.firstOrNull { it.internalName == internalName } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorTooltipParser.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorTooltipParser.kt index 851c5ece7..647a0229a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorTooltipParser.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorTooltipParser.kt @@ -13,10 +13,10 @@ class VisitorTooltipParser { enum class ParsingSection { ITEMS_NEEDED, REWARDS - } companion object { + fun parse(lore: List<String>, config: GardenConfig?): ParsedTooltip { var section = ParsingSection.ITEMS_NEEDED val parsedData = ParsedTooltip(mutableMapOf(), mutableMapOf(), config ?: GardenConfig()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt index f512733b8..45d5bd7bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt @@ -17,8 +17,12 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AuctionsHighlighter { + private val config get() = SkyHanniMod.feature.inventory - private val buyItNowPattern by RepoPattern.pattern("auctions.highlight.buyitnow", "§7Buy it now: §6(?<coins>.*) coins") + private val buyItNowPattern by RepoPattern.pattern( + "auctions.highlight.buyitnow", + "§7Buy it now: §6(?<coins>.*) coins" + ) @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index f8b536bf4..35222706e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -12,11 +12,11 @@ import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValueCalculator +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -285,7 +285,7 @@ class ChestValue { var amount: Int, val stack: ItemStack, var total: Double, - val tips: MutableList<String> + val tips: MutableList<String>, ) private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt index 1c91b8168..ae987a2f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt @@ -23,7 +23,10 @@ class DojoRankDisplay { private var display = emptyList<String>() private val patternGroup = RepoPattern.group("inventory.dojo.rankdisplay") private val testNamePattern by patternGroup.pattern("name", "(?<color>§\\w)Test of (?<name>.*)") - private val testRankPattern by patternGroup.pattern("rank", "(?:§\\w)+Your Rank: (?<rank>§\\w.) §8\\((?<score>\\d+)\\)") + private val testRankPattern by patternGroup.pattern( + "rank", + "(?:§\\w)+Your Rank: (?<rank>§\\w.) §8\\((?<score>\\d+)\\)" + ) private var belts = mapOf<String, Int>() @SubscribeEvent @@ -48,7 +51,7 @@ class DojoRankDisplay { testRankPattern.matchMatcher(line) { val rank = group("rank") val score = group("score").toInt() - val color = if (score in 0 .. 99) "§c" else "§a" + val color = if (score in 0..99) "§c" else "§a" totalScore += score add("$testColor$testName§f: $rank §7($color${score.addSeparators()}§7)") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 4088a4264..2a020fc8e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -13,6 +13,8 @@ import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils @@ -24,7 +26,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.isVanilla import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf import at.hannibal2.skyhanni.utils.MultiFilter import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftExportable @@ -41,6 +42,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HideNotClickableItems { + private val config get() = SkyHanniMod.feature.inventory.hideNotClickable private var hideReason = "" @@ -132,7 +134,7 @@ class HideNotClickableItems { event.toolTip.add("") if (hideReason == "") { event.toolTip.add("§4No hide reason!") - LorenzUtils.error("No hide reason for not clickable item!") + ChatUtils.error("No hide reason for not clickable item!") } else { event.toolTip.add("§c$hideReason") if (config.itemsBypass) { @@ -561,6 +563,5 @@ class HideNotClickableItems { event.move(3, "inventory.hideNotClickableOpacity", "inventory.hideNotClickable.opacity") event.move(3, "inventory.notClickableItemsBypass", "inventory.hideNotClickable.itemsBypass") event.move(3, "inventory.hideNotClickableItemsGreenLine", "inventory.hideNotClickable.itemsGreenLine") - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt index f44970145..f850b410c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt @@ -24,6 +24,7 @@ import kotlin.time.TimeSource */ @OptIn(ExperimentalTime::class) class HighlightBonzoMasks { + private val config get() = SkyHanniMod.feature.itemAbilities private val maskTimers = mutableMapOf<String, CooldownTimer>() @@ -84,12 +85,12 @@ class HighlightBonzoMasks { companion object { data class CooldownTimer(val timeMark: TimeMark, val duration: Duration) { + val percentComplete: Double get() = timeMark.elapsedNow().toDouble(DurationUnit.SECONDS) / duration.toDouble(DurationUnit.SECONDS) val isActive: Boolean get() = timeMark.elapsedNow() < duration - } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index aa3a81311..37c25362e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -46,6 +46,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ItemDisplayOverlayFeatures { + // TODO USE SH-REPO private val config get() = SkyHanniMod.feature.inventory diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt index bbd302009..cf3940727 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -28,7 +28,6 @@ class ItemStars { val stack = event.itemStack ?: return if (stack.stackSize != 1) return - val itemName = stack.name ?: return val stars = getStars(itemName) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt index e9545355e..d0e1a80a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt @@ -6,11 +6,11 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil @@ -79,5 +79,4 @@ class PowerStoneGuideFeatures { } fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.inventory.powerStoneGuide - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt index a72d5624f..8b89f44a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt @@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class QuickCraftFeatures {
+
private val config get() = SkyHanniMod.feature.inventory
private val quickCraftSlots = listOf(16, 25, 34)
private var quickCraftableItems = emptyList<String>()
@@ -78,5 +79,4 @@ class QuickCraftFeatures { fun isEnabled() =
LorenzUtils.inSkyBlock && config.quickCraftingConfirmation && InventoryUtils.openInventoryName() == "Craft Item"
-
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt index 3bde5ca49..7a83e09cd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt @@ -61,6 +61,5 @@ class RngMeterInventory { event.move(3, "inventory.rngMeterFloorName", "inventory.rngMeter.floorName") event.move(3, "inventory.rngMeterNoDrop", "inventory.rngMeter.noDrop") event.move(3, "inventory.rngMeterSelectedDrop", "inventory.rngMeter.selectedDrop") - } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 4aa5c907e..4255c36c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -10,12 +10,12 @@ import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -30,6 +30,7 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object SackDisplay { + private var display = emptyList<List<Any>>() private val config get() = SkyHanniMod.feature.inventory.sackDisplay @@ -106,6 +107,7 @@ object SackDisplay { NumberFormatEntry.UNFORMATTED -> "$colorCode${stored}§7/§b${ total.formatNumber().addSeparators() }" + else -> "$colorCode${stored}§7/§b${total}" } ) @@ -125,7 +127,6 @@ object SackDisplay { ) add("MAGMA_FISH".asInternalName().getItemStack()) add("§7)") - } if (config.showPrice && price != 0L) add(" §7(§6${format(price)}§7)") }) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt index 2c42e00d9..2591d1780 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -16,6 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class StatsTuning { + private val config get() = SkyHanniMod.feature.inventory.statsTuning private val patternStatPoints = "§7Stat has: §e(?<amount>\\d+) points?".toPattern() @@ -28,7 +29,6 @@ class StatsTuning { if (config.templateStats && inventoryName == "Stats Tuning") if (templateStats(stack, event)) return if (config.selectedStats && inventoryName == "Accessory Bag Thaumaturgy" && selectedStats(stack, event)) return if (config.points && inventoryName == "Stats Tuning") points(stack, event) - } private fun templateStats(stack: ItemStack, event: RenderInventoryItemTipEvent): Boolean { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt index 505898460..784673ce0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt @@ -11,6 +11,7 @@ enum class Relay( val island: IslandType, chatMessage: String, ) { + RELAY_1( "1st Relay", LorenzVec(143.5, 108.0, 93.0), IslandType.HUB, "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe first relay is on a branch of the large tree on the north-east of the fairy pond." diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt index e0193eaaa..c03363a23 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt @@ -6,13 +6,15 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TiaRelayHelper { + private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay private var inInventory = false @@ -71,8 +73,8 @@ class TiaRelayHelper { val name = sounds.values.first().name for (sound in sounds.toMutableMap()) { if (sound.value.name != name) { - LorenzUtils.error("Tia Relay Helper error: Too much background noise! Try turning off the music and then try again.") - LorenzUtils.clickableChat("Click here to run /togglemusic", "togglemusic") + ChatUtils.error("Tia Relay Helper error: Too much background noise! Try turning off the music and then try again.") + ChatUtils.clickableChat("Click here to run /togglemusic", "togglemusic") sounds.clear() return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt index a3a5014c3..4e7730b03 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TiaRelayWaypoints { + private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay private var waypoint: LorenzVec? = null private var waypointName: String? = null 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 5f096eccc..6386ef478 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChickenHeadTimer { + private var hasChickenHead = false private var lastTime = 0L private val config get() = SkyHanniMod.feature.itemAbilities.chickenHead diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt index b16354567..aa3c40740 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -8,10 +8,10 @@ import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.nether.ashfang.AshfangFreezeCooldown +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class FireVeilWandParticles { + private val config get() = SkyHanniMod.feature.itemAbilities.fireVeilWands private val item by lazy { "FIRE_VEIL_WAND".asInternalName() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index 893a1974c..5f8f770fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -18,7 +18,7 @@ enum class ItemAbility( val actionBarDetection: Boolean = true, private val ignoreMageCooldownReduction: Boolean = false, ) { - //TODO add into repo + // TODO add into repo HYPERION(5, "SCYLLA", "VALKYRIE", "ASTRAEA", ignoreMageCooldownReduction = true), GYROKINETIC_WAND_LEFT(30, "GYROKINETIC_WAND", alternativePosition = true), @@ -115,6 +115,7 @@ enum class ItemAbility( } companion object { + fun getByInternalName(internalName: NEUInternalName): ItemAbility? { return entries.firstOrNull { it.newVariant && internalName in it.internalNames } } @@ -141,5 +142,4 @@ enum class ItemAbility( return abilityCooldownMultiplier } } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index db8fb5f31..e0af344c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.events.RenderObject import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbility.Companion.getMultiplier import at.hannibal2.skyhanni.features.nether.ashfang.AshfangFreezeCooldown +import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName @@ -19,7 +20,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between -import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls @@ -32,6 +32,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.max class ItemAbilityCooldown { + private val config get() = SkyHanniMod.feature.itemAbilities private var lastAbility = "" @@ -63,11 +64,11 @@ class ItemAbilityCooldown { } // Gyrokinetic Wand & Shadow Fury event.soundName == "mob.endermen.portal" -> { - //Gryokinetic Wand + // Gryokinetic Wand if (event.pitch == 0.61904764f && event.volume == 1f) { ItemAbility.GYROKINETIC_WAND_LEFT.sound() } - //Shadow Fury + // Shadow Fury if (event.pitch == 1f && event.volume == 1f) { val internalName = InventoryUtils.getItemInHand()?.getInternalName() ?: return if (!internalName.equalsOneOf( diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt index 18bffb4a4..9a6993853 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt @@ -9,9 +9,11 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.ParkourHelper @@ -23,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DeepCavernsParkour { + private val config get() = SkyHanniMod.feature.mining.deepCavernsParkour private var parkourHelper: ParkourHelper? = null @@ -66,7 +69,7 @@ class DeepCavernsParkour { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { + ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() } } @@ -91,7 +94,7 @@ class DeepCavernsParkour { if (it.displayName != "§aObsidian Sanctuary") { if (!show) { start() - LorenzUtils.chat("Automatically enabling Deep Caverns Parkour, helping you find the way to the bottom of Deep Caverns and the path to Ryst.") + ChatUtils.chat("Automatically enabling Deep Caverns Parkour, helping you find the way to the bottom of Deep Caverns and the path to Ryst.") } } } @@ -101,7 +104,7 @@ class DeepCavernsParkour { show = true parkourHelper?.reset() if (parkourHelper == null) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "DeepCavernsParkour missing in SkyHanni Repo! Try /shupdaterepo to fix it!", "shupdaterepo", prefixColor = "§c" @@ -126,7 +129,7 @@ class DeepCavernsParkour { fun onStackClick(event: SlotClickEvent) { if (showStartIcon && event.slotId == 40) { event.isCanceled = true - LorenzUtils.chat("Manually enabled Deep Caverns Parkour.") + ChatUtils.chat("Manually enabled Deep Caverns Parkour.") start() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt index 94726c640..3317cbff3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt @@ -21,6 +21,7 @@ import net.minecraft.entity.monster.EntitySlime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightMiningCommissionMobs { + private val config get() = SkyHanniMod.feature.mining private var active = listOf<MobType>() 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 36eaa7a24..08f4c59e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt @@ -6,12 +6,13 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -22,10 +23,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.Collections class KingTalismanHelper { + private val config get() = SkyHanniMod.feature.mining.kingTalisman private val storage get() = ProfileStorageData.profileSpecific?.mining companion object { + private var currentOffset: Int? = null private var skyblockYear = 0 @@ -38,7 +41,7 @@ class KingTalismanHelper { fun kingFix() { currentOffset = null - LorenzUtils.chat("Reset internal offset of King Talisman Helper.") + ChatUtils.chat("Reset internal offset of King Talisman Helper.") } } @@ -109,7 +112,7 @@ class KingTalismanHelper { val currentKing = getCurrentKing() val kingsTalkedTo = storage.kingsTalkedTo if (currentKing !in kingsTalkedTo) { - LorenzUtils.debug("Found new king!") + ChatUtils.debug("Found new king!") kingsTalkedTo.add(currentKing) update(kingsTalkedTo) display = allKingsDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt index 4647866e8..80b979087 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CrystalHollowsNamesInCore { + private val config get() = SkyHanniMod.feature.mining private val coreLocations = mapOf( LorenzVec(550, 116, 550) to "§8Precursor Remnants", diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index 1fef5b2ee..86c51f365 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -136,10 +136,10 @@ class MiningEventTracker { } } - private fun isEnabled() = (IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland()) && config.sendData + private fun isEnabled() = (IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland()) + && config.sendData // && config.enabled - private fun sendData(json: String) { val response = APIUtil.postJSON("https://api.soopy.dev/skyblock/chevents/set", json) if (!response.success) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index 3c3b0dfd3..83e428b16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -11,9 +11,9 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.ConfigUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -88,6 +88,7 @@ object PowderTracker { { formatDisplay(drawDisplay(it)) } class Data : TrackerData() { + override fun reset() { rewards.clear() totalChestPicked = 0 @@ -299,7 +300,7 @@ object PowderTracker { private fun MutableList<List<Any>>.addPerHour( map: MutableMap<PowderChestReward, Long>, reward: PowderChestReward, - info: ResourceInfo + info: ResourceInfo, ) { val mithrilCount = map.getOrDefault(reward, 0).addSeparators() val mithrilPerHour = format(info.perHour) @@ -364,7 +365,7 @@ object PowderTracker { var lastEstimated: Long, var stoppedChecks: Int, var perHour: Double, - val perMin: MutableList<Long> + val perMin: MutableList<Long>, ) private fun isEnabled() = IslandType.CRYSTAL_HOLLOWS.isInIsland() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt index 091197b53..310b67ebb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class MinionCollectLogic { + private var oldMap = mapOf<NEUInternalName, Int>() @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 3495a35f1..5b1a9e64b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -20,6 +20,8 @@ import at.hannibal2.skyhanni.events.MinionOpenEvent import at.hannibal2.skyhanni.events.MinionStorageOpenEvent import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -27,7 +29,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.canBeSeen import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.formatInteger import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec @@ -65,7 +66,10 @@ class MinionFeatures { private var lastInventoryClosed = 0L private var coinsPerDay = "" - private val minionUpgradePattern by RepoPattern.pattern("minion.chat.upgrade", "§aYou have upgraded your Minion to Tier (?<tier>.*)") + private val minionUpgradePattern by RepoPattern.pattern( + "minion.chat.upgrade", + "§aYou have upgraded your Minion to Tier (?<tier>.*)" + ) private val minionCoinPattern by RepoPattern.pattern("minion.chat.coin", "§aYou received §r§6(.*) coins§r§a!") private val minionTitlePattern by RepoPattern.pattern("minion.title", "Minion [^➜]") private val minionCollectItemPattern by RepoPattern.pattern("minion.item.collect", "^§aCollect All$") @@ -370,7 +374,7 @@ class MinionFeatures { fun clearMinionData() { minions = mutableMapOf() - LorenzUtils.chat("Manually reset all private island minion location data!") + ChatUtils.chat("Manually reset all private island minion location data!") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index 5c755b66b..ddebeb7c4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -40,6 +40,7 @@ class MinionXp { data class XpInfo(val type: XpType, val amount: Double) private data class MinionStorage(val position: LorenzVec, val xpList: EnumMap<XpType, Double>) { + val timestamp: SimpleTimeMark = SimpleTimeMark.now() } @@ -52,6 +53,7 @@ class MinionXp { // TODO use upper case names, created a function to get type by lowercase name // TODO maybe: rename to SkillType, move somewhere else enum class XpType { + Farming, Mining, Combat, @@ -99,7 +101,6 @@ class MinionXp { } else { true } - } private fun handleItems(inventoryItems: Map<Int, ItemStack>, isMinion: Boolean): EnumMap<XpType, Double> { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt index 1fffb43eb..eb482e0c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt @@ -16,6 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard class BetterSignEditing { + private var pasteLastClicked = false private var copyLastClicked = false private var deleteWordLastClicked = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt index 0547a4537..536c6d520 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -10,6 +10,7 @@ import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ButtonOnPause { + private val config get() = SkyHanniMod.feature.gui private val buttonId = System.nanoTime().toInt() @@ -50,4 +51,4 @@ class ButtonOnPause { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.configButtonOnPause", "gui.configButtonOnPause") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt index e05571b6a..6e8f746f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.CollectionAPI import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -39,32 +40,32 @@ class CollectionTracker { fun command(args: Array<String>) { if (args.isEmpty()) { if (internalName == null) { - LorenzUtils.userError("/shtrackcollection <item name>") + ChatUtils.userError("/shtrackcollection <item name>") return } - LorenzUtils.chat("Stopped collection tracker.") + ChatUtils.chat("Stopped collection tracker.") resetData() return } val rawName = fixTypo(args.joinToString(" ").lowercase().replace("_", " ")) if (rawName == "gemstone") { - LorenzUtils.userError("Gemstone collection is not supported!") + ChatUtils.userError("Gemstone collection is not supported!") return } else if (rawName == "mushroom") { - LorenzUtils.userError("Mushroom collection is not supported!") + ChatUtils.userError("Mushroom collection is not supported!") return } val foundInternalName = NEUItems.getInternalNameOrNullIgnoreCase(rawName) if (foundInternalName == null) { - LorenzUtils.error("Item '$rawName' does not exist!") + ChatUtils.error("Item '$rawName' does not exist!") return } val stack = foundInternalName.getItemStackOrNull() if (stack == null) { - LorenzUtils.error("Item '$rawName' does not exist!") + ChatUtils.error("Item '$rawName' does not exist!") return } setNewCollection(foundInternalName, stack.name!!.removeColor()) @@ -97,7 +98,7 @@ class CollectionTracker { private fun setNewCollection(internalName: NEUInternalName, name: String) { val foundAmount = CollectionAPI.getCollectionCounter(internalName) if (foundAmount == null) { - LorenzUtils.userError("$name collection not found. Try to open the collection inventory!") + ChatUtils.userError("$name collection not found. Try to open the collection inventory!") return } this.internalName = internalName @@ -106,7 +107,7 @@ class CollectionTracker { lastAmountInInventory = countCurrentlyInInventory() updateDisplay() - LorenzUtils.chat("Started tracking $itemName §ecollection.") + ChatUtils.chat("Started tracking $itemName §ecollection.") } private fun resetData() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index ebff243f9..866242368 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matches import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CurrentPetDisplay { + private val config get() = SkyHanniMod.feature.misc.pets // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index 40b6abed1..ffe6a79ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -4,12 +4,13 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CustomTextBox { + private val config get() = SkyHanniMod.feature.gui.customTextBox private var display = listOf<String>() @@ -36,4 +37,4 @@ class CustomTextBox { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.textBox", "gui.customTextBox") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FandomWikiFromMenus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FandomWikiFromMenus.kt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FandomWikiFromMenus.kt diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt index b5ce08ba7..da2d89243 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ItemAddEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import io.github.moulberry.notenoughupdates.NotEnoughUpdates @@ -9,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.hours class FixNEUHeavyPearls { + private val config get() = SkyHanniMod.feature.misc private val heavyPearl = "HEAVY_PEARL".asInternalName() @@ -19,12 +21,11 @@ class FixNEUHeavyPearls { if (event.internalName == heavyPearl && event.amount == 3) { val specific = NotEnoughUpdates.INSTANCE.config.getProfileSpecific() if (System.currentTimeMillis() > specific.dailyHeavyPearlCompleted + 1.hours.inWholeMilliseconds) { - LorenzUtils.chat("Mark NEU Heavy Pearls as done.") + ChatUtils.chat("Mark NEU Heavy Pearls as done.") specific.dailyHeavyPearlCompleted = System.currentTimeMillis() } } } fun isEnabled() = LorenzUtils.inSkyBlock && config.fixNeuHeavyPearls - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt index c4a5be8ed..d8409416b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt @@ -17,6 +17,7 @@ import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HideArmor { + private val config get() = SkyHanniMod.feature.misc.hideArmor2 private var armor = mapOf<Int, ItemStack>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt index 0d87bb767..ff4f4facf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.data.jsonobjects.repo.TabListJson import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent @@ -10,11 +11,11 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils.formatted -import at.hannibal2.skyhanni.data.jsonobjects.repo.TabListJson import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class InGameDateDisplay { + private val config get() = SkyHanniMod.feature.gui.inGameDate private val monthAndDatePattern = ".*((Early|Late) )?(Winter|Spring|Summer|Autumn) [0-9]{1,2}(nd|rd|th|st)?.*".toPattern() @@ -41,7 +42,7 @@ class InGameDateDisplay { val date = SkyBlockTime.now() var theBaseString: String if (config.useScoreboard) { - val list = ScoreboardData.sidebarLinesFormatted //we need this to grab the moon/sun symbol + val list = ScoreboardData.sidebarLinesFormatted // we need this to grab the moon/sun symbol val year = "Year ${date.year}" var monthAndDate = (list.find { monthAndDatePattern.matches(it) } ?: "??").trim() if (monthAndDate.last().isDigit()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt index 4064ed341..4ee986dbf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec @@ -24,13 +25,13 @@ class JoinCrystalHollows { if (message == "§cYou do not have an active Crystal Hollows pass!") { lastWrongPassTime = System.currentTimeMillis() if (LorenzUtils.skyBlockIsland != IslandType.DWARVEN_MINES) { - LorenzUtils.clickableChat("Click here to warp to Dwarven Mines!", "warp mines") + ChatUtils.clickableChat("Click here to warp to Dwarven Mines!", "warp mines") } else { - LorenzUtils.chat("Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn") + ChatUtils.chat("Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn") } } if (message == "§e[NPC] §5Gwendolyn§f: §rGreat! Now hop on into the Minecart and I'll get you on your way!" && inTime()) { - LorenzUtils.clickableChat("Click here to warp to Crystal Hollows!", "warp ch") + ChatUtils.clickableChat("Click here to warp to Crystal Hollows!", "warp ch") } } @@ -39,7 +40,7 @@ class JoinCrystalHollows { if (!isEnabled()) return if (event.newIsland == IslandType.DWARVEN_MINES && inTime()) { - LorenzUtils.chat("Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn§e!") + ChatUtils.chat("Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn§e!") } if (event.newIsland == IslandType.CRYSTAL_HOLLOWS) { lastWrongPassTime = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt index 000587afd..fb0eb95db 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.EntityEquipmentChangeEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.utils.CollectionUtils import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo import at.hannibal2.skyhanni.utils.LorenzUtils @@ -12,8 +13,9 @@ import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class LesserOrbHider { + private val config get() = SkyHanniMod.feature.misc - private val hiddenEntities = LorenzUtils.weakReferenceList<EntityArmorStand>() + private val hiddenEntities = CollectionUtils.weakReferenceList<EntityArmorStand>() private val lesserTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjgzMjM2NjM5NjA3MDM2YzFiYTM5MWMyYjQ2YTljN2IwZWZkNzYwYzhiZmEyOTk2YTYwNTU1ODJiNGRhNSJ9fX0=" diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt index 4e733fa24..fbddd5fb0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LimboTimeTracker.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -16,6 +17,7 @@ import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit class LimboTimeTracker { + private val config get() = SkyHanniMod.feature.misc private var limboJoinTime = SimpleTimeMark.farPast() @@ -36,8 +38,8 @@ class LimboTimeTracker { if (inLimbo && !shownPB && limboJoinTime.passedSince() >= config.limboTimePB.seconds && config.limboTimePB != 0) { shownPB = true oldPB = config.limboTimePB.seconds - LorenzUtils.chat("§d§lPERSONAL BEST§f! You've surpassed your previous record of §e$oldPB§f!") - LorenzUtils.chat("§fKeep it up!") + ChatUtils.chat("§d§lPERSONAL BEST§f! You've surpassed your previous record of §e$oldPB§f!") + ChatUtils.chat("§fKeep it up!") } } @@ -71,11 +73,11 @@ class LimboTimeTracker { if (passedSince > currentPB) { oldPB = currentPB config.limboTimePB = passedSince.toInt(DurationUnit.SECONDS) - LorenzUtils.chat("§fYou were AFK in Limbo for §e$duration§f! §d§lPERSONAL BEST§r§f!") - LorenzUtils.chat("§fYour previous Personal Best was §e$oldPB.") + ChatUtils.chat("§fYou were AFK in Limbo for §e$duration§f! §d§lPERSONAL BEST§r§f!") + ChatUtils.chat("§fYour previous Personal Best was §e$oldPB.") val userLuck = config.limboTimePB * userLuckMultiplier - LorenzUtils.chat("§fYour §aPersonal Bests§f perk is now granting you §a+${userLuck.round(2)}✴ SkyHanni User Luck§f!") - } else LorenzUtils.chat("§fYou were AFK in Limbo for §e$duration§f.") + ChatUtils.chat("§fYour §aPersonal Bests§f perk is now granting you §a+${userLuck.round(2)}✴ SkyHanni User Luck§f!") + } else ChatUtils.chat("§fYou were AFK in Limbo for §e$duration§f.") shownPB = false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt index be4bb05f3..d0c30af92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -3,12 +3,13 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object LockMouseLook { + private val config get() = SkyHanniMod.feature.misc private var lockedMouse = false private const val lockedPosition = -1F / 3F @@ -19,7 +20,7 @@ object LockMouseLook { val gameSettings = Minecraft.getMinecraft().gameSettings if (gameSettings.mouseSensitivity == lockedPosition) { gameSettings.mouseSensitivity = SkyHanniMod.feature.storage.savedMouselockedSensitivity - LorenzUtils.chat("§bMouse rotation is now unlocked because you left it locked.") + ChatUtils.chat("§bMouse rotation is now unlocked because you left it locked.") } } @@ -31,12 +32,12 @@ object LockMouseLook { SkyHanniMod.feature.storage.savedMouselockedSensitivity = gameSettings.mouseSensitivity gameSettings.mouseSensitivity = lockedPosition if (config.lockMouseLookChatMessage) { - LorenzUtils.chat("§bMouse rotation is now locked. Type /shmouselock to unlock your rotation") + ChatUtils.chat("§bMouse rotation is now locked. Type /shmouselock to unlock your rotation") } } else { gameSettings.mouseSensitivity = SkyHanniMod.feature.storage.savedMouselockedSensitivity if (config.lockMouseLookChatMessage) { - LorenzUtils.chat("§bMouse rotation is now unlocked.") + ChatUtils.chat("§bMouse rotation is now unlocked.") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index 0ce1a8fd8..ee8f2c37c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.Minecraft @@ -18,12 +19,13 @@ class MarkedPlayerManager { private val config get() = SkyHanniMod.feature.markedPlayers companion object { + val playerNamesToMark = mutableListOf<String>() private val markedPlayers = mutableMapOf<String, EntityOtherPlayerMP>() fun command(args: Array<String>) { if (args.size != 1) { - LorenzUtils.userError("Usage: /shmarkplayer <name>") + ChatUtils.userError("Usage: /shmarkplayer <name>") return } @@ -32,18 +34,18 @@ class MarkedPlayerManager { if (name == LorenzUtils.getPlayerName().lowercase()) { - LorenzUtils.userError("You can't add or remove yourself this way! Go to the settings and toggle 'Mark your own name'.") + ChatUtils.userError("You can't add or remove yourself this way! Go to the settings and toggle 'Mark your own name'.") return } if (name !in playerNamesToMark) { playerNamesToMark.add(name) findPlayers() - LorenzUtils.chat("§aMarked §eplayer §b$displayName§e!") + ChatUtils.chat("§aMarked §eplayer §b$displayName§e!") } else { playerNamesToMark.remove(name) markedPlayers.remove(name) - LorenzUtils.chat("§cUnmarked §eplayer §b$displayName§e!") + ChatUtils.chat("§cUnmarked §eplayer §b$displayName§e!") } } @@ -59,10 +61,8 @@ class MarkedPlayerManager { } fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark - } - @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { config.markOwnName.whenChanged { _, new -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt index cf50b53f4..dbf76a3dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt @@ -11,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer class MovementSpeedDisplay { + private val config get() = SkyHanniMod.feature.misc private var display = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index befa84037..5ee6103a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -12,10 +12,11 @@ import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.TimeUnit @@ -31,6 +32,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class NonGodPotEffectDisplay { + private val config get() = SkyHanniMod.feature.misc.potionEffect private var checkFooter = false private val effectDuration = mutableMapOf<NonGodPotEffect, Timer>() @@ -40,8 +42,9 @@ class NonGodPotEffectDisplay { enum class NonGodPotEffect( val tabListName: String, val isMixin: Boolean = false, - val inventoryItemName: String = tabListName + val inventoryItemName: String = tabListName, ) { + SMOLDERING("§aSmoldering Polarization I"), GLOWY("§2Mushed Glowy Tonic I"), WISP("§bWisp's Ice-Flavored Water I"), @@ -131,7 +134,7 @@ class NonGodPotEffectDisplay { private fun update() { if (effectDuration.values.removeIf { it.ended }) { - //to fetch the real amount of active pots + // to fetch the real amount of active pots totalEffectsCount = 0 checkFooter = true } @@ -230,7 +233,7 @@ class NonGodPotEffectDisplay { effectDuration[effect] = Timer(duration.milliseconds) update() } catch (e: IndexOutOfBoundsException) { - LorenzUtils.debug("Error while reading non god pot effects from tab list! line: '$line'") + ChatUtils.debug("Error while reading non god pot effects from tab list! line: '$line'") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index aebfbdac3..43bd181dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -49,7 +49,5 @@ class ParticleHider { event.move(3, "misc.hideCloseRedstoneparticles", "misc.particleHiders.hideCloseRedstoneParticles") event.move(3, "misc.hideFireBlockParticles", "misc.particleHiders.hideFireBlockParticles") event.move(3, "misc.hideSmokeParticles", "misc.particleHiders.hideSmokeParticles") - } - -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt index c2ac7490b..6de5b8cf7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt @@ -10,6 +10,7 @@ import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PartyMemberOutlines {
+
private val config get() = SkyHanniMod.feature.misc.highlightPartyMembers
@SubscribeEvent
@@ -26,4 +27,4 @@ class PartyMemberOutlines { return SpecialColour.specialToChromaRGB(config.outlineColor)
}
-}
\ No newline at end of file +}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt index cfb679c30..e5611fb90 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -9,10 +9,10 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzRarity import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetExp import at.hannibal2.skyhanni.utils.StringUtils import io.github.moulberry.notenoughupdates.NotEnoughUpdates @@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PetExpTooltip { + private val config get() = SkyHanniMod.feature.misc.pets.petExperienceToolTip private val level100Common = 5_624_785 private val level100Legendary = 25_353_230 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt index 231eeb3c3..79cc77234 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // code inspired by SBA but heavily modified to be more functional and actually work class PlayerChatSymbols { + private val config get() = SkyHanniMod.feature.chat.chatSymbols private val nameSymbols = mutableMapOf<String, String>() private val symbolsPattern = "^(?<symbols>(?:(?:§\\w)+\\S)+) ".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index fceb8563e..f1fb205e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -2,13 +2,14 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems -import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager @@ -17,6 +18,7 @@ import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object QuickModMenuSwitch { + private val config get() = SkyHanniMod.feature.misc.quickModMenuSwitch private var display = emptyList<List<Any>>() private var latestGuiPath = "" @@ -64,7 +66,7 @@ object QuickModMenuSwitch { latestGuiPath = openGui if (SkyHanniMod.feature.dev.debug.modMenuLog) { - LorenzUtils.debug("Open GUI: $latestGuiPath") + ChatUtils.debug("Open GUI: $latestGuiPath") } } val mods = mods ?: return @@ -152,7 +154,7 @@ object QuickModMenuSwitch { } catch (_: Exception) { } } - LorenzUtils.error("Error trying to open the gui for mod " + mod.name + "!") + ChatUtils.error("Error trying to open the gui for mod " + mod.name + "!") } "hytil" -> { @@ -168,7 +170,7 @@ object QuickModMenuSwitch { } catch (_: Exception) { } } - LorenzUtils.chat("Error trying to open the gui for mod " + mod.name + "!") + ChatUtils.chat("Error trying to open the gui for mod " + mod.name + "!") } else -> { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt index 950ed60f3..fb228418e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt @@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class ServerRestartTitle { + private val config get() = SkyHanniMod.feature.misc // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt index 72c1009e9..9eca3a159 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt @@ -14,6 +14,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class SkyBlockKickDuration { + private val config get() = SkyHanniMod.feature.misc.kickDuration private var kickMessage = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt index e2519fd72..231bbaf3d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt @@ -3,13 +3,14 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SuperpairsClicksAlert { + private val config get() = SkyHanniMod.feature.misc private var roundsNeeded = -1 @@ -54,7 +55,7 @@ class SuperpairsClicksAlert { .any { it.value.stackSize > roundsNeeded }) ) { SoundUtils.playBeepSound() - LorenzUtils.chat("You have reached the maximum possible clicks!") + ChatUtils.chat("You have reached the maximum possible clicks!") roundsNeeded = -1 } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index 797ae5c93..9c71d3153 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -18,6 +18,7 @@ import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds class TimeFeatures { + private val config get() = SkyHanniMod.feature.gui private val winterConfig get() = SkyHanniMod.feature.event.winter diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 8cf4f8044..7e70c1c06 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -13,9 +13,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer class TpsCounter { + private val config get() = SkyHanniMod.feature.gui companion object { + private const val minDataAmount = 5 private const val waitAfterWorldSwitch = 6 } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt index b5684265f..b28f74e52 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils @@ -24,6 +25,7 @@ import kotlin.random.Random import kotlin.time.Duration.Companion.minutes object AdvancedPlayerList { + private val config get() = SkyHanniMod.feature.misc.compactTabList.advancedPlayerList // TODO USE SH-REPO @@ -97,10 +99,9 @@ object AdvancedPlayerList { } else { playerData.nameSuffix = "" } - } catch (e: NumberFormatException) { val message = "Special user (youtube or admin?): '$line'" - LorenzUtils.debug(message) + ChatUtils.debug(message) println(message) } } @@ -231,6 +232,7 @@ object AdvancedPlayerList { } class PlayerData(val sbLevel: Int) { + var name: String = "?" var coloredName: String = "?" var nameSuffix: String = "?" diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabColumn.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabColumn.kt index d1e930a09..17a35ae7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabColumn.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabColumn.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.misc.compacttablist - class TabColumn(val columnTitle: String) { + val lines = mutableListOf<String>() val sections = mutableListOf<TabSection>() @@ -14,4 +14,4 @@ class TabColumn(val columnTitle: String) { } fun size() = lines.size + 1 -}
\ No newline at end of file +} 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 a81205ce7..cb0d3c6c8 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 @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // heavily inspired by SBA code object TabListReader { + private val config get() = SkyHanniMod.feature.misc.compactTabList // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt index b42378e08..76200f835 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt @@ -3,8 +3,8 @@ package at.hannibal2.skyhanni.features.misc.compacttablist import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.SkipTabListLineEvent import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay +import at.hannibal2.skyhanni.utils.CollectionUtils.filterToMutable import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.filterToMutable import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft @@ -16,6 +16,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object TabListRenderer { + private val config get() = SkyHanniMod.feature.misc.compactTabList const val maxLines = 22 @@ -182,5 +183,4 @@ object TabListRenderer { event.cancel() } } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabSection.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabSection.kt index 9754235fb..c0f36dfc9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabSection.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabSection.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.compacttablist class TabSection(val columnValue: TabColumn) { + val lines = mutableListOf<String>() fun addLine(line: String) { @@ -8,4 +9,4 @@ class TabSection(val columnValue: TabColumn) { } fun size() = lines.size -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabStringType.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabStringType.kt index 74eea4ff3..159214b0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabStringType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabStringType.kt @@ -9,6 +9,7 @@ enum class TabStringType { PLAYER; companion object { + // TODO USE SH-REPO private val usernamePattern = "^\\[(?<sblevel>\\d+)] (?:\\[\\w+] )?(?<username>\\w+)".toPattern() @@ -29,4 +30,4 @@ enum class TabStringType { return if (usernameMatcher.find()) usernameMatcher.group("username") else input } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index deba594e7..5110c3752 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -13,9 +13,10 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.SimpleTimeMark import com.google.gson.JsonObject import com.jagrosh.discordipc.IPCClient @@ -31,6 +32,7 @@ import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.TimeUnit object DiscordRPCManager : IPCListener { + private const val applicationID = 1093298182735282176L private const val updatePeriod = 4200L @@ -63,13 +65,18 @@ object DiscordRPCManager : IPCListener { try { client?.connect() - if (fromCommand) LorenzUtils.chat("Successfully started Rich Presence!", prefixColor = "§a") // confirm that /shrpcstart worked + if (fromCommand) ChatUtils.chat( + "Successfully started Rich Presence!", + prefixColor = "§a" + ) // confirm that /shrpcstart worked } catch (ex: Exception) { consoleLog("Warn: Failed to connect to RPC!") consoleLog(ex.toString()) - LorenzUtils.clickableChat("Discord Rich Presence was unable to start! " + + ChatUtils.clickableChat( + "Discord Rich Presence was unable to start! " + "This usually happens when you join SkyBlock when Discord is not started. " + - "Please run /shrpcstart to retry once you have launched Discord.", "shrpcstart") + "Please run /shrpcstart to retry once you have launched Discord.", "shrpcstart" + ) } } catch (ex: Throwable) { consoleLog("Warn: Discord RPC has thrown an unexpected error while trying to start...") @@ -92,9 +99,11 @@ object DiscordRPCManager : IPCListener { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - onToggle(config.firstLine, + ConditionalUtils.onToggle( + config.firstLine, config.secondLine, - config.customText) { + config.customText + ) { if (isActive()) { updatePresence() } @@ -107,6 +116,7 @@ object DiscordRPCManager : IPCListener { } } } + fun updatePresence() { val location = DiscordStatus.LOCATION.getDisplayString() val discordIconKey = DiscordLocationKey.getDiscordIconKey(location) @@ -188,16 +198,16 @@ object DiscordRPCManager : IPCListener { fun startCommand() { if (!config.enabled.get()) { - LorenzUtils.userError("Discord Rich Presence is disabled. Enable it in the config §e/sh discord") + ChatUtils.userError("Discord Rich Presence is disabled. Enable it in the config §e/sh discord") return } if (isActive()) { - LorenzUtils.userError("Discord Rich Presence is already active!") + ChatUtils.userError("Discord Rich Presence is already active!") return } - LorenzUtils.chat("Attempting to start Discord Rich Presence...") + ChatUtils.chat("Attempting to start Discord Rich Presence...") try { start(true) } catch (e: Exception) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index 4c972750d..af307e32f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -385,7 +385,6 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?) } return "" } - } enum class AutoStatus(val placeholderText: String, val correspondingDiscordStatus: DiscordStatus) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt index 23e5d4754..6ebcf08c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.InventoryUpdatedEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName @@ -11,6 +12,7 @@ import at.hannibal2.skyhanni.utils.OSUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AuctionHouseCopyUnderbidPrice { + private val config get() = SkyHanniMod.feature.inventory @SubscribeEvent @@ -30,7 +32,7 @@ class AuctionHouseCopyUnderbidPrice { } val newPrice = price * item.stackSize - 1 OSUtils.copyToClipboard("$newPrice") - LorenzUtils.chat("Set §e${newPrice.addSeparators()} §eto clipboard. (Copy Underbid Price)") + ChatUtils.chat("Set §e${newPrice.addSeparators()} §eto clipboard. (Copy Underbid Price)") } fun isEnabled() = LorenzUtils.inSkyBlock && config.copyUnderbidPrice diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index 527dfe4fe..aef1f392b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -8,6 +8,9 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RenderItemTooltipEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -15,8 +18,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.isRune import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NEUItems.manager @@ -34,6 +35,7 @@ import java.io.File import kotlin.math.roundToLong object EstimatedItemValue { + private val config get() = SkyHanniMod.feature.misc.estimatedItemValues private var display = emptyList<List<Any>>() private val cache = mutableMapOf<ItemStack, List<List<Any>>>() @@ -55,7 +57,7 @@ object EstimatedItemValue { object : TypeToken<HashMap<NEUInternalName, HashMap<String, List<String>>>>() {}.type ) else - LorenzUtils.error("Gemstone Slot Unlock Costs failed to load!") + ChatUtils.error("Gemstone Slot Unlock Costs failed to load!") } @SubscribeEvent @@ -151,7 +153,7 @@ object EstimatedItemValue { val newDisplay = try { draw(item) } catch (e: Exception) { - LorenzUtils.debug("Estimated Item Value error: ${e.message}") + ChatUtils.debug("Estimated Item Value error: ${e.message}") e.printStackTrace() listOf() } @@ -189,7 +191,7 @@ object EstimatedItemValue { if (internalName.getItemStackOrNull() == null) { - LorenzUtils.debug("Estimated Item Value is null for: '$internalName'") + ChatUtils.debug("Estimated Item Value is null for: '$internalName'") return listOf() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index df915988d..d0c0d74f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.isRune import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzRarity -import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems @@ -55,6 +55,7 @@ import net.minecraft.item.ItemStack import java.util.Locale object EstimatedItemValueCalculator { + private val config get() = SkyHanniMod.feature.misc.estimatedItemValues private val additionalCostFunctions = listOf( ::addAttributeCost, @@ -190,7 +191,7 @@ object EstimatedItemValueCalculator { private fun getReforgeStoneApplyCost( stack: ItemStack, reforgeCosts: JsonObject, - reforgeStone: NEUInternalName + reforgeStone: NEUInternalName, ): Int? { var itemRarity = stack.getItemRarityOrNull() ?: return null @@ -448,7 +449,7 @@ object EstimatedItemValueCalculator { internalName: NEUInternalName, list: MutableList<String>, label: String, - shouldIgnorePrice: Boolean + shouldIgnorePrice: Boolean, ): Double { val price = internalName.getPrice() val name = internalName.getNameOrRepoError() @@ -573,7 +574,6 @@ object EstimatedItemValueCalculator { 5 -> multiplier = 16 } level = 1 - } if (internalName.startsWith("ENCHANTED_BOOK_BUNDLE_")) { multiplier = 5 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt index 3969372ff..3076ba439 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt @@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class EstimatedWardrobePrice { + private val config get() = SkyHanniMod.feature.misc.estimatedItemValues var data = mutableMapOf<Int, MutableList<ItemStack>>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt index 1f153ed69..0d504e459 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt @@ -3,13 +3,14 @@ package at.hannibal2.skyhanni.features.misc.massconfiguration import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import io.github.moulberry.moulconfig.processor.ConfigProcessorDriver import net.minecraft.client.Minecraft import net.minecraft.command.CommandBase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object DefaultConfigFeatures { + private var didNotifyOnce = false @SubscribeEvent @@ -32,7 +33,7 @@ object DefaultConfigFeatures { SkyHanniMod.configManager.saveConfig(ConfigFileType.KNOWN_FEATURES, "Updated known feature flags") if (!SkyHanniMod.feature.storage.hasPlayedBefore) { SkyHanniMod.feature.storage.hasPlayedBefore = true - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Looks like this is the first time you are using SkyHanni. " + "Click here to configure default options, or run /shdefaultoptions.", "shdefaultoptions" @@ -40,9 +41,9 @@ object DefaultConfigFeatures { } else if (updated) { val lastVersion = knownToggles.keys.last { it != SkyHanniMod.version } val command = "/shdefaultoptions $lastVersion ${SkyHanniMod.version}" - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Looks like you updated SkyHanni. " + - "Click here to configure the newly introduced options, or run $command.", + "Click here to configure the newly introduced options, or run $command.", command ) } @@ -55,24 +56,24 @@ object DefaultConfigFeatures { val knownToggles = SkyHanniMod.knownFeaturesData.knownFeatures val togglesInNewVersion = knownToggles[new] if (new != "null" && togglesInNewVersion == null) { - LorenzUtils.chat("Unknown version $new") + ChatUtils.chat("Unknown version $new") return } val togglesInOldVersion = knownToggles[old] if (old != "null" && togglesInOldVersion == null) { - LorenzUtils.chat("Unknown version $old") + ChatUtils.chat("Unknown version $old") return } optionList = optionList .mapValues { it -> it.value.filter { (togglesInNewVersion == null || it.path in togglesInNewVersion) && - (togglesInOldVersion == null || it.path !in togglesInOldVersion) + (togglesInOldVersion == null || it.path !in togglesInOldVersion) } } .filter { (_, filteredOptions) -> filteredOptions.isNotEmpty() } if (optionList.isEmpty()) { - LorenzUtils.chat("There are no new options to configure between $old and $new") + ChatUtils.chat("There are no new options to configure between $old and $new") return } SkyHanniMod.screenToOpen = DefaultConfigOptionGui(optionList, old, new) @@ -80,7 +81,7 @@ object DefaultConfigFeatures { fun applyCategorySelections( resetSuggestionState: MutableMap<Category, ResetSuggestionState>, - orderedOptions: Map<Category, List<FeatureToggleableOption>> + orderedOptions: Map<Category, List<FeatureToggleableOption>>, ) { orderedOptions.forEach { (cat, options) -> for (option in options) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt index ac1a497fe..d878d9665 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt @@ -14,9 +14,10 @@ import kotlin.math.min class DefaultConfigOptionGui( private val orderedOptions: Map<Category, List<FeatureToggleableOption>>, old: String, - new: String + new: String, ) : GuiScreen() { + val title = if (old == "null") { if (new == "null") "§5SkyHanni Default Options" @@ -181,7 +182,6 @@ class DefaultConfigOptionGui( if (hoveringTextToDraw != null) { Utils.drawHoveringText(hoveringTextToDraw, mouseX, mouseY, width, height, 100, mc.fontRendererObj) } - } private fun scroll(s: Int) { @@ -194,4 +194,4 @@ class DefaultConfigOptionGui( if (Mouse.getEventDWheel() != 0) scroll(currentScrollOffset - Mouse.getEventDWheel()) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleableOption.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleableOption.kt index 88b9f1a8e..b9d4b96f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleableOption.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleableOption.kt @@ -5,5 +5,5 @@ data class FeatureToggleableOption( val isTrueEnabled: Boolean, val category: Category, val setter: (Boolean) -> Unit, val path: String, - var toggleOverride: ResetSuggestionState? = null -)
\ No newline at end of file + var toggleOverride: ResetSuggestionState? = null, +) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt index 73c2e3398..777244d6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt @@ -11,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TeleportPadCompactName { + // TODO USE SH-REPO private val patternName = "§.✦ §aWarp To (?<name>.*)".toPattern() private val patternNoName = "§.✦ §cNo Destination".toPattern() @@ -32,4 +33,4 @@ class TeleportPadCompactName { entity.customNameTag = group("name") } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt index 7916fe6cb..4530f0406 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TeleportPadInventoryNumber { + private val numbers: Map<String, Int> by lazy { val baseNumber = mapOf( "one" to 1, 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 6ac802ab6..022d7eeb3 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 @@ -43,6 +43,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds object TrevorFeatures { + // TODO USE SH-REPO private val trapperPattern = "\\[NPC] Trevor: You can find your (?<rarity>.*) animal near the (?<location>.*).".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index bdbe5b6df..d73b79db4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -15,6 +15,7 @@ import net.minecraft.entity.EntityLivingBase import kotlin.time.Duration.Companion.seconds object TrevorSolver { + private val animalHealths = intArrayOf(100, 200, 500, 1000, 2000, 5000, 10000, 30000) var currentMob: TrevorMobs? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt index 175d21903..37cec25fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt @@ -6,14 +6,15 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Matcher object TrevorTracker { + private val config get() = SkyHanniMod.feature.misc.trevorTheTrapper // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index b4e517734..3b75291a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -11,6 +11,7 @@ import net.minecraft.util.EnumChatFormatting.RED import org.lwjgl.input.Mouse class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(option) { + val button = GuiElementButton("", -1) { } override fun render(x: Int, y: Int, width: Int) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt index 407a49a2a..553e2d3ed 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.features.About import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzLogger -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import io.github.moulberry.moulconfig.processor.MoulConfigProcessor import io.github.moulberry.notenoughupdates.util.MinecraftExecutor import moe.nea.libautoupdate.CurrentVersion @@ -95,9 +95,9 @@ object UpdateManager { potentialUpdate = it if (it.isUpdateAvailable) { updateState = UpdateState.AVAILABLE - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "§aSkyHanni found a new update: ${it.update.versionName}. " + - "Check §b/sh download update §afor more info.", + "Check §b/sh download update §afor more info.", "sh" ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt index 5f0ee6494..d250311db 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.TimeLimitedCache import kotlin.time.Duration.Companion.minutes object ModifyVisualWords { + private val config get() = SkyHanniMod.feature.gui.modifyWords var textCache = TimeLimitedCache<String, String>(5.minutes) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWord.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWord.kt index 6efc389d4..783a059cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWord.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWord.kt @@ -6,10 +6,11 @@ data class VisualWord( @Expose var phrase: String, @Expose var replacement: String, @Expose var enabled: Boolean, - @Expose private var caseSensitive: Boolean? + @Expose private var caseSensitive: Boolean?, ) { + fun isCaseSensitive() = caseSensitive ?: false fun setCaseSensitive(value: Boolean) { caseSensitive = value } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index b88171e96..77b035d0a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.* -import at.hannibal2.skyhanni.utils.LorenzUtils.chat +import at.hannibal2.skyhanni.utils.ChatUtils.chat import at.hannibal2.skyhanni.utils.StringUtils.convertToFormatted import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import com.google.gson.JsonObject @@ -22,6 +22,7 @@ import java.io.FileReader import java.io.IOException open class VisualWordGui : GuiScreen() { + private var guiLeft = 0 private var guiTop = 0 private var screenHeight = 0 @@ -54,6 +55,7 @@ open class VisualWordGui : GuiScreen() { private val shouldDrawImport get() = drawImport && !SkyHanniMod.feature.storage.visualWordsImported companion object { + fun isInGui() = Minecraft.getMinecraft().currentScreen is VisualWordGui var sbeConfigPath = File("." + File.separator + "config" + File.separator + "SkyblockExtras.cfg") var drawImport = false @@ -75,7 +77,6 @@ open class VisualWordGui : GuiScreen() { "RmNTlkYjg5MGM4MDA0MTU2YjcyN2M3N2NhNjk1YzQzOTlkOGUwZGE1Y2U5MjI3Y2Y4MzZiYjhlMiJ9fX0=" ) } - } override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt index a2e4d30ac..0e07441da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt @@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.features.nether import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatchers @@ -15,6 +15,7 @@ import kotlin.time.Duration.Companion.minutes // https://wiki.hypixel.net/Pablo class PabloHelper { + private val config get() = SkyHanniMod.feature.crimsonIsle private val patterns = listOf( @@ -33,7 +34,7 @@ class PabloHelper { if (InventoryUtils.countItemsInLowerInventory { it.name?.contains(itemName) == true } > 0) return - LorenzUtils.clickableChat("Click here to grab an $itemName from sacks!", "gfs $itemName 1") + ChatUtils.clickableChat("Click here to grab an $itemName from sacks!", "gfs $itemName 1") lastSentMessage = SimpleTimeMark.now() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt index e489e357f..6ffabfa0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt @@ -83,10 +83,12 @@ class SulphurSkitterBox { val color = Color(SpecialColour.specialToChromaRGB(config.boxColor), true) when (config.boxType) { SulphurSkitterBoxConfig.BoxType.FULL -> { - RenderUtils.drawFilledBoundingBox_nea(axis, + RenderUtils.drawFilledBoundingBox_nea( + axis, color, partialTicks = partialTicks, - renderRelativeToCamera = false) + renderRelativeToCamera = false + ) } SulphurSkitterBoxConfig.BoxType.WIREFRAME -> { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt index c58d7a5c3..107d244ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class VolcanoExplosivityDisplay { + private val config get() = SkyHanniMod.feature.crimsonIsle private val patternGroup = RepoPattern.group("crimson.volcano") private val headerPattern by patternGroup.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt index b5aff0bf4..ad9f6e10e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -10,11 +10,11 @@ import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.combat.damageindicator.BossType import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsWith import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityBlaze @@ -23,6 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangBlazes { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang private val blazeColor = mutableMapOf<EntityBlaze, LorenzColor>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt index 03175e255..e4ace1bed 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt @@ -20,6 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color class AshfangBlazingSouls { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang.blazingSouls private val texture = @@ -47,7 +48,7 @@ class AshfangBlazingSouls { val orbLocation = orb.getLorenzVec() event.drawWaypointFilled(orbLocation.add(-0.5, 1.25, -0.5), color, extraSize = -0.15) if (orbLocation.distance(playerLocation) < 10) { - //TODO find way to dynamically change color + // TODO find way to dynamically change color event.drawString(orbLocation.add(y = 2.5), "§bBlazing Soul") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt index 56ce5b44c..b82cf1cc3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object AshfangFreezeCooldown { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt index bf9899e0c..adadbee9c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt @@ -20,6 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color class AshfangGravityOrbs { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang.gravityOrbs private val texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV" + @@ -48,7 +49,7 @@ class AshfangGravityOrbs { RenderUtils.drawCylinderInWorld(color, center.x, center.y, center.z, 3.5f, 4.5f, event.partialTicks) if (orbLocation.distance(playerLocation) < 15) { - //TODO find way to dynamically change color + // TODO find way to dynamically change color event.drawString(orbLocation.add(y = 2.5), "§cGravity Orb") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt index 35daf9d78..fc9ae54c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangHideParticles { + private var nearAshfang = false @SubscribeEvent @@ -56,4 +57,4 @@ class AshfangHideParticles { private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.crimsonIsle.ashfang.hide.particles && nearAshfang -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt index 68c3d9382..edd523ec2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt @@ -16,6 +16,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangNextResetCooldown { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang private var spawnTime = 1L diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index f7dce6b2e..5ea51336b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -14,10 +14,10 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyK import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.DailyQuestHelper import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.QuestLoader import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMiniBossHelper +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -26,6 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { + val config get() = SkyHanniMod.feature.crimsonIsle.reputationHelper val questHelper = DailyQuestHelper(this) @@ -97,7 +98,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { private fun updateRender() { val newList = mutableListOf<List<Any>>() - //TODO test + // TODO test if (factionType == FactionType.NONE) return newList.addAsSingletonList("Reputation Helper:") @@ -149,7 +150,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { } fun reset() { - LorenzUtils.chat("Reset Reputation Helper.") + ChatUtils.chat("Reset Reputation Helper.") questHelper.reset() miniBossHelper.reset() diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt index 028e56c91..8e820680e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt @@ -8,15 +8,17 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) { + val kuudraTiers = mutableListOf<KuudraTier>() private var kuudraLocation: LorenzVec? = null @@ -55,7 +57,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH } private fun finished(kuudraTier: KuudraTier) { - LorenzUtils.debug("Detected kuudra tier done: $kuudraTier") + ChatUtils.debug("Detected kuudra tier done: $kuudraTier") reputationHelper.questHelper.finishKuudra(kuudraTier) kuudraTier.doneToday = true updateAllKuudraDone() diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt index 6a509a391..85889f94b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt @@ -8,7 +8,8 @@ class KuudraTier( val displayItem: NEUInternalName, val location: LorenzVec?, val tierNumber: Int, - var doneToday: Boolean = false + var doneToday: Boolean = false, ) { + fun getDisplayName() = "Tier $tierNumber ($name)" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 5b0dbc670..9a700bc2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -26,12 +26,13 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.T import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.UnknownQuest import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.CrimsonMiniBoss import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems.getItemStack @@ -150,7 +151,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { count = needAmount } if (quest.haveAmount == count) return - LorenzUtils.chat("${quest.displayName} progress: $count/$needAmount") + ChatUtils.chat("${quest.displayName} progress: $count/$needAmount") quest.haveAmount = count quest.state = if (count == needAmount) QuestState.READY_TO_COLLECT else QuestState.ACCEPTED @@ -232,7 +233,6 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } " §7($color${amountInSacks.addSeparators()} §7in sacks)" } - } else { "" } @@ -271,7 +271,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { fun finishKuudra(kuudraTier: KuudraTier) { val kuudraQuest = getQuest<KuudraQuest>() ?: return - //TODO make inline method for this two lines + // TODO make inline method for this two lines if (kuudraQuest.kuudraTier == kuudraTier && kuudraQuest.state == QuestState.ACCEPTED) { kuudraQuest.state = QuestState.READY_TO_COLLECT } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index 52ef15b5c..4dd526dbe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.R import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.TrophyFishQuest import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.UnknownQuest import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.TabListData @@ -21,6 +22,7 @@ import at.hannibal2.skyhanni.utils.TabListData class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { companion object { + val quests = mutableMapOf<String, Pair<String, ReputationQuest>>() fun loadQuests(data: Map<String, ReputationQuest>, questType: String) { for ((questName, questInfo) in data) { @@ -79,7 +81,7 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { if (green && oldQuest.state != QuestState.READY_TO_COLLECT && oldQuest.state != QuestState.COLLECTED) { oldQuest.state = QuestState.READY_TO_COLLECT dailyQuestHelper.update() - LorenzUtils.debug("Reputation Helper: Tab-List updated ${oldQuest.internalName} (This should not happen)") + ChatUtils.debug("Reputation Helper: Tab-List updated ${oldQuest.internalName} (This should not happen)") } return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt index 770f636a8..fb4ee7d52 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt @@ -9,7 +9,7 @@ class DojoQuest( location: LorenzVec?, displayItem: NEUInternalName, dojoRankGoal: String, - state: QuestState + state: QuestState, ) : Quest( displayItem, diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt index 4e5991c59..086187a84 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt @@ -3,5 +3,11 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName -class FetchQuest(val itemName: String, location: LorenzVec?, displayItem: NEUInternalName, state: QuestState, needAmount: Int) : +class FetchQuest( + val itemName: String, + location: LorenzVec?, + displayItem: NEUInternalName, + state: QuestState, + needAmount: Int, +) : ProgressQuest(displayItem, location, QuestCategory.FETCH, itemName, state, needAmount) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt index 4f69ac986..a42fcf46a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt @@ -10,5 +10,5 @@ abstract class ProgressQuest( displayName: String, state: QuestState, val needAmount: Int, - var haveAmount: Int = 0 + var haveAmount: Int = 0, ) : Quest(displayItem, location, questCategory, displayName, state) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt index 4c4e7218f..c56234158 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt @@ -9,5 +9,5 @@ abstract class Quest( val category: QuestCategory, val internalName: String, var state: QuestState, - val displayName: String = internalName + val displayName: String = internalName, ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt index 65b90d307..1ab686a05 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt @@ -8,6 +8,6 @@ class TrophyFishQuest( location: LorenzVec?, displayItem: NEUInternalName, state: QuestState, - needAmount: Int + needAmount: Int, ) : ProgressQuest(displayItem, location, QuestCategory.FISHING, fishName, state, needAmount) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt index f5292c9fb..6e65dd3f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt @@ -9,5 +9,5 @@ class CrimsonMiniBoss( val displayItem: NEUInternalName, val location: LorenzVec?, val pattern: Pattern, - var doneToday: Boolean = false + var doneToday: Boolean = false, ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index 86a0cf061..60a7294be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -10,10 +10,10 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputat import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.MiniBossQuest import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.QuestState import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt index ab3fa40c1..844ac0227 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import net.minecraft.item.ItemStack object RiftAPI { + fun inRift() = IslandType.THE_RIFT.isInIsland() val config: RiftConfig get() = SkyHanniMod.feature.rift diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt index c1790a6cc..70b595d1a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftAgaricusCap { + private val config get() = RiftAPI.config.area.dreadfarm private var startTime = 0L private var location: LorenzVec? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index 0ff9e0c0f..319b04142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -5,11 +5,11 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -22,12 +22,14 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color class RiftWiltedBerberisHelper { + private val config get() = RiftAPI.config.area.dreadfarm.wiltedBerberis private var isOnFarmland = false private var hasFarmingToolInHand = false private var list = listOf<WiltedBerberis>() class WiltedBerberis(var currentParticles: LorenzVec) { + var previous: LorenzVec? = null var moving = true var y = 0.0 @@ -137,5 +139,4 @@ class RiftWiltedBerberisHelper { } private fun isEnabled() = RiftAPI.inRift() && RiftAPI.inDreadfarm() && config.enabled - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt index 41d42f77b..fe6768230 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.events.EntityEquipmentChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation @@ -108,7 +108,6 @@ class VoltHighlighter { else -> VoltState.NO_VOLT } - } private fun getVoltState(entity: Entity): VoltState { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 071ec6e94..c71875238 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -9,11 +9,11 @@ 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.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.isAtFullHealth import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -23,13 +23,13 @@ import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class LivingCaveDefenseBlocks { + private val config get() = RiftAPI.config.area.livingCave.defenseBlockConfig private var movingBlocks = mapOf<DefenseBlock, Long>() private var staticBlocks = emptyList<DefenseBlock>() class DefenseBlock(val entity: EntityOtherPlayerMP, val location: LorenzVec, var hidden: Boolean = false) - @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt index cc237c6c5..2ac0aee42 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class LivingCaveLivingMetalHelper { + private val config get() = RiftAPI.config.area.livingCave.livingCaveLivingMetalConfig private var lastClicked: LorenzVec? = null private var pair: Pair<LorenzVec, LorenzVec>? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt index 1deb2b64c..aa8bc1889 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt @@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.features.rift.area.livingcave import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getLivingMetalProgress diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt index dc3c26189..f15badfe6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt @@ -7,12 +7,14 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.ParkourHelper import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftLavaMazeParkour { + private val config get() = RiftAPI.config.area.mirrorverse.lavaMazeConfig private var parkourHelper: ParkourHelper? = null @@ -51,7 +53,7 @@ class RiftLavaMazeParkour { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { + ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt index 728396883..2c60dbce7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt @@ -7,12 +7,14 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.ParkourHelper import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftUpsideDownParkour { + private val config get() = RiftAPI.config.area.mirrorverse.upsideDownParkour private var parkourHelper: ParkourHelper? = null @@ -51,7 +53,7 @@ class RiftUpsideDownParkour { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { + ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt index 281643bfc..697de2aa2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt @@ -1,19 +1,21 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse +import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.ParkourHelper -import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TubulatorParkour { + private val config get() = RiftAPI.config.area.mirrorverse.tubulatorConfig private var parkourHelper: ParkourHelper? = null private val puzzleRoom = AxisAlignedBB(-298.0, 0.0, -112.0, -309.0, 63.0, -101.0) @@ -44,7 +46,7 @@ class TubulatorParkour { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { + ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { updateConfig() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt index 9fc00b99a..a85c92237 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.rift.area.stillgorechateau import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.jsonobjects.repo.RiftEffigiesJson import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -8,22 +9,22 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.getLorenzVec -import at.hannibal2.skyhanni.data.jsonobjects.repo.RiftEffigiesJson import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftBloodEffigies { + private val config get() = RiftAPI.config.area.stillgoreChateau.bloodEffigies private var locations: List<LorenzVec> = emptyList() private var effigiesTimes = mapOf( @@ -75,12 +76,12 @@ class RiftBloodEffigies { if (diff < 0L) { if (s == "7") { if (time != 0L) { - LorenzUtils.chat("Effigy #${index + 1} respawned!") + ChatUtils.chat("Effigy #${index + 1} respawned!") effigiesTimes = effigiesTimes.editCopy { this[index] = 0L } } } else { if (time != -1L) { - LorenzUtils.chat("Effigy #${index + 1} is broken!") + ChatUtils.chat("Effigy #${index + 1} is broken!") val endTime = System.currentTimeMillis() + 1_000 * 60 * 20 effigiesTimes = effigiesTimes.editCopy { this[index] = endTime } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt index 2b371d259..89a500c2c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt @@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -41,6 +41,7 @@ object VerminTracker { { drawDisplay(it) } class Data : TrackerData() { + override fun reset() { count.clear() } @@ -65,7 +66,7 @@ object VerminTracker { private fun checkVacuum() { hasVacuum = InventoryUtils.getItemsInOwnInventory() - .any { it.getInternalName() == TURBOMAX_VACUUM} + .any { it.getInternalName() == TURBOMAX_VACUUM } } @SubscribeEvent @@ -145,7 +146,8 @@ object VerminTracker { fun onRenderOverlay(event: GuiRenderEvent) { if (!isEnabled()) return if (!config.showOutsideWestVillage && - !LorenzUtils.skyBlockArea.let { it == "Infested House" || it == "West Village" }) return + !LorenzUtils.skyBlockArea.let { it == "Infested House" || it == "West Village" } + ) return if (!config.showWithoutVacuum && !hasVacuum) return tracker.renderDisplay(config.position) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt index eb24782c6..35ab292e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt @@ -24,6 +24,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class KloonHacking { + private val config get() = RiftAPI.config.area.westVillage.hacking // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt index 5629972ea..faadd9e42 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt @@ -4,15 +4,16 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftLarva { + private val config get() = RiftAPI.config.area.wyldWoods.larvas private var hasHookInHand = false private val larvaSkullTexture = diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt index 7d1e9b9ba..28e897d42 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt @@ -4,16 +4,17 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftOdonata { + private val config get() = RiftAPI.config.area.wyldWoods.odonata private var hasBottleInHand = false private val odonataSkullTexture = 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 2b21d9dad..d64ce53d3 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 @@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds class ShyCruxWarnings { + private val config get() = RiftAPI.config.area.wyldWoods private val shyNames = arrayOf("I'm ugly! :(", "Eek!", "Don't look at me!", "Look away!") diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt index 2f5844442..37aae74b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt @@ -4,11 +4,12 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -16,6 +17,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object CruxTalismanDisplay { + private val config get() = RiftAPI.config.cruxTalisman // TODO USE SH-REPO @@ -81,7 +83,6 @@ object CruxTalismanDisplay { } } - @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return @@ -120,7 +121,7 @@ object CruxTalismanDisplay { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.showBonuses) { update() } + ConditionalUtils.onToggle(config.showBonuses) { update() } } data class Crux(val name: String, val tier: String, val progress: String, val maxed: Boolean) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt index f8ceaa833..17dfacbd8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt @@ -9,10 +9,10 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object EnigmaSoulWaypoints { + private val config get() = RiftAPI.config.enigmaSoulWaypoints private var inInventory = false private var soulLocations = mapOf<String, LorenzVec>() @@ -98,11 +99,11 @@ object EnigmaSoulWaypoints { event.usePickblockInstead() if (soulLocations.contains(split.last())) { if (!trackedSouls.contains(split.last())) { - LorenzUtils.chat("§5Tracking the ${split.last()} Enigma Soul!", prefixColor = "§5") + ChatUtils.chat("§5Tracking the ${split.last()} Enigma Soul!", prefixColor = "§5") trackedSouls.add(split.last()) } else { trackedSouls.remove(split.last()) - LorenzUtils.chat("§5No longer tracking the ${split.last()} Enigma Soul!", prefixColor = "§5") + ChatUtils.chat("§5No longer tracking the ${split.last()} Enigma Soul!", prefixColor = "§5") } } } @@ -176,7 +177,7 @@ object EnigmaSoulWaypoints { } if (closestSoul in trackedSouls) { trackedSouls.remove(closestSoul) - LorenzUtils.chat("§5Found the $closestSoul Enigma Soul!", prefixColor = "§5") + ChatUtils.chat("§5Found the $closestSoul Enigma Soul!", prefixColor = "§5") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt index 84cd9b8db..c4b585197 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightRiftGuide { + private var inInventory = false private var highlightedItems = emptyList<Int>() @@ -57,4 +58,4 @@ class HighlightRiftGuide { } fun isEnabled() = RiftAPI.inRift() && RiftAPI.config.highlightGuide -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt index 6c62b0097..870ba3f9f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzActionBarEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftTimer { + private val config get() = RiftAPI.config.timer // TODO USE SH-REPO @@ -88,7 +90,7 @@ class RiftTimer { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle( + ConditionalUtils.onToggle( config.percentage, config.maxTime, ) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt index 870b1f121..e0f5f6ee9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt @@ -6,9 +6,9 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -17,6 +17,7 @@ import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftMotesOrb { + private val config get() = RiftAPI.config.motesOrbs // TODO USE SH-REPO 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 38077a538..89297ad05 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 @@ -11,13 +11,13 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice +import at.hannibal2.skyhanni.utils.ChatUtils.chat +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector -import at.hannibal2.skyhanni.utils.LorenzUtils.chat import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NumberUtil @@ -30,6 +30,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ShowMotesNpcSellPrice { + private val config get() = RiftAPI.config.motes // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt index fedc9593a..0864bf658 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt @@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class SlayerItemsOnGround { + private val config get() = SkyHanniMod.feature.slayer.itemsOnGround private var itemsOnGround = TimeLimitedCache<EntityItem, Pair<LorenzVec, String>>(2.seconds) diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt index 529b8b4d2..bdfc7bb00 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt @@ -7,11 +7,11 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.getLorenzVec @@ -24,6 +24,7 @@ import net.minecraft.entity.passive.EntityWolf import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SlayerMiniBossFeatures { + private val config get() = SkyHanniMod.feature.slayer private var miniBosses = listOf<EntityCreature>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index d0c374a8b..1ed123b51 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -12,8 +12,9 @@ import at.hannibal2.skyhanni.events.PurseChangeEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -27,6 +28,7 @@ import com.google.gson.annotations.Expose import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object SlayerProfitTracker { + private val config get() = SkyHanniMod.feature.slayer.itemProfitTracker private var itemLogCategory = "" @@ -34,6 +36,7 @@ object SlayerProfitTracker { private val trackers = mutableMapOf<String, SkyHanniItemTracker<Data>>() class Data : ItemTrackerData() { + override fun resetItems() { slayerSpawnCost = 0 slayerCompletedCount = 0 @@ -131,7 +134,7 @@ object SlayerProfitTracker { val amount = event.amount if (!isAllowedItem(internalName)) { - LorenzUtils.debug("Ignored non-slayer item pickup: '$internalName' '$itemLogCategory'") + ChatUtils.debug("Ignored non-slayer item pickup: '$internalName' '$itemLogCategory'") return } @@ -212,14 +215,13 @@ object SlayerProfitTracker { old } - } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled fun clearProfitCommand(args: Array<String>) { if (itemLogCategory == "") { - LorenzUtils.userError( + ChatUtils.userError( "No current slayer data found! " + "§eGo to a slayer area and start the specific slayer type you want to reset the data of.", ) 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 03beaa6fe..f28733f59 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -7,6 +7,7 @@ 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.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -17,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class SlayerQuestWarning { + private val config get() = SkyHanniMod.feature.slayer private val talkToMaddoxPattern = " {3}§r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!".toPattern() private var needSlayerQuest = false @@ -25,7 +27,7 @@ class SlayerQuestWarning { private var dirtySidebar = false private var hasAutoSlayer = false - //TODO add check if player has clicked on an item, before mobs around you gets damage + // TODO add check if player has clicked on an item, before mobs around you gets damage @SubscribeEvent fun onChat(event: LorenzChatEvent) { @@ -33,7 +35,7 @@ class SlayerQuestWarning { val message = event.message - //died + // died if (message == " §r§c§lSLAYER QUEST FAILED!") { needNewQuest("The old slayer quest has failed!") } @@ -43,7 +45,7 @@ class SlayerQuestWarning { dirtySidebar = true } - //no auto slayer + // no auto slayer talkToMaddoxPattern.matchMatcher(message) { needNewQuest("You have no Auto-Slayer active!") } @@ -55,7 +57,7 @@ class SlayerQuestWarning { needSlayerQuest = false } - //TODO auto slayer disabled bc of no more money in bank or purse + // TODO auto slayer disabled bc of no more money in bank or purse } private fun needNewQuest(reason: String) { @@ -132,7 +134,7 @@ class SlayerQuestWarning { if (lastWarning + 10_000 > System.currentTimeMillis()) return lastWarning = System.currentTimeMillis() - LorenzUtils.chat(chatMessage) + ChatUtils.chat(chatMessage) if (config.questWarningTitle) { LorenzUtils.sendTitle("§e$titleMessage", 2.seconds) @@ -168,5 +170,4 @@ class SlayerQuestWarning { return slayerType.clazz.isInstance(entity) } - } 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 239935368..d471ea441 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.SlayerChangeEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment @@ -25,6 +26,7 @@ import kotlin.math.ceil import kotlin.time.Duration.Companion.seconds class SlayerRngMeterDisplay { + private val config get() = SkyHanniMod.feature.slayer.rngMeterDisplay private var display = "" private val inventoryNamePattern = "(?<name>.*) RNG Meter".toPattern() @@ -70,7 +72,7 @@ class SlayerRngMeterDisplay { val item = storage.itemGoal val hasItemSelected = item != "" && item != "?" if (!hasItemSelected && config.warnEmpty) { - LorenzUtils.userError("No Slayer RNG Meter Item selected!") + ChatUtils.userError("No Slayer RNG Meter Item selected!") LorenzUtils.sendTitle("§cNo RNG Meter Item!", 3.seconds) } var blockChat = config.hideChat && hasItemSelected @@ -86,7 +88,7 @@ class SlayerRngMeterDisplay { var rawPercentage = old.toDouble() / storage.goalNeeded if (rawPercentage > 1) rawPercentage = 1.0 val percentage = LorenzUtils.formatPercentage(rawPercentage) - LorenzUtils.chat("§dRNG Meter §7dropped at §e$percentage §7XP ($from/${to}§7)") + ChatUtils.chat("§dRNG Meter §7dropped at §e$percentage §7XP ($from/${to}§7)") lastItemDroppedTime = System.currentTimeMillis() } if (blockChat) { 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 baf43b001..38022adf7 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,8 @@ 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.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen @@ -22,8 +24,6 @@ import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzColor 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.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText 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 ef4173429..821ff6a71 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 @@ -12,6 +12,7 @@ import net.minecraft.entity.projectile.EntityFireball import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BlazeSlayerClearView { + private var nearBlaze = false @SubscribeEvent @@ -60,4 +61,4 @@ class BlazeSlayerClearView { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.blazeClearView", "slayer.blazes.clearView") } -}
\ No newline at end of file +} 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 535bc3130..5d33ca6c6 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 @@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BlazeSlayerDaggerHelper { + private val config get() = SkyHanniMod.feature.slayer.blazes.hellion private val attunementPattern = "§cStrike using the §r(.+) §r§cattunement on your dagger!".toPattern() @@ -201,7 +202,6 @@ class BlazeSlayerDaggerHelper { val dagger = getDaggerFromStack(itemInHand) dagger?.shields?.forEach { shield -> shield.active = !shield.active } clientSideClicked = true - } enum class Dagger(val daggerNames: List<String>, vararg val shields: HellionShield, var updated: Boolean = false) { @@ -256,7 +256,6 @@ class BlazeSlayerDaggerHelper { ConfigUtils.migrateIntToEnum(element, FirstDaggerEntry::class.java) } } - } private fun HellionShield.other(): HellionShield { 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 74c15c271..81d537e35 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 @@ -13,9 +13,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class BlazeSlayerFirePitsWarning { + private val config get() = SkyHanniMod.feature.slayer.blazes companion object { + private var lastFirePitsWarning = 0L fun fireFirePits() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt index 3fee1e92f..db3826d44 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt @@ -9,9 +9,10 @@ enum class HellionShield( val chatColor: String = color.getChatColor(), var active: Boolean = false, ) { + AURIC("§e§lAURIC", "Auric", LorenzColor.YELLOW), ASHEN("§8§lASHEN", "Ashen", LorenzColor.DARK_GRAY), SPIRIT("§f§lSPIRIT", "Spirit", LorenzColor.WHITE), CRYSTAL("§b§lCRYSTAL", "Crystal", LorenzColor.AQUA), ; -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt index 105f7db3e..125893d6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HellionShieldHelper { companion object { + val hellionShieldMobs = mutableMapOf<EntityLiving, HellionShield>() } @@ -45,4 +46,4 @@ fun EntityLiving.setHellionShield(shield: HellionShield?) { } else { HellionShieldHelper.hellionShieldMobs.remove(this) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index cd0de443e..36d785d2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -11,6 +11,8 @@ import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ServerBlockChangeEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture @@ -20,9 +22,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor @@ -39,6 +39,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class EndermanSlayerFeatures { + private val config get() = SkyHanniMod.feature.slayer.endermen private val beaconConfig get() = config.beacon private val endermenWithBeacons = mutableListOf<EntityEnderman>() @@ -220,7 +221,11 @@ class EndermanSlayerFeatures { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(3, "slayer.endermanBeaconConfig.highlightBeacon", "slayer.endermen.endermanBeaconConfig.highlightBeacon") + event.move( + 3, + "slayer.endermanBeaconConfig.highlightBeacon", + "slayer.endermen.endermanBeaconConfig.highlightBeacon" + ) event.move(3, "slayer.endermanBeaconConfig.beaconColor", "slayer.endermen.endermanBeaconConfig.beaconColor") event.move(3, "slayer.endermanBeaconConfig.showWarning", "slayer.endermen.endermanBeaconConfig.showWarning") event.move(3, "slayer.endermanBeaconConfig.showLine", "slayer.endermen.endermanBeaconConfig.showLine") diff --git a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt index edf80be69..4a0eb7049 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightPlaceableNpcs { + private val config get() = SkyHanniMod.feature.stranded private val locationPattern = "§7Location: §f\\[§e\\d+§f, §e\\d+§f, §e\\d+§f]".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index 83c5da19f..06bb39d28 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzColor @@ -26,8 +27,8 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SummoningMobManager { - private val config get() = SkyHanniMod.feature.combat.summonings + private val config get() = SkyHanniMod.feature.combat.summonings private val summoningMobs = mutableMapOf<EntityLiving, SummoningMob>() private val summoningMobNametags = mutableListOf<EntityArmorStand>() @@ -124,7 +125,7 @@ class SummoningMobManager { val name = summoningMob.name if (currentHealth == 0) { summoningMobs.remove(entityLiving) - LorenzUtils.chat("Your Summoning Mob just §cdied!") + ChatUtils.chat("Your Summoning Mob just §cdied!") continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt index 98752b04a..ce4a5e406 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -4,11 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.getLorenzVec @@ -34,7 +34,7 @@ class SummoningSoulsName { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - //TODO use packets instead of this + // TODO use packets instead of this check() } @@ -68,7 +68,7 @@ class SummoningSoulsName { val entityList = EntityUtils.getEntities<EntityArmorStand>() souls.keys.removeIf { it !in entityList } - //TODO fix overhead! + // TODO fix overhead! // mobs.keys.removeIf { it !in world.loadedEntityList } } |