diff options
479 files changed, 2032 insertions, 1460 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 3336fcae3..ff744cecd 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -4,10 +4,10 @@ import at.hannibal2.skyhanni.events.CollectionUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut 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.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CollectionAPI { + // TODO USE SH-REPO private val counterPattern = ".* §e(?<amount>.*)§6/.*".toPattern() private val singleCounterPattern = "§7Total Collected: §e(?<amount>.*)".toPattern() @@ -76,13 +77,14 @@ class CollectionAPI { // TODO add support for replenish (higher collection than actual items in inv) if (internalName.getItemStackOrNull() == null) { - LorenzUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") + ChatUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") return } collectionValue.addOrPut(internalName, event.amount.toLong()) } companion object { + // TODO USE SH-REPO val collectionValue = mutableMapOf<NEUInternalName, Long>() private val collectionTier0Pattern = "§7Progress to .* I: .*".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt index b0adea115..fd1fac07d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt @@ -11,6 +11,7 @@ import java.io.IOException @Suppress("unused") class ConfigGuiForgeInterop : IModGuiFactory { + override fun initialize(minecraft: Minecraft) {} override fun mainConfigGuiClass() = WrappedSkyHanniConfig::class.java @@ -20,6 +21,7 @@ class ConfigGuiForgeInterop : IModGuiFactory { class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigGuiManager.getEditorInstance()) { + @Throws(IOException::class) override fun handleKeyboardInput() { if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt index f6bcd3bbc..fe43a8f82 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt @@ -18,5 +18,4 @@ object ConfigGuiManager { } SkyHanniMod.screenToOpen = GuiScreenElementWrapper(editor) } - } diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index b69c90a59..125d395f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -46,6 +46,7 @@ typealias TrackerDisplayMode = SkyHanniTracker.DefaultDisplayMode class ConfigManager { companion object { + val gson = GsonBuilder().setPrettyPrinting() .excludeFieldsWithoutExposeAnnotation() .serializeSpecialFloatingPointValues() diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index 436132cd3..64a158d10 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -8,6 +8,7 @@ import com.google.gson.JsonObject import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { + val logger = LorenzLogger("ConfigMigration") const val CONFIG_VERSION = 23 fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? { @@ -28,6 +29,7 @@ object ConfigUpdaterMigrator { var movesPerformed: Int, val dynamicPrefix: Map<String, List<String>>, ) : LorenzEvent() { + init { dynamicPrefix.entries.filter { it.value.isEmpty() }.forEach { logger.log("Dynamic prefix ${it.key} does not resolve to anything.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/SackData.java b/src/main/java/at/hannibal2/skyhanni/config/SackData.java index 61febed74..3495f9b8c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/SackData.java +++ b/src/main/java/at/hannibal2/skyhanni/config/SackData.java @@ -23,4 +23,4 @@ public class SackData { @Expose public Map<NEUInternalName, SackItem> sackContents = new HashMap<>(); } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index a9364d695..56a11626a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -135,9 +135,9 @@ public class Storage { @Override public String toString() { return "MinionConfig{" + - "displayName='" + displayName + '\'' + - ", lastClicked=" + lastClicked + - '}'; + "displayName='" + displayName + '\'' + + ", lastClicked=" + lastClicked + + '}'; } } @@ -395,11 +395,11 @@ public class Storage { @Override public String toString() { return "SlayerRngMeterStorage{" + - "currentMeter=" + currentMeter + - ", gainPerBoss=" + gainPerBoss + - ", goalNeeded=" + goalNeeded + - ", itemGoal='" + itemGoal + '\'' + - '}'; + "currentMeter=" + currentMeter + + ", gainPerBoss=" + gainPerBoss + + ", goalNeeded=" + goalNeeded + + ", itemGoal='" + itemGoal + '\'' + + '}'; } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index e2868a931..6e7c80ce1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -65,6 +65,7 @@ import at.hannibal2.skyhanni.test.command.CopyScoreboardCommand import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.test.command.TestChatCommand import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.TabListData @@ -482,7 +483,7 @@ object Commands { @JvmStatic fun openFortuneGuide() { if (!LorenzUtils.inSkyBlock) { - LorenzUtils.userError("Join SkyBlock to open the fortune guide!") + ChatUtils.userError("Join SkyBlock to open the fortune guide!") } else { CaptureFarmingGear.captureFarmingGear() SkyHanniMod.screenToOpen = FFGuideGUI() @@ -492,7 +493,7 @@ object Commands { @JvmStatic fun openVisualWords() { if (!LorenzUtils.onHypixel) { - LorenzUtils.userError("You need to join Hypixel to use this feature!") + ChatUtils.userError("You need to join Hypixel to use this feature!") } else { if (VisualWordGui.sbeConfigPath.exists()) VisualWordGui.drawImport = true SkyHanniMod.screenToOpen = VisualWordGui() @@ -501,7 +502,7 @@ object Commands { private fun clearFarmingItems() { val storage = GardenAPI.storage?.fortune ?: return - LorenzUtils.chat("clearing farming items") + ChatUtils.chat("clearing farming items") storage.farmingItems.clear() storage.outdatedItems.clear() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt index bca46dbd6..b8a5871b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt @@ -6,6 +6,7 @@ import net.minecraft.command.ICommandSender import net.minecraft.util.BlockPos class SimpleCommand : CommandBase { + private val commandName: String private val runnable: ProcessCommandRunnable private var tabRunnable: TabCompleteRunnable? = null @@ -22,10 +23,12 @@ class SimpleCommand : CommandBase { } abstract class ProcessCommandRunnable { + abstract fun processCommand(sender: ICommandSender?, args: Array<String>?) } interface TabCompleteRunnable { + fun tabComplete(sender: ICommandSender?, args: Array<String>?, pos: BlockPos?): List<String> } diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index 88ec9e054..f6765ca2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -35,6 +35,7 @@ import org.lwjgl.input.Mouse import java.io.IOException class GuiPositionEditor(private val positions: List<Position>, private val border: Int) : GuiScreen() { + private var grabbedX = 0 private var grabbedY = 0 private var clickedPos = -1 diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java index 4e9a351a7..e46d8052a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java @@ -7,9 +7,10 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import org.lwjgl.input.Keyboard; + import java.util.ArrayList; import java.util.List; -import org.lwjgl.input.Keyboard; public class ChatConfig { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java index 9577a9146..c37b16172 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java @@ -1,14 +1,11 @@ package at.hannibal2.skyhanni.config.features.crimsonisle; import at.hannibal2.skyhanni.config.FeatureToggle; -import at.hannibal2.skyhanni.config.HasLegacyId; -import at.hannibal2.skyhanni.features.nether.SulphurSkitterBox; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigOption; -import io.github.moulberry.moulconfig.observer.Property; public class SulphurSkitterBoxConfig { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java index 19cd42a16..c9be39d54 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java @@ -12,7 +12,18 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.*; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.ACCEPTED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COINS_SPENT; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COPPER; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DEDICATION_IV; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DENIED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.FARMING_EXP; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.GREEN_BANDANA; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.OVERGROWN_GRASS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TOTAL_VISITORS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.VISITORS_BY_RARITY; public class DropsStatisticsConfig { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java index fc7bac1e1..499514e2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java @@ -239,7 +239,7 @@ public class MiscConfig { @Expose @ConfigOption(name = "Fix Ghost Entities", desc = "Removes ghost entities caused by a Hypixel bug. " + - "This included Diana, Dungeon and Crimson Isle mobs and nametags.") + "This included Diana, Dungeon and Crimson Isle mobs and nametags.") @ConfigEditorBoolean @FeatureToggle public boolean fixGhostEntities = true; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java index dc1919042..2103968e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java @@ -8,6 +8,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index 08bef76ff..d631e8e26 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -9,8 +9,7 @@ import at.hannibal2.skyhanni.features.chat.ChatFilterGui import at.hannibal2.skyhanni.utils.IdentityCharacteristics import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.chat -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import net.minecraft.client.Minecraft import net.minecraft.client.gui.ChatLine import net.minecraft.client.gui.GuiNewChat @@ -54,6 +53,7 @@ object ChatManager { val renderedString = "$format$name" companion object { + val maxLength by lazy { entries.maxOf { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it.renderedString) } } @@ -64,7 +64,7 @@ object ChatManager { val message: IChatComponent, var actionKind: ActionKind, var actionReason: String?, - val modified: IChatComponent? + val modified: IChatComponent?, ) @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) @@ -77,7 +77,6 @@ object ChatManager { val actionBarEvent = LorenzActionBarEvent(message) actionBarEvent.postAndCatch() } - } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt index ad5d01d3c..9ea5742a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream import java.util.Base64 class CropAccessoryData { + // TODO USE SH-REPO private val accessoryBagNamePattern = "Accessory Bag \\((?<current>\\d)/(?<total>\\d)\\)".toPattern() private var loadedAccessoryThisProfile = false @@ -89,12 +90,12 @@ class CropAccessoryData { } } - private fun bestCropAccessory(items: Iterable<ItemStack>) = items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName()) } .maxOrNull() ?: CropAccessory.NONE companion object { + var accessoryBagPageCount = 0 private set diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index dec06dc8e..ae5a03878 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -13,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class EntityMovementData { companion object { + private val entityLocation = mutableMapOf<Entity, LorenzVec>() fun addToTrack(entity: Entity) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt index 70de5e436..f7a730a65 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import kotlin.time.Duration.Companion.seconds object EventCounter { + private val config get() = SkyHanniMod.feature.dev.debug private var map = mutableMapOf<String, Int>() diff --git a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt index 834ccaa55..c9cfcc62f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.UUID object FriendAPI { + // TODO USE SH-REPO private val removedFriendPattern = ".*\n§r§eYou removed §r(?<name>.*)§e from your friends list!§r§9§m\n.*".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index 34baceb0b..dfa275cb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent @@ -8,11 +9,11 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenCropMilestones { + // TODO USE SH-REPO private val cropPattern = "§7Harvest §f(?<name>.*) §7on .*".toPattern() val totalPattern = "§7Total: §a(?<name>.*)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt index 71398af27..950f226f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt @@ -6,11 +6,12 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson 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.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter 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.editCopy -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary @@ -23,6 +24,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenCropMilestonesCommunityFix { + private val pattern = ".*§e(?<having>.*)§6/§e(?<max>.*)".toPattern() private var showWrongData = false private var showWhenAllCorrect = false @@ -55,7 +57,7 @@ object GardenCropMilestonesCommunityFix { } if (data.isNotEmpty()) { - LorenzUtils.chat( + ChatUtils.chat( "Found §c${data.size} §ewrong crop milestone steps in the menu! " + "Correct data got put into clipboard. " + "Please share it on the §bSkyHanni Discord §ein the channel §b#share-data§e." @@ -63,7 +65,7 @@ object GardenCropMilestonesCommunityFix { OSUtils.copyToClipboard("```${data.joinToString("\n")}```") } else { if (showWhenAllCorrect) { - LorenzUtils.chat("No wrong crop milestone steps found!") + ChatUtils.chat("No wrong crop milestone steps found!") } } } @@ -71,7 +73,7 @@ object GardenCropMilestonesCommunityFix { private fun checkForWrongData( stack: ItemStack, crop: CropType, - wrongData: MutableList<String> + wrongData: MutableList<String>, ) { val name = stack.name ?: return val rawNumber = name.removeColor().replace(crop.cropName, "").trim() @@ -151,7 +153,7 @@ object GardenCropMilestonesCommunityFix { } } totalFixedValues += fixed - LorenzUtils.chat("Fixed: $fixed/$alreadyCorrect, total fixes: $totalFixedValues") + ChatUtils.chat("Fixed: $fixed/$alreadyCorrect, total fixes: $totalFixedValues") val s = ConfigManager.gson.toJsonTree(GardenCropMilestones.cropMilestoneData).toString() OSUtils.copyToClipboard("\"crop_milestones\":$s,") } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt index 1ea0871ee..c15299ab3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenCropUpgrades { + // TODO USE SH-REPO private val tierPattern = "§7Current Tier: §[0-9a-e](\\d)§7/§a9".toRegex() private val chatUpgradePattern = " {2}§r§6§lCROP UPGRADE §e§f([\\w ]+)§7 #(\\d)".toRegex() @@ -39,6 +40,7 @@ class GardenCropUpgrades { } companion object { + private val cropUpgrades: MutableMap<CropType, Int>? get() = GardenAPI.storage?.cropUpgrades fun CropType.getUpgradeLevel() = cropUpgrades?.get(this) @@ -46,6 +48,5 @@ class GardenCropUpgrades { fun CropType.setUpgradeLevel(level: Int) { cropUpgrades?.put(this, level) } - } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 0f1da835b..9c50b1c09 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.getPropertiesWithType import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.ReflectionUtils.getPropertiesWithType import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer @@ -78,7 +79,7 @@ class GuiEditManager { SkyHanniMod.screenToOpen = GuiPositionEditor(latestPositions.values.toList(), 2) if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { lastHotkeyReminded = SimpleTimeMark.now() - LorenzUtils.chat( + ChatUtils.chat( "§eTo edit hidden GUI elements:\n" + " §7- §e1. Set a key in /sh edit.\n" + " §7- §e2. Click that key while the GUI element is visible." @@ -116,7 +117,7 @@ class GuiEditManager { fun Position.getAbsY() = getAbsY0(getDummySize(true).y) fun GuiProfileViewer.anyTextBoxFocused() = - this.getPropertiesWithType<GuiElementTextField>().any{it.focus} + this.getPropertiesWithType<GuiElementTextField>().any { it.focus } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt index 5a4fb4f99..f4273e745 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GuildAPI { + private var inGuildMessage = false private val list = mutableListOf<String>() diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 3f6ec7051..57889cc48 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -26,6 +27,7 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.concurrent.thread class HypixelData { + private val patternGroup = RepoPattern.group("data.hypixeldata") private val tabListProfilePattern by patternGroup.pattern( "tablistprofile", @@ -43,6 +45,7 @@ class HypixelData { private var lastLocRaw = 0L companion object { + private val patternGroup = RepoPattern.group("data.hypixeldata") private val serverIdScoreboardPattern by patternGroup.pattern( "serverid.scoreboard", @@ -61,7 +64,7 @@ class HypixelData { var skyBlockIsland = IslandType.UNKNOWN var serverId: String? = null - //Ironman, Stranded and Bingo + // Ironman, Stranded and Bingo var noTrade = false var ironman = false @@ -95,16 +98,20 @@ class HypixelData { if (!LorenzUtils.inSkyBlock) return null if (serverId != null) return serverId - ScoreboardData.sidebarLinesFormatted.forEach { serverIdScoreboardPattern.matchMatcher(it) { - val serverType = if (group("servertype") == "M") "mega" else "mini" - serverId = "$serverType${group("serverid")}" - return serverId - } } + ScoreboardData.sidebarLinesFormatted.forEach { + serverIdScoreboardPattern.matchMatcher(it) { + val serverType = if (group("servertype") == "M") "mega" else "mini" + serverId = "$serverType${group("serverid")}" + return serverId + } + } - TabListData.getTabList().forEach { serverIdTablistPattern.matchMatcher(it) { - serverId = group("serverid") - return serverId - } } + TabListData.getTabList().forEach { + serverIdTablistPattern.matchMatcher(it) { + serverId = group("serverid") + return serverId + } + } return serverId } @@ -262,7 +269,7 @@ class HypixelData { if (skyBlockIsland != islandType) { IslandChangeEvent(islandType, skyBlockIsland).postAndCatch() if (islandType == IslandType.UNKNOWN) { - LorenzUtils.debug("Unknown island detected: '$newIsland'") + ChatUtils.debug("Unknown island detected: '$newIsland'") loggerIslandChange.log("Unknown: '$newIsland'") } else { loggerIslandChange.log(islandType.name) diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt index a3eef5dd9..e6a01136c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt @@ -17,7 +17,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") { CRYSTAL_HOLLOWS("Crystal Hollows"), THE_PARK("The Park", "floating_islands_1"), DEEP_CAVERNS("Deep Caverns", "deep_caverns"), - GOLD_MINES("Gold Mine", "gold_mine"),//TODO confirm + GOLD_MINES("Gold Mine", "gold_mine"),// TODO confirm GARDEN("Garden"), GARDEN_GUEST("Garden Guest"), SPIDER_DEN("Spider's Den"), @@ -29,6 +29,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") { ; companion object { + fun getByNameOrUnknown(name: String) = getByNameOrNull(name) ?: UNKNOWN fun getByName(name: String) = getByNameOrNull(name) ?: error("IslandType not found: '$name'") diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt index f62ebd800..406901b9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt @@ -38,7 +38,6 @@ class ItemRenderBackground { } } - @SubscribeEvent fun renderOverlayLol(event: RenderRealOverlayEvent) { val stack = event.stack @@ -70,4 +69,4 @@ class ItemRenderBackground { GlStateManager.popMatrix() } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt b/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt index f32256031..728678824 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.jsonobjects.repo.LocationFixJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside -import at.hannibal2.skyhanni.data.jsonobjects.repo.LocationFixJson import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object LocationFixData { + private var locationFixes = mutableListOf<LocationFix>() class LocationFix(val island: IslandType, val area: AxisAlignedBB, val realLocation: String) diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt index 646337a27..e8abad8a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.jsonobjects.local.MayorJson import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.CollectionUtils.put import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.put import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.notenoughupdates.util.SkyBlockTime import kotlinx.coroutines.Dispatchers @@ -16,10 +16,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes class MayorElection { + private var lastUpdate = SimpleTimeMark.farPast() private var dispatcher = Dispatchers.IO companion object { + var rawMayorData: MayorJson? = null var candidates = mapOf<Int, MayorJson.Candidate>() var currentCandidate: MayorJson.Candidate? = null diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index fa8494dcb..72395b4fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -13,6 +13,7 @@ import net.minecraft.network.play.server.S2FPacketSetSlot import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object OtherInventoryData { + private var currentInventory: Inventory? = null private var acceptItems = false private var lateEvent: InventoryUpdatedEvent? = null @@ -105,6 +106,6 @@ object OtherInventoryData { val title: String, val slotCount: Int, val items: MutableMap<Int, ItemStack> = mutableMapOf(), - var fullyOpenedOnce: Boolean = false + var fullyOpenedOnce: Boolean = false, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index 97065766e..824b895bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -26,6 +26,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds class OwnInventoryData { + private var itemAmounts = mapOf<NEUInternalName, Int>() private var dirty = false private val sackToInventoryChatPattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt index daac67f16..22fb8e4f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName @@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.random.Random object PartyAPI { + private val patternGroup = RepoPattern.group("data.party") private val youJoinedPartyPattern by patternGroup.pattern( "you.joined", @@ -76,17 +78,17 @@ object PartyAPI { fun listMembers() { val size = partyMembers.size if (size == 0) { - LorenzUtils.chat("No tracked party members!") + ChatUtils.chat("No tracked party members!") return } - LorenzUtils.chat("Tracked party members §7($size) §f:", prefixColor = "§a") + ChatUtils.chat("Tracked party members §7($size) §f:", prefixColor = "§a") for (member in partyMembers) { - LorenzUtils.chat(" §a- §7$member", false) + ChatUtils.chat(" §a- §7$member", false) } if (Random.nextDouble() < 0.1) { OSUtils.openBrowser("https://www.youtube.com/watch?v=iANP7ib7CPA") - LorenzUtils.hoverableChat("§7Are You Ready To Party?", listOf("§b~Spongebob"), prefix = false) + ChatUtils.hoverableChat("§7Are You Ready To Party?", listOf("§b~Spongebob"), prefix = false) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index 8e6f9bb7d..e4b54115c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -11,12 +11,14 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ProfileStorageData { + var playerSpecific: Storage.PlayerSpecific? = null var profileSpecific: Storage.ProfileSpecific? = null var loaded = false @@ -47,11 +49,11 @@ object ProfileStorageData { val playerSpecific = playerSpecific val sackPlayers = sackPlayers if (playerSpecific == null) { - LorenzUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!") + ChatUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!") return } if (sackPlayers == null) { - LorenzUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!") + ChatUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!") return } loadProfileSpecific(playerSpecific, sackPlayers, profileName) @@ -63,11 +65,11 @@ object ProfileStorageData { val playerSpecific = playerSpecific val sackPlayers = sackPlayers if (playerSpecific == null) { - LorenzUtils.error("playerSpecific is null in ProfileJoinEvent!") + ChatUtils.error("playerSpecific is null in ProfileJoinEvent!") return } if (sackPlayers == null) { - LorenzUtils.error("sackPlayers is null in sackPlayers!") + ChatUtils.error("sackPlayers is null in sackPlayers!") return } @@ -104,7 +106,7 @@ object ProfileStorageData { if (System.currentTimeMillis() > noTabListTime + 3_000) { noTabListTime = System.currentTimeMillis() - LorenzUtils.chat( + ChatUtils.chat( "Extra Information from Tab list not found! " + "Enable it: SkyBlock Menu ➜ Settings ➜ Personal ➜ User Interface ➜ Player List Info" ) @@ -114,7 +116,7 @@ object ProfileStorageData { private fun loadProfileSpecific( playerSpecific: Storage.PlayerSpecific, sackProfile: SackData.PlayerSpecific, - profileName: String + profileName: String, ) { noTabListTime = -1 profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index 0deb53164..e5f226945 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PurseAPI { + // TODO USE SH-REPO private val pattern = "(Piggy|Purse): §6(?<coins>[\\d,]*).*".toPattern() private var currentPurse = 0.0 diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index 917ea9f5d..2ca07b16c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -24,9 +24,9 @@ class RenderData { if (!SkyHanniDebugsAndTests.globalRender) return if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return - GlStateManager.translate(0f,0f,-3f) + GlStateManager.translate(0f, 0f, -3f) GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() - GlStateManager.translate(0f,0f,3f) + GlStateManager.translate(0f, 0f, 3f) } @SubscribeEvent @@ -40,9 +40,9 @@ class RenderData { GlStateManager.enableDepth() if (GuiEditManager.isInGui()) { - GlStateManager.translate(0f,0f,-3f) + GlStateManager.translate(0f, 0f, -3f) GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() - GlStateManager.translate(0f,0f,3f) + GlStateManager.translate(0f, 0f, 3f) } GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch() diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index fe6dc189d..ee9ea621c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -11,11 +11,11 @@ import at.hannibal2.skyhanni.events.SackDataUpdateEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity import at.hannibal2.skyhanni.features.inventory.SackDisplay +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName 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.editCopy import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull @@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object SackAPI { + private val sackDisplayConfig get() = SkyHanniMod.feature.inventory.sackDisplay private val chatConfig get() = SkyHanniMod.feature.chat private var lastOpenedInventory = "" @@ -337,12 +338,12 @@ object SackAPI { data class SackItem( @Expose val amount: Long, @Expose val lastChange: Int, - @Expose private val status: SackStatus? + @Expose private val status: SackStatus?, ) { + fun getStatus() = status ?: SackStatus.MISSING } - private val gemstoneMap = mapOf( "Jade Gemstones" to "ROUGH_JADE_GEM".asInternalName(), "Amber Gemstones" to "ROUGH_AMBER_GEM".asInternalName(), @@ -356,6 +357,7 @@ private val gemstoneMap = mapOf( // ideally should be correct but using alright should also be fine unless they sold their whole sacks enum class SackStatus { + MISSING, CORRECT, ALRIGHT, diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index 71d84328c..661330f92 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ScoreboardData { companion object { + // TODO USE SH-REPO private val splitIcons = listOf( "\uD83C\uDF6B", @@ -93,4 +94,4 @@ class ScoreboardData { ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(it.playerName), it.playerName) } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt index d2726c3aa..f7915a94c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkillExperience { + // TODO USE SH-REPO private val actionBarPattern = ".*§3\\+.* (?<skill>.*) \\((?<overflow>.*)/(?<needed>.*)\\).*".toPattern() private val inventoryPattern = ".* §e(?<number>.*)§6/.*".toPattern() @@ -79,6 +80,7 @@ class SkillExperience { } companion object { + private val skillExp = mutableMapOf<String, Long>() private fun getLevelForExpExactly(experience: Long): Int { @@ -109,7 +111,7 @@ class SkillExperience { return 0 } - //TODO create additional event + // TODO create additional event fun getExpForSkill(skillName: String) = skillExp[skillName.lowercase()] ?: 0 private val levelingExp = listOf( diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index ddb5943a0..64d1f6206 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -7,9 +7,9 @@ import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.events.SlayerProgressChangeEvent import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent import at.hannibal2.skyhanni.features.slayer.SlayerType +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment 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.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index 6dd0c6725..6b904bc37 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.moulconfig.internal.TextRenderUtils import net.minecraft.client.Minecraft @@ -16,6 +16,7 @@ import kotlin.time.Duration.Companion.seconds class TitleManager { companion object { + private var originalText = "" private var display = "" private var endTime = SimpleTimeMark.farPast() @@ -38,7 +39,7 @@ class TitleManager { fun command(args: Array<String>) { if (args.size < 4) { - LorenzUtils.userError("Usage: /shsendtitle <duration> <height> <fontSize> <text ..>") + ChatUtils.userError("Usage: /shsendtitle <duration> <height> <fontSize> <text ..>") return } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt index 3b8f6b7a7..3d3c9fd58 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt @@ -36,6 +36,7 @@ class ToolTipData { } companion object { + var lastSlot: Slot? = null } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt index cea3a5c2f..b59d31394 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ConfigUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -18,7 +18,7 @@ object TrackerManager { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { val config = SkyHanniMod.feature.misc.tracker.hideCheapItems - LorenzUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) { + ConditionalUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) { hasChanged = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java index dc2b4a5ac..8ea6d8ef6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java @@ -1,4 +1,5 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo; + import com.google.gson.annotations.Expose; import java.util.List; diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java index be015722a..dd00add03 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo; import at.hannibal2.skyhanni.features.garden.CropType; -import at.hannibal2.skyhanni.utils.NEUInternalName; import at.hannibal2.skyhanni.utils.LorenzRarity; import at.hannibal2.skyhanni.utils.LorenzVec; +import at.hannibal2.skyhanni.utils.NEUInternalName; import com.google.gson.annotations.Expose; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java index ad1aeb2e3..87b5e4e00 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java @@ -5,7 +5,6 @@ import com.google.gson.annotations.Expose; import java.util.List; import java.util.Map; -import java.util.Set; public class ItemsJson { @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt b/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt index 627bfdef7..ecb26b37c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt @@ -9,6 +9,7 @@ enum class ComposterUpgrade(val displayName: String, val slotNumber: Int) { ; companion object { + private fun regexValues() = entries.joinToString("|") { it.displayName } // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index b686602bb..021dd183b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.events.DebugDataCollectEvent 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.SimpleTimeMark import com.google.gson.JsonObject @@ -26,6 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean import kotlin.time.Duration.Companion.minutes class RepoManager(private val configLocation: File) { + private val gson get() = ConfigManager.gson private var latestRepoCommit: String? = null private val repoLocation: File = File(configLocation, "repo") @@ -33,6 +35,7 @@ class RepoManager(private val configLocation: File) { private var lastRepoUpdate = SimpleTimeMark.farPast() companion object { + val successfulConstants = mutableListOf<String>() val unsuccessfulConstants = mutableListOf<String>() @@ -55,7 +58,7 @@ class RepoManager(private val configLocation: File) { } } - private val atomicShouldManuallyReload = AtomicBoolean(false)//TODO remove the workaround + private val atomicShouldManuallyReload = AtomicBoolean(false)// TODO remove the workaround fun updateRepo() { atomicShouldManuallyReload.set(true) @@ -87,7 +90,7 @@ class RepoManager(private val configLocation: File) { ) { if (unsuccessfulConstants.isEmpty() && lastRepoUpdate.passedSince() < 1.minutes) { if (command) { - LorenzUtils.chat("§7The repo is already up to date!") + ChatUtils.chat("§7The repo is already up to date!") atomicShouldManuallyReload.set(false) } return@supplyAsync false @@ -119,7 +122,7 @@ class RepoManager(private val configLocation: File) { e ).printStackTrace() if (command) { - LorenzUtils.error("An error occurred while trying to reload the repo! See logs for more info.") + ChatUtils.error("An error occurred while trying to reload the repo! See logs for more info.") } return@supplyAsync false } @@ -161,10 +164,10 @@ class RepoManager(private val configLocation: File) { } comp.complete(null) if (answerMessage.isNotEmpty() && !error) { - LorenzUtils.chat("§a$answerMessage") + ChatUtils.chat("§a$answerMessage") } if (error) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Error with the repo detected, try /shupdaterepo to fix it!", "shupdaterepo", prefixColor = "§c" @@ -204,33 +207,34 @@ class RepoManager(private val configLocation: File) { fun displayRepoStatus(joinEvent: Boolean) { if (joinEvent) { if (unsuccessfulConstants.isNotEmpty()) { - LorenzUtils.error( + ChatUtils.error( "§7Repo Issue! Some features may not work. Please report this error on the Discord!\n" + "§7Repo Auto Update Value: §c${SkyHanniMod.feature.dev.repoAutoUpdate}\n" + "§7If you have Repo Auto Update turned off, please try turning that on.\n" + "§cUnsuccessful Constants §7(${unsuccessfulConstants.size}):" ) for (constant in unsuccessfulConstants) { - LorenzUtils.chat(" §e- §7$constant") + ChatUtils.chat(" §e- §7$constant") } } return } if (unsuccessfulConstants.isEmpty() && successfulConstants.isNotEmpty()) { - LorenzUtils.chat("Repo working fine! Commit hash: $latestRepoCommit", prefixColor = "§a") + ChatUtils.chat("Repo working fine! Commit hash: $latestRepoCommit", prefixColor = "§a") return } - LorenzUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c") + ChatUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c") +// if (successfulConstants.isNotEmpty()) ChatUtils.chat( if (successfulConstants.isNotEmpty()) LorenzUtils.chat( "Successful Constants §7(${successfulConstants.size}):", prefixColor = "§a" ) for (constant in successfulConstants) { - LorenzUtils.chat(" §a- §7$constant", false) + ChatUtils.chat(" §a- §7$constant", false) } - LorenzUtils.chat("Unsuccessful Constants §7(${unsuccessfulConstants.size}):") + ChatUtils.chat("Unsuccessful Constants §7(${unsuccessfulConstants.size}):") for (constant in unsuccessfulConstants) { - LorenzUtils.chat(" §e- §7$constant", false) + ChatUtils.chat(" §e- §7$constant", false) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt index 7ec70c673..38a08f8d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt @@ -31,7 +31,7 @@ object RepoUtils { // create output directory if it doesn't exist if (!dir.exists()) dir.mkdirs() val fis: FileInputStream - //buffer for read and write data to file + // buffer for read and write data to file val buffer = ByteArray(1024) try { fis = FileInputStream(zipFilePath) @@ -42,7 +42,7 @@ object RepoUtils { var fileName = ze.name fileName = fileName.substring(fileName.split("/").toTypedArray()[0].length + 1) val newFile = File(destDir + File.separator + fileName) - //create directories for sub directories in zip + // create directories for sub directories in zip File(newFile.parent).mkdirs() if (!isInTree(dir, newFile)) { throw RuntimeException( @@ -56,11 +56,11 @@ object RepoUtils { } fos.close() } - //close this ZipEntry + // close this ZipEntry zis.closeEntry() ze = zis.nextEntry } - //close last ZipEntry + // close last ZipEntry zis.closeEntry() zis.close() fis.close() diff --git a/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt index b256113a3..0ca9fb78c 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt @@ -6,5 +6,6 @@ import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.item.ItemStack class BlockClickEvent(val clickType: ClickType, val position: LorenzVec, val itemInHand: ItemStack?) : LorenzEvent() { + val getBlockState by lazy { position.getBlockStateAt() } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt index bd9a816cb..13da59c43 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt @@ -10,5 +10,5 @@ data class CheckRenderEntityEvent<T : Entity>( val camera: ICamera, val camX: Double, val camY: Double, - val camZ: Double -) : LorenzEvent()
\ No newline at end of file + val camZ: Double, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt index 469dee006..1bc664cda 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt @@ -9,5 +9,5 @@ class CropClickEvent( val crop: CropType, val blockState: IBlockState, val clickType: ClickType, - val itemInHand: ItemStack? -) : LorenzEvent()
\ No newline at end of file + val itemInHand: ItemStack?, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt index eecc132ca..efef20840 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt @@ -6,8 +6,9 @@ import net.minecraft.item.ItemStack data class EntityEquipmentChangeEvent( val entity: Entity, val equipmentSlot: Int, - val newItemStack: ItemStack? + val newItemStack: ItemStack?, ) : LorenzEvent() { + val isHead get() = equipmentSlot == EQUIPMENT_SLOT_HEAD val isChest get() = equipmentSlot == EQUIPMENT_SLOT_CHEST val isLeggings get() = equipmentSlot == EQUIPMENT_SLOT_LEGGINGS @@ -15,6 +16,7 @@ data class EntityEquipmentChangeEvent( val isHand get() = equipmentSlot == EQUIPMENT_SLOT_HAND companion object { + const val EQUIPMENT_SLOT_HEAD = 4 const val EQUIPMENT_SLOT_CHEST = 3 const val EQUIPMENT_SLOT_LEGGINGS = 2 diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt index b09062543..68c913c1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt @@ -7,5 +7,5 @@ class EntityMoveEvent( val entity: Entity, val oldLocation: LorenzVec, val newLocation: LorenzVec, - val distance: Double -) : LorenzEvent()
\ No newline at end of file + val distance: Double, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt index 437130bdd..f6ffc4295 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt @@ -12,7 +12,7 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: override val container: Container, val mouseX: Int, val mouseY: Int, - val partialTicks: Float + val partialTicks: Float, ) : GuiContainerEvent(gui, container) @Cancelable @@ -21,18 +21,19 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: abstract class DrawSlotEvent(gui: GuiContainer, container: Container, open val slot: Slot) : GuiContainerEvent(gui, container) { + @Cancelable data class GuiContainerDrawSlotPre( override val gui: GuiContainer, override val container: Container, - override val slot: Slot + override val slot: Slot, ) : DrawSlotEvent(gui, container, slot) data class GuiContainerDrawSlotPost( override val gui: GuiContainer, override val container: Container, - override val slot: Slot + override val slot: Slot, ) : DrawSlotEvent(gui, container, slot) } @@ -42,7 +43,7 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: override val container: Container, val mouseX: Int, val mouseY: Int, - val partialTicks: Float + val partialTicks: Float, ) : GuiContainerEvent(gui, container) @Cancelable @@ -52,6 +53,6 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: val slot: Slot?, val slotId: Int, val clickedButton: Int, - val clickType: Int + val clickType: Int, ) : GuiContainerEvent(gui, container) -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt index f879dbc39..58dc557e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt @@ -9,15 +9,16 @@ abstract class GuiRenderItemEvent : LorenzEvent() { open val stack: ItemStack?, open val x: Int, open val y: Int, - open val text: String? + open val text: String?, ) : GuiRenderItemEvent() { + data class GuiRenderItemPost( override val fontRenderer: FontRenderer, override val stack: ItemStack?, override val x: Int, override val y: Int, - override val text: String? + override val text: String?, ) : RenderOverlayEvent(fontRenderer, stack, x, y, text) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt index 72630756a..7b94efd55 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.OtherInventoryData import net.minecraft.item.ItemStack class InventoryCloseEvent(val inventory: OtherInventoryData.Inventory, val reopenSameName: Boolean) : LorenzEvent() { + val inventoryId: Int by lazy { inventory.windowId } val inventoryName: String by lazy { inventory.title } val inventorySize: Int by lazy { inventory.slotCount } diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt index 7ff2ca293..bc9e97ed8 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.OtherInventoryData import net.minecraft.item.ItemStack open class InventoryOpenEvent(private val inventory: OtherInventoryData.Inventory) : LorenzEvent() { + val inventoryId: Int by lazy { inventory.windowId } val inventoryName: String by lazy { inventory.title } val inventorySize: Int by lazy { inventory.slotCount } diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt index acce544db..c2c51cec6 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt @@ -6,5 +6,5 @@ class LorenzChatEvent( var message: String, var chatComponent: IChatComponent, var blockedReason: String = "", - var chatLineId: Int = 0 + var chatLineId: Int = 0, ) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index 90d68ed35..c83ec95aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.mixins.hooks.getValue import at.hannibal2.skyhanni.mixins.hooks.setValue import at.hannibal2.skyhanni.mixins.transformers.AccessorEventBus import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.Event import net.minecraftforge.fml.common.eventhandler.IEventListener @@ -19,6 +19,7 @@ abstract class LorenzEvent : Event() { fun postAndCatch() = postAndCatchAndBlock {} companion object { + var eventHandlerDepth by object : ThreadLocal<Int>() { override fun initialValue(): Int { return 0 @@ -55,7 +56,7 @@ abstract class LorenzEvent : Event() { eventHandlerDepth-- if (errors > visibleErrors) { val hiddenErrors = errors - visibleErrors - LorenzUtils.error("$hiddenErrors more errors in $eventName are hidden!") + ChatUtils.error("$hiddenErrors more errors in $eventName are hidden!") } return if (isCancelable) isCanceled else false } diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt index 5bf8d7c2e..ba8a30e56 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt @@ -1,7 +1,8 @@ package at.hannibal2.skyhanni.events class LorenzTickEvent(private val tick: Int) : LorenzEvent() { + fun isMod(i: Int) = tick % i == 0 fun repeatSeconds(i: Int) = isMod(i * 20) -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt index 9e18fced9..52a6dc1d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt @@ -4,5 +4,6 @@ import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack class LorenzToolTipEvent(val slot: Slot, val itemStack: ItemStack, var toolTip: MutableList<String>) : LorenzEvent() { + fun toolTipRemovedPrefix() = toolTip.map { it.removePrefix("§5§o") } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt index 71c1cfa73..7d356707e 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt @@ -8,6 +8,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable * Note: This event is async and may not be executed on the main minecraft thread. */ abstract class PacketEvent : LorenzEvent() { + abstract val direction: Direction abstract val packet: Packet<*> @@ -15,6 +16,7 @@ abstract class PacketEvent : LorenzEvent() { * Note: This event is async and may not be executed on the main minecraft thread. */ data class ReceiveEvent(override val packet: Packet<*>) : PacketEvent() { + override val direction = Direction.INBOUND } @@ -22,10 +24,11 @@ abstract class PacketEvent : LorenzEvent() { * Note: This event is async and may not be executed on the main minecraft thread. */ data class SendEvent(override val packet: Packet<*>) : PacketEvent() { + override val direction = Direction.OUTBOUND } enum class Direction { INBOUND, OUTBOUND } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt index bd03261ea..123d5e881 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt @@ -7,5 +7,6 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable @Cancelable class PlaySoundEvent(val soundName: String, val location: LorenzVec, val pitch: Float, val volume: Float) : LorenzEvent() { + val distanceToPlayer by lazy { location.distanceToPlayer() } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt index 975990b86..68f42f43b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt @@ -13,8 +13,9 @@ class ReceiveParticleEvent( val speed: Float, val offset: LorenzVec, val longDistance: Boolean, - val particleArgs: IntArray + val particleArgs: IntArray, ) : LorenzEvent() { + val distanceToPlayer by lazy { location.distanceToPlayer() } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt index 6a197de6c..d061becf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt @@ -111,8 +111,8 @@ class RenderEntityOutlineEvent(theType: Type?, potentialEntities: HashSet<Entity * [.NO_XRAY] means that this directly precedes entities whose outlines are rendered only when visible to the client
*/
enum class Type {
+
XRAY,
NO_XRAY
}
-
}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt index 8d841bcee..d9341cc87 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderItemTipEvent.kt @@ -6,10 +6,11 @@ class RenderItemTipEvent( val stack: ItemStack, var renderObjects: MutableList<RenderObject>, ) : LorenzEvent() { + var stackTip = "" set(value) { renderObjects.add(RenderObject(value, 0, 0)) } } -class RenderObject(val text: String, var offsetX: Int = 0, var offsetY: Int = 0)
\ No newline at end of file +class RenderObject(val text: String, var offsetX: Int = 0, var offsetY: Int = 0) diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt index ef4a55563..cfcdfb37b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt @@ -2,5 +2,5 @@ package at.hannibal2.skyhanni.events import net.minecraft.entity.EntityLivingBase -//TODO remove -class RenderMobColoredEvent(val entity: EntityLivingBase, var color: Int) : LorenzEvent()
\ No newline at end of file +// TODO remove +class RenderMobColoredEvent(val entity: EntityLivingBase, var color: Int) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt index 2f96e4482..7768e6586 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.events import net.minecraft.entity.EntityLivingBase import java.awt.Color -//TODO remove +// TODO remove class ResetEntityHurtEvent(val entity: EntityLivingBase, var shouldReset: Boolean) : LorenzEvent() -fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff)
\ No newline at end of file +fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) diff --git a/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt index aa6101a62..aa81287d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt @@ -5,5 +5,5 @@ import at.hannibal2.skyhanni.data.SackAPI class SackChangeEvent( val sackChanges: List<SackAPI.SackChange>, val otherItemsAdded: Boolean, - val otherItemsRemoved: Boolean + val otherItemsRemoved: Boolean, ) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt index 6d3d39299..0c0c4f627 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt @@ -5,5 +5,5 @@ import at.hannibal2.skyhanni.features.fishing.SeaCreature class SeaCreatureFishEvent( val seaCreature: SeaCreature, val chatEvent: LorenzChatEvent, - val doubleHook: Boolean -) : LorenzEvent()
\ No newline at end of file + val doubleHook: Boolean, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt index b8ac2eb28..fae3399e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt @@ -7,19 +7,19 @@ import net.minecraft.block.state.IBlockState import net.minecraft.util.BlockPos class ServerBlockChangeEvent(private val blockPos: BlockPos, private val blockState: IBlockState) : LorenzEvent() { + val location by lazy { blockPos.toLorenzVec() } val old by lazy { location.getBlockAt().toString().getName() } val new by lazy { blockState.block.toString().getName() } companion object { + val pattern = "Block\\{minecraft:(?<name>.*)}".toPattern() private fun String.getName() = pattern.matchMatcher(this) { group("name") } ?: this - } - } 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 } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt index 4959bda33..b48b1376c 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.chroma.ChromaFontRenderer import at.hannibal2.skyhanni.mixins.transformers.AccessorFontRenderer import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.shader.ShaderManager import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager import org.spongepowered.asm.mixin.injection.callback.CallbackInfo @@ -17,6 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo * Credit: [FontRendererHook.java](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/FontRendererHook.java) */ object FontRendererHook { + private var CHROMA_COLOR: Int = -0x1 private val DRAW_CHROMA = ChromaFontRenderer(CHROMA_COLOR) private var CHROMA_COLOR_SHADOW: Int = -0xAAAAAB @@ -156,7 +156,7 @@ object FontRendererHook { ci: CallbackInfo, i: Int, c0: Char, - i1: Int + i1: Int, ): Boolean { if (!LorenzUtils.inSkyBlock) return false if (!SkyHanniMod.feature.chroma.enabled) return false diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt index 33ee05271..6bbbbf6e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt @@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable class MixinPatcherFontRendererHookHook { companion object { + @JvmStatic fun overridePatcherFontRenderer(string: String, shadow: Boolean, cir: CallbackInfoReturnable<Boolean>) { if (!LorenzUtils.onHypixel) return @@ -16,4 +17,4 @@ class MixinPatcherFontRendererHookHook { } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt index 57305c5bd..92e7a95ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.culling.ICamera import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
class RenderGlobalHook {
+
fun renderEntitiesOutlines(camera: ICamera?, partialTicks: Float): Boolean {
val vec = RenderUtils.exactLocation(Minecraft.getMinecraft().renderViewEntity, partialTicks)
return EntityOutlineRenderer.renderEntityOutlines(camera!!, partialTicks, vec)
@@ -17,4 +18,4 @@ class RenderGlobalHook { cir.returnValue = true
}
}
-}
\ No newline at end of file +}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt index d2ea03611..4d54aa90b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt @@ -19,6 +19,7 @@ class RenderLivingEntityHelper { } companion object { + private val entityColorMap = mutableMapOf<EntityLivingBase, Int>() private val entityColorCondition = mutableMapOf<EntityLivingBase, () -> Boolean>() @@ -49,7 +50,7 @@ class RenderLivingEntityHelper { } } - //TODO remove event + // TODO remove event if (!SkyHanniDebugsAndTests.globalRender) return 0 val event = RenderMobColoredEvent(entity, 0) event.postAndCatch() @@ -65,10 +66,10 @@ class RenderLivingEntityHelper { } } - //TODO remove event + // TODO remove event val event = ResetEntityHurtEvent(entity, false) event.postAndCatch() return if (event.shouldReset) 0 else entity.hurtTime } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt index c91252c8a..8fb195a3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt @@ -5,6 +5,7 @@ import net.minecraft.client.renderer.GlStateManager import net.minecraft.entity.EntityLivingBase
class RendererLivingEntityHook {
+
fun setOutlineColor(red: Float, green: Float, blue: Float, alpha: Float, entity: EntityLivingBase) {
val color = EntityOutlineRenderer.getCustomOutlineColor(entity)
@@ -17,4 +18,4 @@ class RendererLivingEntityHook { GlStateManager.color(red, green, blue, alpha)
}
}
-}
\ No newline at end of file +}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java b/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java index 935314222..1f1b0e1fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java @@ -1,14 +1,22 @@ package at.hannibal2.skyhanni.mixins.init; -import org.spongepowered.asm.lib.tree.*; -import org.spongepowered.asm.mixin.extensibility.*; - -import java.io.*; -import java.net.*; -import java.nio.file.*; -import java.util.*; -import java.util.stream.*; -import java.util.zip.*; +import org.spongepowered.asm.lib.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; public class SkyhanniMixinPlugin implements IMixinConfigPlugin { @Override diff --git a/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt b/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt index 25d876f7a..88ce05746 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/CommandsSendToServerLogger.kt @@ -6,6 +6,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CommandsSendToServerLogger { companion object { + fun logCommandsToServer(command: String) { if (SkyHanniMod.feature.dev.debug.commandLogs) { Exception("command send to server: '$command'").printStackTrace() @@ -17,4 +18,4 @@ class CommandsSendToServerLogger { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.commandLogs", "dev.debug.commandLogs") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt index e2ff4dbb4..42f5a5c96 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.DebugDataCollectEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.equalsIgnoreColor @@ -13,7 +14,7 @@ object DebugCommand { fun command(args: Array<String>) { if (args.size == 2 && args[0] == "profileName") { HypixelData.profileName = args[1].lowercase() - LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'") + ChatUtils.chat("§eManually set profileName to '${HypixelData.profileName}'") return } val list = mutableListOf<String>() @@ -51,7 +52,7 @@ object DebugCommand { list.add("```") OSUtils.copyToClipboard(list.joinToString("\n")) - LorenzUtils.chat("§eCopied SkyHanni debug data in the clipboard.") + ChatUtils.chat("§eCopied SkyHanni debug data in the clipboard.") } private fun profileType(event: DebugDataCollectEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt b/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt index 525e9bc69..b957129cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt @@ -17,7 +17,7 @@ object GriffinUtils { beacon: Boolean = false, extraSize: Double = 0.0, extraSizeTopY: Double = extraSize, - extraSizeBottomY: Double = extraSize + extraSizeBottomY: Double = extraSize, ) { val (viewerX, viewerY, viewerZ) = RenderUtils.getViewerPos(partialTicks) val x = location.x - viewerX @@ -47,4 +47,4 @@ object GriffinUtils { GlStateManager.enableCull() } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt index 8ae9f0c5e..c9fecaf08 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.ChatUtils 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.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.getLorenzVec @@ -33,11 +33,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PacketTest { companion object { + private var enabled = false fun toggle() { enabled = !enabled - LorenzUtils.chat("Packet test: $enabled") + ChatUtils.chat("Packet test: $enabled") } } @@ -68,7 +69,6 @@ class PacketTest { val packet = event.packet val packetName = packet.javaClass.simpleName - // Keep alive if (packetName == "S00PacketKeepAlive") return if (packetName == "C00PacketKeepAlive") return @@ -116,7 +116,6 @@ class PacketTest { // if (packetName == "S20PacketEntityProperties") return // if (packetName == "S1BPacketEntityAttach") return - val id = getEntityId(packet) val entity = getEntity(packet, id) val distance = getDistance(getLocation(packet, entity)) @@ -134,7 +133,6 @@ class PacketTest { return } - // if (packetName.contains("")) { // // } diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt index 2574256cc..4ad8d51e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt @@ -17,6 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds class ParkourWaypointSaver { + private val config get() = SkyHanniMod.feature.dev.waypoint private var timeLastSaved = SimpleTimeMark.farPast() private var locations = mutableListOf<LorenzVec>() @@ -77,4 +78,4 @@ class ParkourWaypointSaver { } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt index 4332a495a..8bfcbfd22 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt @@ -6,10 +6,10 @@ import at.hannibal2.skyhanni.config.Features import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import com.google.gson.JsonElement import io.github.moulberry.notenoughupdates.util.Shimmy import kotlinx.coroutines.launch @@ -23,7 +23,7 @@ object SkyHanniConfigSearchResetCommand { fun command(args: Array<String>) { SkyHanniMod.coroutineScope.launch { - LorenzUtils.chat(runCommand(args), false) + ChatUtils.chat(runCommand(args), false) } lastCommand = args } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 799e096eb..ccb6b198e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +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.getInternalNameOrNull @@ -28,13 +29,13 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzDebug import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -53,6 +54,7 @@ import kotlin.time.Duration.Companion.seconds class SkyHanniDebugsAndTests { companion object { + private val config get() = SkyHanniMod.feature.dev private val debugConfig get() = config.debug var displayLine = "" @@ -93,14 +95,14 @@ class SkyHanniDebugsAndTests { if (args.isEmpty()) { testLocation = null - LorenzUtils.chat("reset test waypoint") + ChatUtils.chat("reset test waypoint") } val x = args[0].toDouble() val y = args[1].toDouble() val z = args[2].toDouble() testLocation = LorenzVec(x, y, z) - LorenzUtils.chat("set test waypoint") + ChatUtils.chat("set test waypoint") } fun testCommand(args: Array<String>) { @@ -184,7 +186,7 @@ class SkyHanniDebugsAndTests { return } - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "§cTHIS WILL RESET YOUR SkyHanni CONFIG! Click here to procceed.", "shconfigmanagerreset confirm", false @@ -209,7 +211,7 @@ class SkyHanniDebugsAndTests { // resetting the MoulConfigProcessor in use ConfigGuiManager.editor = null - LorenzUtils.chat("Reset the config manager!") + ChatUtils.chat("Reset the config manager!") }.start() } @@ -239,7 +241,7 @@ class SkyHanniDebugsAndTests { val internalName = NEUItems.getRawInternalName(itemName) list.add(NEUItems.getItemStack(internalName)) } catch (e: Error) { - LorenzUtils.debug("itemName '$itemName' is invalid for visitor '$name'") + ChatUtils.debug("itemName '$itemName' is invalid for visitor '$name'") errors++ } } @@ -251,9 +253,9 @@ class SkyHanniDebugsAndTests { bigList.add(list) displayList = bigList if (errors == 0) { - LorenzUtils.debug("Test garden visitor renderer: no errors") + ChatUtils.debug("Test garden visitor renderer: no errors") } else { - LorenzUtils.debug("Test garden visitor renderer: $errors errors") + ChatUtils.debug("Test garden visitor renderer: $errors errors") } } @@ -282,7 +284,7 @@ class SkyHanniDebugsAndTests { println("Skipped registering listener $simpleName") } } - LorenzUtils.chat("reloaded ${modules.size} listener classes.") + ChatUtils.chat("reloaded ${modules.size} listener classes.") } fun stopListeners() { @@ -293,22 +295,22 @@ class SkyHanniDebugsAndTests { MinecraftForge.EVENT_BUS.unregister(original) println("Unregistered listener $simpleName") } - LorenzUtils.chat("stopped ${modules.size} listener classes.") + ChatUtils.chat("stopped ${modules.size} listener classes.") } fun whereAmI() { if (LorenzUtils.inSkyBlock) { - LorenzUtils.chat("§eYou are currently in ${LorenzUtils.skyBlockIsland}.") + ChatUtils.chat("§eYou are currently in ${LorenzUtils.skyBlockIsland}.") return } - LorenzUtils.chat("§eYou are not in Skyblock.") + ChatUtils.chat("§eYou are not in Skyblock.") } private var lastManualContestDataUpdate = SimpleTimeMark.farPast() fun clearContestData() { if (lastManualContestDataUpdate.passedSince() < 30.seconds) { - LorenzUtils.userError("§cYou already cleared Jacob's Contest data recently!") + ChatUtils.userError("§cYou already cleared Jacob's Contest data recently!") return } lastManualContestDataUpdate = SimpleTimeMark.now() @@ -338,34 +340,34 @@ class SkyHanniDebugsAndTests { fun debugVersion() { val name = "SkyHanni ${SkyHanniMod.version}" - LorenzUtils.chat("§eYou are using $name") + ChatUtils.chat("§eYou are using $name") OSUtils.copyToClipboard(name) } fun copyItemInternalName() { val hand = InventoryUtils.getItemInHand() if (hand == null) { - LorenzUtils.userError("No item in hand!") + ChatUtils.userError("No item in hand!") return } val internalName = hand.getInternalNameOrNull() if (internalName == null) { - LorenzUtils.error("§cInternal name is null for item ${hand.name}") + ChatUtils.error("§cInternal name is null for item ${hand.name}") return } val rawInternalName = internalName.asString() OSUtils.copyToClipboard(rawInternalName) - LorenzUtils.chat("§eCopied internal name §7$rawInternalName §eto the clipboard!") + ChatUtils.chat("§eCopied internal name §7$rawInternalName §eto the clipboard!") } fun toggleRender() { globalRender = !globalRender if (globalRender) { - LorenzUtils.chat("§aEnabled global renderer!") + ChatUtils.chat("§aEnabled global renderer!") } else { - LorenzUtils.chat("§cDisabled global renderer! Run this command again to show SkyHanni rendering again.") + ChatUtils.chat("§cDisabled global renderer! Run this command again to show SkyHanni rendering again.") } } } @@ -379,7 +381,7 @@ class SkyHanniDebugsAndTests { val internalName = stack.getInternalNameOrNull() ?: return val rawInternalName = internalName.asString() OSUtils.copyToClipboard(rawInternalName) - LorenzUtils.chat("§eCopied internal name §7$rawInternalName §eto the clipboard!") + ChatUtils.chat("§eCopied internal name §7$rawInternalName §eto the clipboard!") } @SubscribeEvent @@ -390,7 +392,6 @@ class SkyHanniDebugsAndTests { val internalName = itemStack.getInternalName() if ((internalName == NEUInternalName.NONE) && !debugConfig.showEmptyNames) return event.toolTip.add("Internal Name: '${internalName.asString()}'") - } @SubscribeEvent @@ -435,7 +436,6 @@ class SkyHanniDebugsAndTests { @SubscribeEvent fun onChat(event: LorenzChatEvent) { - } @SubscribeEvent @@ -571,7 +571,7 @@ class SkyHanniDebugsAndTests { // if (soundName == "mob.zombie.infect") { // if (pitch == 1.968254f) { // if (volume == 0.3f) { -// LorenzUtils.chat("used ancestral spade!") +// ChatUtils.chat("used ancestral spade!") // return // } // } @@ -662,6 +662,5 @@ class SkyHanniDebugsAndTests { event.move(3, "dev.showItemRarity", "dev.debug.showItemRarity") event.move(3, "dev.copyInternalName", "dev.debug.copyInternalName") event.move(3, "dev.showNpcPrice", "dev.debug.showNpcPrice") - } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestBingo.kt b/src/main/java/at/hannibal2/skyhanni/test/TestBingo.kt index 95832ac46..99418c607 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestBingo.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestBingo.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.test -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils object TestBingo { + var testBingo = false fun toggle() { testBingo = !testBingo - LorenzUtils.chat("Test Bingo " + (if (testBingo) "enabled" else "disabled")) + ChatUtils.chat("Test Bingo " + (if (testBingo) "enabled" else "disabled")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt index 24edae9cc..e418f6043 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt @@ -3,11 +3,11 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryUpdatedEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.getSkullOwner import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object TestCopyBestiaryValues { class BestiarityObject { + @Expose var name: String = "" diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt index be659b25d..5ab1effb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +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.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.OSUtils @@ -35,11 +35,11 @@ object TestCopyRngMeterValues { if (map.isEmpty()) return OSUtils.copyToClipboard(ConfigManager.gson.toJson(map)) - LorenzUtils.debug("${map.size} items saved to clipboard.") + ChatUtils.debug("${map.size} items saved to clipboard.") } @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "dev.copyRngMeter", "dev.debug.copyRngMeter") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt index b7c1a6f4b..304d4646f 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt @@ -3,11 +3,11 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.test.command.CopyItemCommand.copyItemToClipboard +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemStackTypeAdapterFactory import at.hannibal2.skyhanni.utils.KSerializable import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.KotlinTypeAdapterFactory -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NBTTypeAdapter import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.fromJson @@ -22,6 +22,7 @@ import java.io.InputStreamReader import java.io.Reader object TestExportTools { + private val config get() = SkyHanniMod.feature.dev.debug val gson = GsonBuilder() @@ -61,7 +62,7 @@ object TestExportTools { } val json = toJson(Item, stack) OSUtils.copyToClipboard(json) - LorenzUtils.chat("Compressed item info copied into the clipboard!") + ChatUtils.chat("Compressed item info copied into the clipboard!") } inline fun <reified T> getTestData(category: Key<T>, name: String): T { diff --git a/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt b/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt index 26ac4d9a7..5e03464b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/WorldEdit.kt @@ -5,9 +5,9 @@ import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ClipboardUtils import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemId @@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color object WorldEdit { + private var leftPos = null as BlockPos? private var rightPos = null as BlockPos? @@ -97,37 +98,37 @@ object WorldEdit { fun command(it: Array<String>) { if (!isEnabled()) { - LorenzUtils.userError("World Edit is disabled in the config. Enable it if you want to use it.") + ChatUtils.userError("World Edit is disabled in the config. Enable it if you want to use it.") return } when (it.firstOrNull()) { null, "help" -> { - LorenzUtils.chat("Use a wood axe and left/right click to select a region in the world. Then use /shworldedit copy or /shworldedit reset.") + ChatUtils.chat("Use a wood axe and left/right click to select a region in the world. Then use /shworldedit copy or /shworldedit reset.") } "copy" -> { copyToClipboard() - LorenzUtils.chat("Copied text to clipboard.") + ChatUtils.chat("Copied text to clipboard.") } "reset" -> { leftPos = null rightPos = null - LorenzUtils.chat("Reset selected region") + ChatUtils.chat("Reset selected region") } "left", "pos1" -> { leftPos = LocationUtils.playerLocation().toBlockPos() - LorenzUtils.chat("Set left pos.") + ChatUtils.chat("Set left pos.") } "right", "pos2" -> { leftPos = LocationUtils.playerLocation().toBlockPos() - LorenzUtils.chat("Set right pos.") + ChatUtils.chat("Set right pos.") } else -> { - LorenzUtils.chat("Unknown subcommand") + ChatUtils.chat("Unknown subcommand") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt index 6a583b1e3..d038d7759 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.test.command +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.getLore -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMinecraftId import net.minecraft.item.ItemStack @@ -14,7 +14,7 @@ object CopyItemCommand { fun command() { val itemStack = InventoryUtils.getItemInHand() if (itemStack == null) { - LorenzUtils.userError("No item in hand!") + ChatUtils.userError("No item in hand!") return } copyItemToClipboard(itemStack) @@ -53,6 +53,6 @@ object CopyItemCommand { val string = resultList.joinToString("\n") OSUtils.copyToClipboard(string) - LorenzUtils.chat("Item info copied into the clipboard!") + ChatUtils.chat("Item info copied into the clipboard!") } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt index dae69775a..5ba4447f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.test.command +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand import at.hannibal2.skyhanni.utils.EntityUtils.getSkinTexture @@ -8,7 +9,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.isEnchanted import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.toLorenzVec @@ -45,7 +45,7 @@ object CopyNearbyEntitiesCommand { resultList.add("name: '" + entity.name + "'") resultList.add("displayName: '${displayName.formattedText}'") resultList.add("entityId: ${entity.entityId}") - resultList.add("uuid version: ${entity.uniqueID.version()} ${if(entity.uniqueID.version() != 4) "NPC " else ""}(${entity.uniqueID})") + resultList.add("uuid version: ${entity.uniqueID.version()} ${if (entity.uniqueID.version() != 4) "NPC " else ""}(${entity.uniqueID})") resultList.add("location data:") resultList.add("- vec: $vec") resultList.add("- distance: $distance") @@ -147,9 +147,9 @@ object CopyNearbyEntitiesCommand { if (counter != 0) { val string = resultList.joinToString("\n") OSUtils.copyToClipboard(string) - LorenzUtils.chat("$counter entities copied into the clipboard!") + ChatUtils.chat("$counter entities copied into the clipboard!") } else { - LorenzUtils.chat("No entities found in a search radius of $searchRadius!") + ChatUtils.chat("No entities found in a search radius of $searchRadius!") } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt index 67b28f0aa..c76d7318f 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.OSUtils @@ -13,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // Note: Each particle is copied anywhere between 1-3 times. Different each time. Shouldn't affect using this for debugging or developing object CopyNearbyParticlesCommand { + private var searchRadius = 0 private var saveNextTick = false private var searchTime: Long = 0 @@ -41,10 +42,10 @@ object CopyNearbyParticlesCommand { if (resultList.isEmpty() && tickTime == 0L) tickTime = System.currentTimeMillis() if (System.currentTimeMillis() > tickTime + 30) { - if (counter == 0) LorenzUtils.chat("No particles found nearby, try a larger search radius") else { + if (counter == 0) ChatUtils.chat("No particles found nearby, try a larger search radius") else { val string = resultList.joinToString("\n") OSUtils.copyToClipboard(string) - LorenzUtils.chat("$counter particles copied into the clipboard!") + ChatUtils.chat("$counter particles copied into the clipboard!") } saveNextTick = false return diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt index b940d1948..e0750c5a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyScoreboardCommand.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.data.ScoreboardData -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.removeColor object CopyScoreboardCommand { + fun command(args: Array<String>) { val resultList = mutableListOf<String>() val noColor = args.size == 1 && args[0] == "true" @@ -21,6 +22,6 @@ object CopyScoreboardCommand { val string = resultList.joinToString("\n") OSUtils.copyToClipboard(string) - LorenzUtils.chat("Scoreboard copied into your clipboard!") + ChatUtils.chat("Scoreboard copied into your clipboard!") } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 092800c10..ca9449419 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.KeyboardManager -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeLimitedSet @@ -11,6 +11,7 @@ import java.util.UUID import kotlin.time.Duration.Companion.minutes object ErrorManager { + // random id -> error message private val errorMessages = mutableMapOf<String, String>() private val fullErrorMessages = mutableMapOf<String, String>() @@ -28,7 +29,7 @@ object ErrorManager { fun command(array: Array<String>) { if (array.size != 1) { - LorenzUtils.userError("Use /shcopyerror <error id>") + ChatUtils.userError("Use /shcopyerror <error id>") return } @@ -40,7 +41,7 @@ object ErrorManager { errorMessages[id] } val name = if (fullErrorMessage) "Full error" else "Error" - LorenzUtils.chat(errorMessage?.let { + ChatUtils.chat(errorMessage?.let { OSUtils.copyToClipboard(it) "$name copied into the clipboard, please report it on the SkyHanni discord!" } ?: "Error id not found!") @@ -68,7 +69,7 @@ object ErrorManager { throwable: Throwable, message: String, ignoreErrorCache: Boolean, - vararg extraData: Pair<String, Any?> + vararg extraData: Pair<String, Any?>, ) { val error = Error(message, throwable) error.printStackTrace() @@ -93,7 +94,7 @@ object ErrorManager { fullErrorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n(full stack trace)\n \n$fullStackTrace\n$extraDataString```" - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "§c[SkyHanni-${SkyHanniMod.version}]: $message§c. Click here to copy the error into the clipboard.", "shcopyerror $randomId", false diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt index a60b0f0d2..0f14c94fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt @@ -1,23 +1,24 @@ package at.hannibal2.skyhanni.test.command -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraft.util.ChatComponentText import net.minecraftforge.client.event.ClientChatReceivedEvent import net.minecraftforge.common.MinecraftForge object TestChatCommand { + fun command(args: Array<String>) { if (args.isEmpty()) { - LorenzUtils.userError("Specify a chat message to test!") + ChatUtils.userError("Specify a chat message to test!") return } val hidden = args.last() == "-s" var rawMessage = args.toList().joinToString(" ") - if (!hidden) LorenzUtils.chat("Testing message: §7$rawMessage", prefixColor = "§a") + if (!hidden) ChatUtils.chat("Testing message: §7$rawMessage", prefixColor = "§a") if (hidden) rawMessage = rawMessage.replace(" -s", "") val formattedMessage = rawMessage.replace("&", "§") - LorenzUtils.chat(formattedMessage, false) + ChatUtils.chat(formattedMessage, false) MinecraftForge.EVENT_BUS.post(ClientChatReceivedEvent(0, ChatComponentText(formattedMessage))) } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt index 87acab62d..447a6f5aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.test.hotswap import java.util.function.Supplier object HotswapSupport { + private val isForgeSidePresent = runCatching { Class.forName("moe.nea.hotswapagentforge.forge.HotswapEvent") }.isSuccess private val obj = if (isForgeSidePresent) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportHandle.kt b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportHandle.kt index c006753a0..e0bb8470f 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportHandle.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportHandle.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test.hotswap interface HotswapSupportHandle { + fun load() fun isLoaded(): Boolean } diff --git a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt index 044f5c817..45b81a1ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.test.hotswap import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible -import at.hannibal2.skyhanni.utils.LorenzUtils.removeFinal +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible +import at.hannibal2.skyhanni.utils.ReflectionUtils.removeFinal import moe.nea.hotswapagentforge.forge.ClassDefinitionEvent import moe.nea.hotswapagentforge.forge.HotswapEvent import moe.nea.hotswapagentforge.forge.HotswapFinishedEvent @@ -12,6 +12,7 @@ import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HotswapSupportImpl : HotswapSupportHandle { + override fun load() { MinecraftForge.EVENT_BUS.register(this) println("Hotswap Client in Skyhanni loaded") @@ -22,7 +23,7 @@ class HotswapSupportImpl : HotswapSupportHandle { val instance = SkyHanniMod.modules.find { it.javaClass.name == event.fullyQualifiedName } ?: return val primaryConstructor = runCatching { instance.javaClass.getDeclaredConstructor() }.getOrNull() Minecraft.getMinecraft().addScheduledTask { - LorenzUtils.chat("Refreshing event subscriptions for module $instance!") + ChatUtils.chat("Refreshing event subscriptions for module $instance!") MinecraftForge.EVENT_BUS.unregister(instance) if (primaryConstructor == null) { MinecraftForge.EVENT_BUS.register(instance) @@ -30,13 +31,13 @@ class HotswapSupportImpl : HotswapSupportHandle { SkyHanniMod.modules.remove(instance) primaryConstructor.isAccessible = true val newInstance = primaryConstructor.newInstance() - LorenzUtils.chat("Reconstructing $instance -> $newInstance!") + ChatUtils.chat("Reconstructing $instance -> $newInstance!") val instanceField = runCatching { instance.javaClass.getDeclaredField("INSTANCE") }.getOrNull() ?.takeIf { it.type == instance.javaClass } ?.makeAccessible() ?.removeFinal() if (instanceField != null) { - LorenzUtils.chat("Reinjected static instance $newInstance!") + ChatUtils.chat("Reinjected static instance $newInstance!") instanceField.set(null, newInstance) } SkyHanniMod.modules.add(newInstance) @@ -47,7 +48,7 @@ class HotswapSupportImpl : HotswapSupportHandle { @SubscribeEvent fun onHotswapDetected(event: HotswapFinishedEvent) { - LorenzUtils.chat("Hotswap finished!") + ChatUtils.chat("Hotswap finished!") } override fun isLoaded(): Boolean { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt index 2fd634d26..0f561fdff 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt @@ -22,8 +22,8 @@ import java.io.FileInputStream import java.io.InputStreamReader import java.nio.charset.StandardCharsets - object APIUtil { + private val parser = JsonParser() private var showApiErrors = false @@ -49,7 +49,7 @@ object APIUtil { fun getJSONResponseAsElement( urlString: String, silentError: Boolean = false, - apiName: String = "Hypixel API" + apiName: String = "Hypixel API", ): JsonElement { val client = builder.build() try { @@ -63,16 +63,15 @@ object APIUtil { if (e.message?.contains("Use JsonReader.setLenient(true)") == true) { println("MalformedJsonException: Use JsonReader.setLenient(true)") println(" - getJSONResponse: '$urlString'") - LorenzUtils.debug("MalformedJsonException: Use JsonReader.setLenient(true)") + ChatUtils.debug("MalformedJsonException: Use JsonReader.setLenient(true)") } else if (retSrc.contains("<center><h1>502 Bad Gateway</h1></center>")) { if (showApiErrors && apiName == "Hypixel API") { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Problems with detecting the Hypixel API. §eClick here to hide this message for now.", "shtogglehypixelapierrors" ) } e.printStackTrace() - } else { ErrorManager.logErrorWithData( e, "$apiName error for url: '$urlString'", @@ -118,7 +117,7 @@ object APIUtil { val message = "POST request to '$urlString' returned status ${status.statusCode}" println(message) - LorenzUtils.error("SkyHanni ran into an error. Status: ${status.statusCode}") + ChatUtils.error("SkyHanni ran into an error. Status: ${status.statusCode}") return ApiResponse(false, message, JsonObject()) } } catch (throwable: Throwable) { @@ -126,7 +125,7 @@ object APIUtil { throw throwable } else { throwable.printStackTrace() - LorenzUtils.error("SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst sending a resource. See logs for more details.") + ChatUtils.error("SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst sending a resource. See logs for more details.") } return ApiResponse(false, throwable.message, JsonObject()) } finally { @@ -139,15 +138,21 @@ object APIUtil { return parser.parse(retSrc) as JsonObject } - fun postJSONIsSuccessful(urlString: String, body: String, silentError: Boolean = false): Boolean { - val response = postJSON(urlString, body, silentError) + fun postJSONIsSuccessful(url: String, body: String, silentError: Boolean = false): Boolean { + val response = postJSON(url, body, silentError) if (response.success) { return true } println(response.message) - LorenzUtils.error(response.message ?: "An error occurred during the API request") + ErrorManager.logErrorStateWithData( + "An error occurred during the API request", + "unsuccessful API response", + "url" to url, + "body" to body, + "response" to response, + ) return false } @@ -158,6 +163,6 @@ object APIUtil { fun toggleApiErrorMessages() { showApiErrors = !showApiErrors - LorenzUtils.chat("Hypixel API error messages " + if (showApiErrors) "§chidden" else "§ashown") + ChatUtils.chat("Hypixel API error messages " + if (showApiErrors) "§chidden" else "§ashown") } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt new file mode 100644 index 000000000..34f42e629 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -0,0 +1,203 @@ +package at.hannibal2.skyhanni.utils + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import net.minecraft.client.Minecraft +import net.minecraft.event.ClickEvent +import net.minecraft.event.HoverEvent +import net.minecraft.util.ChatComponentText +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.LinkedList +import java.util.Queue +import kotlin.time.Duration.Companion.milliseconds + +object ChatUtils { + + // TODO log based on chat category (error, warning, debug, user error, normal) + private val log = LorenzLogger("chat/mod_sent") + var lastButtonClicked = 0L + + private const val DEBUG_PREFIX = "[SkyHanni Debug] §7" + private const val USER_ERROR_PREFIX = "§c[SkyHanni] " + private val ERROR_PREFIX by lazy { "§c[SkyHanni-${SkyHanniMod.version}] " } + private const val CHAT_PREFIX = "[SkyHanni] " + + /** + * Sends a debug message to the chat and the console. + * This is only sent if the debug feature is enabled. + * + * @param message The message to be sent + * + * @see DEBUG_PREFIX + */ + fun debug(message: String) { + if (SkyHanniMod.feature.dev.debug.enabled && internalChat(DEBUG_PREFIX + message)) { + LorenzUtils.consoleLog("[Debug] $message") + } + } + + /** + * Sends a message to the user that they did something incorrectly. + * We should tell them what to do instead as well. + * + * @param message The message to be sent + * + * @see USER_ERROR_PREFIX + */ + fun userError(message: String) { + internalChat(USER_ERROR_PREFIX + message) + } + + /** + * Sends a message to the user that an error occurred caused by something in the code. + * This should be used for errors that are not caused by the user. + * + * Why deprecate this? Even if this message is descriptive for the user and the developer, + * we don't want inconsitencies in errors, and we would need to search + * for the code line where this error gets printed any way. + * so it's better to use the stack trace still. + * + * @param message The message to be sent + * @param prefix Whether to prefix the message with the error prefix, default true + * + * @see ERROR_PREFIX + */ + @Deprecated( + "Do not send the user a non clickable non stacktrace containing error message.", + ReplaceWith("ErrorManager.logErrorStateWithData") + ) + fun error(message: String) { + println("error: '$message'") + internalChat(ERROR_PREFIX + message) + } + + /** + * Sends a message to the user + * @param message The message to be sent + * @param prefix Whether to prefix the message with the chat prefix, default true + * @param prefixColor Color that the prefix should be, default yellow (§e) + * + * @see CHAT_PREFIX + */ + fun chat(message: String, prefix: Boolean = true, prefixColor: String = "§e") { + if (prefix) { + internalChat(prefixColor + CHAT_PREFIX + message) + } else { + internalChat(message) + } + } + + private fun internalChat(message: String): Boolean { + log.log(message) + val minecraft = Minecraft.getMinecraft() + if (minecraft == null) { + LorenzUtils.consoleLog(message.removeColor()) + return false + } + + val thePlayer = minecraft.thePlayer + if (thePlayer == null) { + LorenzUtils.consoleLog(message.removeColor()) + return false + } + + thePlayer.addChatMessage(ChatComponentText(message)) + return true + } + + /** + * Sends a message to the user that they can click and run a command + * @param message The message to be sent + * @param command The command to be executed when the message is clicked + * @param prefix Whether to prefix the message with the chat prefix, default true + * @param prefixColor Color that the prefix should be, default yellow (§e) + * + * @see CHAT_PREFIX + */ + fun clickableChat(message: String, command: String, prefix: Boolean = true, prefixColor: String = "§e") { + val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" + val text = ChatComponentText(msgPrefix + message) + val fullCommand = "/" + command.removePrefix("/") + text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, fullCommand) + text.chatStyle.chatHoverEvent = + HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§eExecute $fullCommand")) + Minecraft.getMinecraft().thePlayer.addChatMessage(text) + } + + /** + * Sends a message to the user that they can click and run a command + * @param message The message to be sent + * @param hover The message to be shown when the message is hovered + * @param command The command to be executed when the message is clicked + * @param prefix Whether to prefix the message with the chat prefix, default true + * @param prefixColor Color that the prefix should be, default yellow (§e) + * + * @see CHAT_PREFIX + */ + fun hoverableChat( + message: String, + hover: List<String>, + command: String? = null, + prefix: Boolean = true, + prefixColor: String = "§e", + ) { + val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" + val text = ChatComponentText(msgPrefix + message) + text.chatStyle.chatHoverEvent = + HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText(hover.joinToString("\n"))) + + command?.let { + text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/${it.removePrefix("/")}") + } + + Minecraft.getMinecraft().thePlayer.addChatMessage(text) + } + + /** + * Sends a message to the user that they can click and run a command + * @param message The message to be sent + * @param url The url to be opened + * @param autoOpen Automatically opens the url as well as sending the clickable link message + * @param hover The message to be shown when the message is hovered + * @param prefix Whether to prefix the message with the chat prefix, default true + * @param prefixColor Color that the prefix should be, default yellow (§e) + * + * @see CHAT_PREFIX + */ + fun clickableLinkChat( + message: String, + url: String, + hover: String = "§eOpen $url", + autoOpen: Boolean = false, + prefix: Boolean = true, + prefixColor: String = "§e" + ) { + val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" + val text = ChatComponentText(msgPrefix + message) + text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.OPEN_URL, url) + text.chatStyle.chatHoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("$prefixColor$hover")) + Minecraft.getMinecraft().thePlayer.addChatMessage(text) + if (autoOpen) OSUtils.openBrowser(url) + } + + private var lastMessageSent = SimpleTimeMark.farPast() + private val sendQueue: Queue<String> = LinkedList() + + @SubscribeEvent + fun sendQueuedChatMessages(event: LorenzTickEvent) { + val player = Minecraft.getMinecraft().thePlayer + if (player == null) { + sendQueue.clear() + return + } + if (lastMessageSent.passedSince() > 300.milliseconds) { + player.sendChatMessage(sendQueue.poll() ?: return) + lastMessageSent = SimpleTimeMark.now() + } + } + + fun sendMessageToServer(message: String) { + sendQueue.add(message) + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt index 31008d9b4..b1d8eb68b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt @@ -14,6 +14,7 @@ import java.awt.datatransfer.UnsupportedFlavorException import kotlin.time.Duration.Companion.milliseconds object ClipboardUtils { + private var dispatcher = Dispatchers.IO private var lastClipboardAccessTime = SimpleTimeMark.farPast() @@ -71,4 +72,4 @@ object ClipboardUtils { } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt new file mode 100644 index 000000000..b93f17fa4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt @@ -0,0 +1,115 @@ +package at.hannibal2.skyhanni.utils + +import java.util.Collections +import java.util.WeakHashMap +import java.util.concurrent.ConcurrentLinkedQueue + +object CollectionUtils { + + fun <E> ConcurrentLinkedQueue<E>.drainTo(list: MutableCollection<E>) { + while (true) + list.add(this.poll() ?: break) + } + + // Let garbage collector handle the removal of entries in this list + fun <T> weakReferenceList(): MutableSet<T> = Collections.newSetFromMap(WeakHashMap<T, Boolean>()) + + fun <T> MutableCollection<T>.filterToMutable(predicate: (T) -> Boolean) = filterTo(mutableListOf(), predicate) + + fun <T> List<T>.indexOfFirst(vararg args: T) = args.map { indexOf(it) }.firstOrNull { it != -1 } + + infix fun <K, V> MutableMap<K, V>.put(pairs: Pair<K, V>) { + this[pairs.first] = pairs.second + } + + // Taken and modified from Skytils + @JvmStatic + fun <T> T.equalsOneOf(vararg other: T): Boolean { + for (obj in other) { + if (this == obj) return true + } + return false + } + + fun <E> List<E>.getOrNull(index: Int): E? { + return if (index in indices) { + get(index) + } else null + } + + fun <T : Any> T?.toSingletonListOrEmpty(): List<T> { + if (this == null) return emptyList() + return listOf(this) + } + + fun <K> MutableMap<K, Int>.addOrPut(key: K, number: Int): Int = + this.merge(key, number, Int::plus)!! // Never returns null since "plus" can't return null + + fun <K> MutableMap<K, Long>.addOrPut(key: K, number: Long): Long = + this.merge(key, number, Long::plus)!! // Never returns null since "plus" can't return null + + fun <K> MutableMap<K, Double>.addOrPut(key: K, number: Double): Double = + this.merge(key, number, Double::plus)!! // Never returns null since "plus" can't return null + + fun <K, N : Number> Map<K, N>.sumAllValues(): Double { + if (values.isEmpty()) return 0.0 + + return when (values.first()) { + is Double -> values.sumOf { it.toDouble() } + is Float -> values.sumOf { it.toDouble() } + is Long -> values.sumOf { it.toLong() }.toDouble() + else -> values.sumOf { it.toInt() }.toDouble() + } + } + + fun List<String>.nextAfter(after: String, skip: Int = 1) = nextAfter({ it == after }, skip) + + fun List<String>.nextAfter(after: (String) -> Boolean, skip: Int = 1): String? { + var missing = -1 + for (line in this) { + if (after(line)) { + missing = skip - 1 + continue + } + if (missing == 0) { + return line + } + if (missing != -1) { + missing-- + } + } + return null + } + + fun <K, V> Map<K, V>.editCopy(function: MutableMap<K, V>.() -> Unit) = + toMutableMap().also { function(it) }.toMap() + + fun <T> List<T>.editCopy(function: MutableList<T>.() -> Unit) = + toMutableList().also { function(it) }.toList() + + fun <K, V> Map<K, V>.moveEntryToTop(matcher: (Map.Entry<K, V>) -> Boolean): Map<K, V> { + val entry = entries.find(matcher) + if (entry != null) { + val newMap = linkedMapOf(entry.key to entry.value) + newMap.putAll(this) + return newMap + } + return this + } + + fun <E> MutableList<List<E>>.addAsSingletonList(text: E) { + add(Collections.singletonList(text)) + } + + fun <K, V : Comparable<V>> List<Pair<K, V>>.sorted(): List<Pair<K, V>> { + return sortedBy { (_, value) -> value } + } + + fun <K, V : Comparable<V>> Map<K, V>.sorted(): Map<K, V> { + return toList().sorted().toMap() + } + + fun <K, V : Comparable<V>> Map<K, V>.sortedDesc(): Map<K, V> { + return toList().sorted().reversed().toMap() + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt index 076afc0c4..8eab43636 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt @@ -1,6 +1,11 @@ package at.hannibal2.skyhanni.utils +import java.awt.Color + object ColorUtils { + + /** transfer string colors from the config to java.awt.Color */ + fun String.toChromaColor() = Color(SpecialColour.specialToChromaRGB(this), true) fun getRed(colour: Int) = colour shr 16 and 0xFF fun getGreen(colour: Int) = colour shr 8 and 0xFF @@ -8,4 +13,4 @@ object ColorUtils { fun getBlue(colour: Int) = colour and 0xFF fun getAlpha(colour: Int) = colour shr 24 and 0xFF -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt index b0af1d93e..31bfe4416 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt @@ -111,5 +111,4 @@ object CombatUtils { } return interp } - } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ConditionalUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ConditionalUtils.kt new file mode 100644 index 000000000..83a8d03f1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/ConditionalUtils.kt @@ -0,0 +1,33 @@ +package at.hannibal2.skyhanni.utils + +import io.github.moulberry.moulconfig.observer.Observer +import io.github.moulberry.moulconfig.observer.Property + +object ConditionalUtils { + + fun <T> T.transformIf(condition: T.() -> Boolean, transofmration: T.() -> T) = + if (condition()) transofmration(this) else this + + fun <T> T.conditionalTransform(condition: Boolean, ifTrue: T.() -> Any, ifFalse: T.() -> Any) = + if (condition) ifTrue(this) else ifFalse(this) + + // MoulConfig is in Java, I don't want to downgrade this logic + fun <T> onChange(vararg properties: Property<out T>, observer: Observer<T>) { + for (property in properties) { + property.whenChanged { a, b -> observer.observeChange(a, b) } + } + } + + fun <T> onToggle(vararg properties: Property<out T>, observer: Runnable) { + onChange(*properties) { _, _ -> observer.run() } + } + + fun <T> Property<out T>.onToggle(observer: Runnable) { + whenChanged { _, _ -> observer.run() } + } + + fun <T> Property<out T>.afterChange(observer: T.() -> Unit) { + whenChanged { _, new -> observer(new) } + } + +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt index 3d8fd5449..55773a9c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt @@ -39,7 +39,7 @@ object ConfigUtils { */ private fun <T> getEnumConstantFromLegacyId( legacyId: Int, - enumClass: Class<T> + enumClass: Class<T>, ): T? where T : Enum<T>, T : HasLegacyId = enumClass.getEnumConstants().firstOrNull { it.legacyId == legacyId } /** diff --git a/src/main/java/at/hannibal2/skyhanni/utils/DelayedRun.kt b/src/main/java/at/hannibal2/skyhanni/utils/DelayedRun.kt index 284946072..3c6491ac3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/DelayedRun.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/DelayedRun.kt @@ -1,10 +1,11 @@ package at.hannibal2.skyhanni.utils -import at.hannibal2.skyhanni.utils.LorenzUtils.drainTo +import at.hannibal2.skyhanni.utils.CollectionUtils.drainTo import java.util.concurrent.ConcurrentLinkedQueue import kotlin.time.Duration object DelayedRun { + private val tasks = mutableListOf<Pair<() -> Any, SimpleTimeMark>>() private val futureTasks = ConcurrentLinkedQueue<Pair<() -> Any, SimpleTimeMark>>() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt index ca4827291..fea82caf7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt @@ -32,6 +32,7 @@ import java.lang.reflect.Method * */ object EntityOutlineRenderer { + private val entityRenderCache: CachedInfo = CachedInfo(null, null, null) private var stopLookingForOptifine = false private var isMissingMixin = false @@ -400,6 +401,6 @@ object EntityOutlineRenderer { private class CachedInfo( var xrayCache: HashMap<Entity, Int>?, var noXrayCache: HashMap<Entity, Int>?, - var noOutlineCache: HashSet<Entity>? + var noOutlineCache: HashSet<Entity>?, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 36c01c64d..12a2129bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -99,13 +99,13 @@ object EntityUtils { fun EntityLivingBase.hasBossHealth(health: Int): Boolean = this.hasMaxHealth(health, true) - //TODO remove baseMaxHealth + // TODO remove baseMaxHealth fun EntityLivingBase.hasMaxHealth(health: Int, boss: Boolean = false, maxHealth: Int = baseMaxHealth): Boolean { val derpyMultiplier = if (LorenzUtils.isDerpy) 2 else 1 if (maxHealth == health * derpyMultiplier) return true if (!boss && !LorenzUtils.inDungeons) { - //Corrupted + // Corrupted if (maxHealth == health * 3 * derpyMultiplier) return true // Runic if (maxHealth == health * 4 * derpyMultiplier) return true diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt index 5e4a63452..1d0b42b92 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -91,7 +91,7 @@ object GuiRenderUtils { mouseX: Int, mouseY: Int, screenHeight: Int, - fr: FontRenderer + fr: FontRenderer, ) { if (textLines.isNotEmpty()) { val borderColor = StringUtils.getColor(textLines[0], 0x505000FF) @@ -187,7 +187,7 @@ object GuiRenderUtils { y: Int, mouseX: Int, mouseY: Int, - color: Int = 0xFF43464B.toInt() + color: Int = 0xFF43464B.toInt(), ) { GuiScreen.drawRect(x, y, x + 16, y + 16, color) if (item != null) { @@ -206,7 +206,7 @@ object GuiRenderUtils { y: Float, mouseX: Float, mouseY: Float, - color: Int = 0xFF43464B.toInt() + color: Int = 0xFF43464B.toInt(), ) { renderItemAndTip(list, item, x.toInt(), y.toInt(), mouseX.toInt(), mouseY.toInt(), color) } @@ -223,7 +223,7 @@ object GuiRenderUtils { mouseX: Int, mouseY: Int, output: MutableList<String>, - textScale: Float = .7f + textScale: Float = .7f, ) { var currentVal = currentValue.toDouble() currentVal = if (currentVal < 0) 0.0 else currentVal diff --git a/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt b/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt index 5b1399f73..64d059bd3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils class IdentityCharacteristics<T>(val value: T) { + override fun equals(other: Any?): Boolean { if (other !is IdentityCharacteristics<*>) return false return this.value === other.value diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index 827b87854..1da7170ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack import kotlin.time.Duration.Companion.seconds object InventoryUtils { + var itemInHandId = NEUInternalName.NONE var recentItemsInHand = mutableMapOf<Long, NEUInternalName>() var latestItemInHand: ItemStack? = null @@ -42,7 +43,7 @@ object InventoryUtils { fun inStorage() = openInventoryName().let { (it.contains("Storage") && !it.contains("Rift Storage")) - || it.contains("Ender Chest") || it.contains("Backpack") + || it.contains("Ender Chest") || it.contains("Backpack") } fun getItemInHand(): ItemStack? = Minecraft.getMinecraft().thePlayer.heldItem @@ -54,7 +55,6 @@ object InventoryUtils { fun getLeggings(): ItemStack? = getArmor()[1] fun getBoots(): ItemStack? = getArmor()[0] - val isNeuStorageEnabled = RecalculatingValue(10.seconds) { try { val config = NotEnoughUpdates.INSTANCE.config diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemBlink.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemBlink.kt index 8afc2a2b7..baa9a8c40 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemBlink.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemBlink.kt @@ -4,6 +4,7 @@ import net.minecraft.item.Item import net.minecraft.item.ItemStack object ItemBlink { + private val offsets = mutableMapOf<Item, Long>() private var lastOffset = 0L private var endOfBlink = 0L @@ -28,4 +29,4 @@ object ItemBlink { } return if ((offset + System.currentTimeMillis()) % 1000 > 500) stack else this } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemStackTypeAdapter.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemStackTypeAdapter.kt index 38002990f..602bffa2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemStackTypeAdapter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemStackTypeAdapter.kt @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack import net.minecraft.nbt.NBTTagCompound object ItemStackTypeAdapterFactory : TypeAdapterFactory { + override fun <T : Any> create(gson: Gson?, type: TypeToken<T>): TypeAdapter<T>? { if (type.rawType == ItemStack::class.java) { val nbtCompoundTypeAdapter = gson!!.getAdapter(NBTTagCompound::class.java) @@ -25,5 +26,4 @@ object ItemStackTypeAdapterFactory : TypeAdapterFactory { } return null } - -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index d2c9776b7..0f506bacc 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -74,7 +74,7 @@ object ItemUtils { val list: LinkedList<ItemStack> = LinkedList() val player = Minecraft.getMinecraft().thePlayer if (player == null) { - LorenzUtils.error("getItemsInInventoryWithSlots: player is null!") + ChatUtils.error("getItemsInInventoryWithSlots: player is null!") return list } for (slot in player.openContainer.inventorySlots) { @@ -93,7 +93,7 @@ object ItemUtils { val map: LinkedHashMap<ItemStack, Int> = LinkedHashMap() val player = Minecraft.getMinecraft().thePlayer if (player == null) { - LorenzUtils.error("getItemsInInventoryWithSlots: player is null!") + ChatUtils.error("getItemsInInventoryWithSlots: player is null!") return map } for (slot in player.openContainer.inventorySlots) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt b/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt index d075f35f7..5b80dc8b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt @@ -24,19 +24,17 @@ import com.google.gson.internal.`$Gson$Types` as InternalGsonTypes @Target(AnnotationTarget.CLASS) annotation class KSerializable - @Retention(AnnotationRetention.RUNTIME) @Target(AnnotationTarget.CLASS) annotation class ExtraData - class KotlinTypeAdapterFactory : TypeAdapterFactory { internal data class ParameterInfo( val param: KParameter, val adapter: TypeAdapter<Any?>, val name: String, - val field: KProperty1<Any, Any?> + val field: KProperty1<Any, Any?>, ) @OptIn(ExperimentalStdlibApi::class) @@ -110,4 +108,4 @@ class KotlinTypeAdapterFactory : TypeAdapterFactory { } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt index 335ac1202..1050c5c98 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt @@ -13,6 +13,7 @@ import org.lwjgl.input.Keyboard import org.lwjgl.input.Mouse object KeyboardManager { + private var lastClickedMouseButton = -1 // A mac-only key, represents Windows key on windows (but different key code) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index e8b0d76bc..39c877db0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -39,6 +39,7 @@ enum class LorenzColor(private val chatColorCode: Char, private val color: Color override fun toString(): String = coloredLabel companion object { + fun EnumDyeColor.toLorenzColor() = when (this) { EnumDyeColor.WHITE -> WHITE EnumDyeColor.MAGENTA -> LIGHT_PURPLE diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt index 93bd8419e..664ef5fd6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt @@ -10,7 +10,7 @@ object LorenzDebug { } fun chatAndLog(text: String) { - LorenzUtils.debug(text) + ChatUtils.debug(text) log(text) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt index e949742cd..26f56fcca 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt @@ -15,10 +15,12 @@ import java.util.logging.Logger import kotlin.time.Duration.Companion.days class LorenzLogger(filePath: String) { + private val format = SimpleDateFormat("HH:mm:ss") private val fileName = "$PREFIX_PATH$filePath.log" companion object { + private var LOG_DIRECTORY = File("config/skyhanni/logs") private var PREFIX_PATH: String var hasDone = false diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 9c4116da4..33731505f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.MayorElection import at.hannibal2.skyhanni.data.TitleManager import at.hannibal2.skyhanni.events.GuiContainerEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign import at.hannibal2.skyhanni.test.TestBingo +import at.hannibal2.skyhanni.utils.ChatUtils.lastButtonClicked +import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.capAtMinecraftLength @@ -17,44 +18,20 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID import at.hannibal2.skyhanni.utils.renderables.Renderable import com.google.gson.JsonPrimitive -import io.github.moulberry.moulconfig.observer.Observer -import io.github.moulberry.moulconfig.observer.Property import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.SharedMonsterAttributes -import net.minecraft.event.ClickEvent -import net.minecraft.event.HoverEvent import net.minecraft.launchwrapper.Launch import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.FMLCommonHandler -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color -import java.lang.reflect.Constructor -import java.lang.reflect.Field -import java.lang.reflect.Modifier import java.text.DecimalFormat import java.text.SimpleDateFormat -import java.util.Collections -import java.util.LinkedList -import java.util.Queue import java.util.Timer import java.util.TimerTask -import java.util.WeakHashMap -import java.util.concurrent.ConcurrentLinkedQueue import java.util.regex.Matcher -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KMutableProperty1 -import kotlin.reflect.KProperty -import kotlin.reflect.KProperty0 -import kotlin.reflect.KProperty1 -import kotlin.reflect.full.isSubtypeOf -import kotlin.reflect.full.memberProperties -import kotlin.reflect.full.starProjectedType -import kotlin.reflect.jvm.isAccessible import kotlin.time.Duration -import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds object LorenzUtils { @@ -90,98 +67,6 @@ object LorenzUtils { val lastWorldSwitch get() = HypixelData.joinedWorld - // TODO log based on chat category (error, warning, debug, user error, normal) - private val log = LorenzLogger("chat/mod_sent") - var lastButtonClicked = 0L - - private const val DEBUG_PREFIX = "[SkyHanni Debug] §7" - private const val USER_ERROR_PREFIX = "§c[SkyHanni] " - private val ERROR_PREFIX by lazy { "§c[SkyHanni-${SkyHanniMod.version}] " } - private const val CHAT_PREFIX = "[SkyHanni] " - - /** - * Sends a debug message to the chat and the console. - * This is only sent if the debug feature is enabled. - * - * @param message The message to be sent - * - * @see DEBUG_PREFIX - */ - fun debug(message: String) { - if (SkyHanniMod.feature.dev.debug.enabled && internalChat(DEBUG_PREFIX + message)) { - consoleLog("[Debug] $message") - } - } - - /** - * Sends a message to the user that they did something incorrectly. - * We should tell them what to do instead as well. - * - * @param message The message to be sent - * - * @see USER_ERROR_PREFIX - */ - fun userError(message: String) { - internalChat(USER_ERROR_PREFIX + message) - } - - /** - * Sends a message to the user that an error occurred caused by something in the code. - * This should be used for errors that are not caused by the user. - * - * Why deprecate this? Even if this message is descriptive for the user and the developer, - * we don't want inconsitencies in errors, and we would need to search - * for the code line where this error gets printed any way. - * so it's better to use the stack trace still. - * - * @param message The message to be sent - * @param prefix Whether to prefix the message with the error prefix, default true - * - * @see ERROR_PREFIX - */ - @Deprecated( - "Do not send the user a non clickable non stacktrace containing error message.", - ReplaceWith("ErrorManager") - ) - fun error(message: String) { - println("error: '$message'") - internalChat(ERROR_PREFIX + message) - } - - /** - * Sends a message to the user - * @param message The message to be sent - * @param prefix Whether to prefix the message with the chat prefix, default true - * @param prefixColor Color that the prefix should be, default yellow (§e) - * - * @see CHAT_PREFIX - */ - fun chat(message: String, prefix: Boolean = true, prefixColor: String = "§e") { - if (prefix) { - internalChat(prefixColor + CHAT_PREFIX + message) - } else { - internalChat(message) - } - } - - private fun internalChat(message: String): Boolean { - log.log(message) - val minecraft = Minecraft.getMinecraft() - if (minecraft == null) { - consoleLog(message.removeColor()) - return false - } - - val thePlayer = minecraft.thePlayer - if (thePlayer == null) { - consoleLog(message.removeColor()) - return false - } - - thePlayer.addChatMessage(ChatComponentText(message)) - return true - } - fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis()) fun stripVanillaMessage(originalMessage: String): String { @@ -254,18 +139,6 @@ object LorenzUtils { } } - fun <K, V : Comparable<V>> List<Pair<K, V>>.sorted(): List<Pair<K, V>> { - return sortedBy { (_, value) -> value } - } - - fun <K, V : Comparable<V>> Map<K, V>.sorted(): Map<K, V> { - return toList().sorted().toMap() - } - - fun <K, V : Comparable<V>> Map<K, V>.sortedDesc(): Map<K, V> { - return toList().sorted().reversed().toMap() - } - fun getSBMonthByName(month: String): Int { var monthNr = 0 for (i in 1..12) { @@ -283,10 +156,6 @@ object LorenzUtils { fun getPlayerName(): String = Minecraft.getMinecraft().thePlayer.name - fun <E> MutableList<List<E>>.addAsSingletonList(text: E) { - add(Collections.singletonList(text)) - } - // (key -> value) -> (sorting value -> key item icon) fun fillTable(list: MutableList<List<Any>>, data: MutableMap<Pair<String, String>, Pair<Double, NEUInternalName>>) { val keys = data.mapValues { (_, v) -> v.first }.sortedDesc().keys @@ -321,140 +190,6 @@ object LorenzUtils { lines[index] = ChatComponentText(text.capAtMinecraftLength(91)) } - /** - * Sends a message to the user that they can click and run a command - * @param message The message to be sent - * @param command The command to be executed when the message is clicked - * @param prefix Whether to prefix the message with the chat prefix, default true - * @param prefixColor Color that the prefix should be, default yellow (§e) - * - * @see CHAT_PREFIX - */ - fun clickableChat(message: String, command: String, prefix: Boolean = true, prefixColor: String = "§e") { - val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" - val text = ChatComponentText(msgPrefix + message) - val fullCommand = "/" + command.removePrefix("/") - text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, fullCommand) - text.chatStyle.chatHoverEvent = - HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§eExecute $fullCommand")) - Minecraft.getMinecraft().thePlayer.addChatMessage(text) - } - - /** - * Sends a message to the user that they can click and run a command - * @param message The message to be sent - * @param hover The message to be shown when the message is hovered - * @param command The command to be executed when the message is clicked - * @param prefix Whether to prefix the message with the chat prefix, default true - * @param prefixColor Color that the prefix should be, default yellow (§e) - * - * @see CHAT_PREFIX - */ - fun hoverableChat( - message: String, - hover: List<String>, - command: String? = null, - prefix: Boolean = true, - prefixColor: String = "§e", - ) { - val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" - val text = ChatComponentText(msgPrefix + message) - text.chatStyle.chatHoverEvent = - HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText(hover.joinToString("\n"))) - - command?.let { - text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/${it.removePrefix("/")}") - } - - Minecraft.getMinecraft().thePlayer.addChatMessage(text) - } - - /** - * Sends a message to the user that they can click and run a command - * @param message The message to be sent - * @param url The url to be opened - * @param autoOpen Automatically opens the url as well as sending the clickable link message - * @param hover The message to be shown when the message is hovered - * @param prefix Whether to prefix the message with the chat prefix, default true - * @param prefixColor Color that the prefix should be, default yellow (§e) - * - * @see CHAT_PREFIX - */ - fun clickableLinkChat( - message: String, - url: String, - hover: String = "§eOpen $url", - autoOpen: Boolean = false, - prefix: Boolean = true, - prefixColor: String = "§e" - ) { - val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" - val text = ChatComponentText(msgPrefix + message) - text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.OPEN_URL, url) - text.chatStyle.chatHoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("$prefixColor$hover")) - Minecraft.getMinecraft().thePlayer.addChatMessage(text) - if (autoOpen) OSUtils.openBrowser(url) - } - - fun <K, V> Map<K, V>.moveEntryToTop(matcher: (Map.Entry<K, V>) -> Boolean): Map<K, V> { - val entry = entries.find(matcher) - if (entry != null) { - val newMap = linkedMapOf(entry.key to entry.value) - newMap.putAll(this) - return newMap - } - return this - } - - private var lastMessageSent = SimpleTimeMark.farPast() - private val sendQueue: Queue<String> = LinkedList() - - @SubscribeEvent - fun sendQueuedChatMessages(event: LorenzTickEvent) { - val player = Minecraft.getMinecraft().thePlayer - if (player == null) { - sendQueue.clear() - return - } - if (lastMessageSent.passedSince() > 300.milliseconds) { - player.sendChatMessage(sendQueue.poll() ?: return) - lastMessageSent = SimpleTimeMark.now() - } - } - - fun sendCommandToServer(command: String) { - sendMessageToServer("/$command") - } - - fun sendMessageToServer(message: String) { - sendQueue.add(message) - } - - // MoulConfig is in Java, I don't want to downgrade this logic - fun <T> onChange(vararg properties: Property<out T>, observer: Observer<T>) { - for (property in properties) { - property.whenChanged { a, b -> observer.observeChange(a, b) } - } - } - - fun <T> onToggle(vararg properties: Property<out T>, observer: Runnable) { - onChange(*properties) { _, _ -> observer.run() } - } - - fun <T> Property<out T>.onToggle(observer: Runnable) { - whenChanged { _, _ -> observer.run() } - } - - fun <T> Property<out T>.afterChange(observer: T.() -> Unit) { - whenChanged { _, new -> observer(new) } - } - - fun <K, V> Map<K, V>.editCopy(function: MutableMap<K, V>.() -> Unit) = - toMutableMap().also { function(it) }.toMap() - - fun <T> List<T>.editCopy(function: MutableList<T>.() -> Unit) = - toMutableList().also { function(it) }.toList() - fun colorCodeToRarity(colorCode: Char): String { return when (colorCode) { 'f' -> "Common" @@ -525,61 +260,6 @@ object LorenzUtils { }) } - // TODO nea? -// fun <T> dynamic(block: () -> KMutableProperty0<T>?): ReadWriteProperty<Any?, T?> { -// return object : ReadWriteProperty<Any?, T?> { -// override fun getValue(thisRef: Any?, property: KProperty<*>): T? { -// return block()?.get() -// } -// -// override fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) { -// if (value != null) -// block()?.set(value) -// } -// } -// } - - fun <T, R> dynamic(root: KProperty0<R?>, child: KMutableProperty1<R, T>) = - object : ReadWriteProperty<Any?, T?> { - override fun getValue(thisRef: Any?, property: KProperty<*>): T? { - val rootObj = root.get() ?: return null - return child.get(rootObj) - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) { - if (value == null) return - val rootObj = root.get() ?: return - child.set(rootObj, value) - } - } - - inline fun <reified T : Any> Any.getPropertiesWithType() = - this::class.memberProperties - .filter { it.returnType.isSubtypeOf(T::class.starProjectedType) } - .map { - it.isAccessible = true - (it as KProperty1<Any, T>).get(this) - } - - fun List<String>.nextAfter(after: String, skip: Int = 1) = nextAfter({ it == after }, skip) - - fun List<String>.nextAfter(after: (String) -> Boolean, skip: Int = 1): String? { - var missing = -1 - for (line in this) { - if (after(line)) { - missing = skip - 1 - continue - } - if (missing == 0) { - return line - } - if (missing != -1) { - missing-- - } - } - return null - } - fun GuiEditSign.isRancherSign(): Boolean { if (this !is AccessorGuiEditSign) return false @@ -591,74 +271,6 @@ object LorenzUtils { fun IslandType.isInIsland() = inSkyBlock && skyBlockIsland == this - fun <K> MutableMap<K, Int>.addOrPut(key: K, number: Int): Int { - val currentValue = this[key] ?: 0 - val newValue = currentValue + number - this[key] = newValue - return newValue - } - - fun <K> MutableMap<K, Long>.addOrPut(key: K, number: Long): Long { - val currentValue = this[key] ?: 0L - val newValue = currentValue + number - this[key] = newValue - return newValue - } - - fun <K> MutableMap<K, Double>.addOrPut(key: K, number: Double): Double { - val currentValue = this[key] ?: 0.0 - val newValue = currentValue + number - this[key] = newValue - return newValue - } - - fun <K, N : Number> Map<K, N>.sumAllValues(): Double { - if (values.isEmpty()) return 0.0 - - return when (values.first()) { - is Double -> values.sumOf { it.toDouble() } - is Float -> values.sumOf { it.toDouble() } - is Long -> values.sumOf { it.toLong() }.toDouble() - else -> values.sumOf { it.toInt() }.toDouble() - } - } - - /** transfer string colors from the config to java.awt.Color */ - fun String.toChromaColor() = Color(SpecialColour.specialToChromaRGB(this), true) - - fun <E> List<E>.getOrNull(index: Int): E? { - return if (index in indices) { - get(index) - } else null - } - - fun <T : Any> T?.toSingletonListOrEmpty(): List<T> { - if (this == null) return emptyList() - return listOf(this) - } - - fun Field.makeAccessible() = also { isAccessible = true } - - fun <T> Constructor<T>.makeAccessible() = also { isAccessible = true } - - // Taken and modified from Skytils - @JvmStatic - fun <T> T.equalsOneOf(vararg other: T): Boolean { - for (obj in other) { - if (this == obj) return true - } - return false - } - - infix fun <K, V> MutableMap<K, V>.put(pairs: Pair<K, V>) { - this[pairs.first] = pairs.second - } - - fun Field.removeFinal(): Field { - javaClass.getDeclaredField("modifiers").makeAccessible().set(this, modifiers and (Modifier.FINAL.inv())) - return this - } - fun GuiContainerEvent.SlotClickEvent.makeShiftClick() = slot?.slotNumber?.let { slotNumber -> Minecraft.getMinecraft().playerController.windowClick( @@ -666,8 +278,6 @@ object LorenzUtils { )?.also { isCanceled = true } } - fun <T> List<T>.indexOfFirst(vararg args: T) = args.map { indexOf(it) }.firstOrNull { it != -1 } - private val recalculateDerpy = RecalculatingValue(1.seconds) { MayorElection.isPerkActive("Derpy", "DOUBLE MOBS HP!!!") } @@ -687,12 +297,6 @@ object LorenzUtils { val JsonPrimitive.asIntOrNull get() = takeIf { it.isNumber }?.asInt - fun <T> T.transformIf(condition: T.() -> Boolean, transofmration: T.() -> T) = - if (condition()) transofmration(this) else this - - fun <T> T.conditionalTransform(condition: Boolean, ifTrue: T.() -> Any, ifFalse: T.() -> Any) = - if (condition) ifTrue(this) else ifFalse(this) - fun sendTitle(text: String, duration: Duration, height: Double = 1.8, fontSize: Float = 4f) { TitleManager.sendTitle(text, duration, height, fontSize) } @@ -722,6 +326,10 @@ object LorenzUtils { FMLCommonHandler.instance().handleExit(-1) } + fun sendCommandToServer(command: String) { + ChatUtils.sendMessageToServer("/$command") + } + /** * Get the group, otherwise, return null * @param groupName The group name in the pattern @@ -730,16 +338,29 @@ object LorenzUtils { return runCatching { this.group(groupName) }.getOrNull() } - fun <E> ConcurrentLinkedQueue<E>.drainTo(list: MutableCollection<E>) { - while (true) - list.add(this.poll() ?: break) - } + @Deprecated("moved", ReplaceWith("ChatUtils.debug")) + fun debug(message: String) = ChatUtils.debug(message) - // Let garbage collector handle the removal of entries in this list - fun <T> weakReferenceList(): MutableSet<T> = Collections.newSetFromMap(WeakHashMap<T, Boolean>()) + @Deprecated("moved", ReplaceWith("ChatUtils.userError")) + fun userError(message: String) = ChatUtils.userError(message) - fun <T> MutableCollection<T>.filterToMutable(predicate: (T) -> Boolean) = filterTo(mutableListOf(), predicate) + @Deprecated("moved", ReplaceWith("ChatUtils.chat")) + fun chat(message: String, prefix: Boolean = true, prefixColor: String = "§e") = + ChatUtils.chat(message, prefix, prefixColor) + + @Deprecated("moved", ReplaceWith("ChatUtils.clickableChat")) + fun clickableChat(message: String, command: String, prefix: Boolean = true, prefixColor: String = "§e") = + ChatUtils.clickableChat(message, command, prefix, prefixColor) + + @Deprecated("moved", ReplaceWith("ChatUtils.hoverableChat")) + fun hoverableChat( + message: String, + hover: List<String>, + command: String? = null, + prefix: Boolean = true, + prefixColor: String = "§e", + ) = ChatUtils.hoverableChat(message, hover, command, prefix, prefixColor) - val Long.ticks get() = (this * 50).milliseconds - val Int.ticks get() = (this * 50).milliseconds + @Deprecated("moved", ReplaceWith("ChatUtils.sendMessageToServer")) + fun sendMessageToServer(message: String) = ChatUtils.sendMessageToServer(message) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index ba337b620..03f623f70 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -144,6 +144,7 @@ data class LorenzVec( } companion object { + fun getFromYawPitch(yaw: Double, pitch: Double): LorenzVec { val yaw: Double = (yaw + 90) * Math.PI / 180 val pitch: Double = (pitch + 90) * Math.PI / 180 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt index 3e1919d8b..c6ebdd836 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt @@ -24,6 +24,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { private val patternBiomeIdBounds = "Biome ID is out of bounds: (\\d+), defaulting to 0 \\(Ocean\\)".toPattern() companion object { + fun initLogging() { val ctx: LoggerContext = LogManager.getContext(false) as LoggerContext @@ -56,7 +57,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { filterConsole("Unknown soundEvent (minecraft:)") return Filter.Result.DENY } - //TODO testing + // TODO testing if (filterConfig.filterParticleVillagerHappy && formattedMessage == "Could not spawn particle effect VILLAGER_HAPPY") { filterConsole("particle VILLAGER_HAPPY") return Filter.Result.DENY @@ -83,7 +84,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { } } - //TODO find a way to load the filter earlier to filter these messages too + // TODO find a way to load the filter earlier to filter these messages too // if (loggerName == "LaunchWrapper") { // //The jar file C:\Users\Lorenz\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar has a security seal for path org.lwjgl.opengl, but that path is defined and not secure // if (formattedMessage.startsWith("The jar file ")) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftDispatcher.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftDispatcher.kt index 8771de215..7cbfffe37 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftDispatcher.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftDispatcher.kt @@ -5,6 +5,7 @@ import net.minecraft.client.Minecraft import kotlin.coroutines.CoroutineContext object MinecraftDispatcher : MainCoroutineDispatcher() { + override val immediate: MainCoroutineDispatcher get() = this @@ -15,4 +16,4 @@ object MinecraftDispatcher : MainCoroutineDispatcher() { override fun dispatch(context: CoroutineContext, block: Runnable) { Minecraft.getMinecraft().addScheduledTask(block) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt index bc3b1789e..f50a5e1dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.utils -import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpace import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson +import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpace class MultiFilter { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NBTTypeAdapter.kt b/src/main/java/at/hannibal2/skyhanni/utils/NBTTypeAdapter.kt index dd798d7bf..4e0762895 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NBTTypeAdapter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NBTTypeAdapter.kt @@ -10,6 +10,7 @@ import java.io.ByteArrayOutputStream import java.util.Base64 object NBTTypeAdapter : TypeAdapter<NBTTagCompound>() { + override fun write(out: JsonWriter, value: NBTTagCompound) { val baos = ByteArrayOutputStream() CompressedStreamTools.writeCompressed(value, baos) @@ -20,4 +21,4 @@ object NBTTypeAdapter : TypeAdapter<NBTTagCompound>() { val bais = ByteArrayInputStream(Base64.getDecoder().decode(reader.nextString())) return CompressedStreamTools.readCompressed(bais) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt index d4499ab12..26bfcc799 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils class NEUInternalName private constructor(private val internalName: String) { companion object { + private val map = mutableMapOf<String, NEUInternalName>() val NONE = "NONE".asInternalName() @@ -39,4 +40,4 @@ class NEUInternalName private constructor(private val internalName: String) { fun replace(oldValue: String, newValue: String) = internalName.replace(oldValue.uppercase(), newValue.uppercase()).asInternalName() -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index cd1838bdc..06901f239 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -35,6 +35,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.opengl.GL11 object NEUItems { + val manager: NEUManager get() = NotEnoughUpdates.INSTANCE.manager private val itemNameCache = mutableMapOf<String, NEUInternalName>() // item name -> internal name private val multiplierCache = mutableMapOf<NEUInternalName, Pair<NEUInternalName, Int>>() @@ -213,7 +214,6 @@ object NEUItems { fun isVanillaItem(item: ItemStack): Boolean = manager.auctionManager.isVanillaItem(item.getInternalName().asString()) - fun ItemStack.renderOnScreen(x: Float, y: Float, scaleMultiplier: Double = 1.0) { val item = checkBlinkItem() val isSkull = item.item === Items.skull @@ -327,7 +327,6 @@ object NEUItems { val result = Pair(internalName, 1) multiplierCache[internalName] = result return result - } @Deprecated("Do not use strings as id", ReplaceWith("getMultiplier with NEUInternalName")) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index 31062b559..639d57bd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -7,6 +7,7 @@ import kotlin.math.pow import kotlin.math.roundToInt object NumberUtil { + @JvmField val nf: NumberFormat = NumberFormat.getInstance(Locale.US) private val suffixes = TreeMap<Long, String>().apply { @@ -45,15 +46,15 @@ object NumberUtil { fun format(value: Number, preciseBillions: Boolean = false): String { @Suppress("NAME_SHADOWING") val value = value.toLong() - //Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here + // Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here if (value == Long.MIN_VALUE) return format(Long.MIN_VALUE + 1, preciseBillions) if (value < 0) return "-" + format(-value, preciseBillions) - if (value < 1000) return value.toString() //deal with small numbers + if (value < 1000) return value.toString() // deal with small numbers val (divideBy, suffix) = suffixes.floorEntry(value) - val truncated = value / (divideBy / 10) //the number part of the output times 10 + val truncated = value / (divideBy / 10) // the number part of the output times 10 val truncatedAt = if (suffix == "M") 1000 else if (suffix == "B") 1000000 else 100 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt index 1f28effae..0cb4e043e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt @@ -17,7 +17,7 @@ object OSUtils { } } else { copyToClipboard(url) - LorenzUtils.error("Web browser is not supported! Copied url to clipboard.") + ChatUtils.error("Web browser is not supported! Copied url to clipboard.") } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index c9ebdc5a6..14787a980 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson.ShortCut import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.toSingletonListOrEmpty import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LorenzUtils.toSingletonListOrEmpty import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine_nea import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox_nea @@ -22,8 +22,9 @@ class ParkourHelper( val platformSize: Double = 1.0, val detectionRange: Double = 1.0, val depth: Boolean = true, - val onEndReach: () -> Unit = {} + val onEndReach: () -> Unit = {}, ) { + private var current = -1 private var visible = false @@ -105,7 +106,6 @@ class ParkourHelper( event.drawFilledBoundingBox_nea(aabb, Color.RED, 1f) if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, depth) } - } for ((index, location) in locations.asSequence().withIndex().drop(current) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RecalculatingValue.kt b/src/main/java/at/hannibal2/skyhanni/utils/RecalculatingValue.kt index 7c734c57e..76f0c0c94 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RecalculatingValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RecalculatingValue.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils import kotlin.time.Duration class RecalculatingValue<T>(private val expireTime: Duration, val calculation: () -> T) { + private var currentValue = calculation() private var lastAccessTime = SimpleTimeMark.farPast() @@ -13,4 +14,4 @@ class RecalculatingValue<T>(private val expireTime: Duration, val calculation: ( } return currentValue } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ReflectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ReflectionUtils.kt new file mode 100644 index 000000000..2cf613b39 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/ReflectionUtils.kt @@ -0,0 +1,62 @@ +package at.hannibal2.skyhanni.utils + +import java.lang.reflect.Constructor +import java.lang.reflect.Field +import java.lang.reflect.Modifier +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KMutableProperty1 +import kotlin.reflect.KProperty +import kotlin.reflect.KProperty0 +import kotlin.reflect.KProperty1 +import kotlin.reflect.full.isSubtypeOf +import kotlin.reflect.full.memberProperties +import kotlin.reflect.full.starProjectedType +import kotlin.reflect.jvm.isAccessible + +object ReflectionUtils { + + // TODO nea? +// fun <T> dynamic(block: () -> KMutableProperty0<T>?): ReadWriteProperty<Any?, T?> { +// return object : ReadWriteProperty<Any?, T?> { +// override fun getValue(thisRef: Any?, property: KProperty<*>): T? { +// return block()?.get() +// } +// +// override fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) { +// if (value != null) +// block()?.set(value) +// } +// } +// } + + fun <T, R> dynamic(root: KProperty0<R?>, child: KMutableProperty1<R, T>) = + object : ReadWriteProperty<Any?, T?> { + override fun getValue(thisRef: Any?, property: KProperty<*>): T? { + val rootObj = root.get() ?: return null + return child.get(rootObj) + } + + override fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) { + if (value == null) return + val rootObj = root.get() ?: return + child.set(rootObj, value) + } + } + + inline fun <reified T : Any> Any.getPropertiesWithType() = + this::class.memberProperties + .filter { it.returnType.isSubtypeOf(T::class.starProjectedType) } + .map { + it.isAccessible = true + (it as KProperty1<Any, T>).get(this) + } + + fun Field.makeAccessible() = also { isAccessible = true } + + fun <T> Constructor<T>.makeAccessible() = also { isAccessible = true } + + fun Field.removeFinal(): Field { + javaClass.getDeclaredField("modifiers").makeAccessible().set(this, modifiers and (Modifier.FINAL.inv())) + return this + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index c85937309..7c26c03e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -309,7 +309,7 @@ object RenderUtils { val z = pos.z - player.lastTickPosZ + (pos.z - player.posZ - (pos.z - player.lastTickPosZ)) * partialTicks - //7 – 25 + // 7 – 25 val translate = LorenzVec(x, y, z) val length = translate.length().toFloat() @@ -467,7 +467,7 @@ object RenderUtils { } } e.printStackTrace() - LorenzUtils.debug("NPE in renderStringsAndItems!") + ChatUtils.debug("NPE in renderStringsAndItems!") } GuiEditManager.add(this, posLabel, longestX, offsetY) } @@ -665,7 +665,7 @@ object RenderUtils { val distToPlayerSq = (x - renderOffsetX) * (x - renderOffsetX) + (y - (renderOffsetY + eyeHeight)) * (y - (renderOffsetY + eyeHeight)) + (z - renderOffsetZ) * (z - renderOffsetZ) var distToPlayer = sqrt(distToPlayerSq) - //TODO this is optional maybe? + // TODO this is optional maybe? distToPlayer = distToPlayer.coerceAtLeast(smallestDistanceVew) if (distToPlayer < hideTooCloseAt) return @@ -799,7 +799,7 @@ object RenderUtils { val worldRenderer = tessellator.worldRenderer GlStateManager.color(c.red / 255f, c.green / 255f, c.blue / 255f, c.alpha / 255f * alphaMultiplier) - //vertical + // vertical worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION) worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex() worldRenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex() @@ -819,7 +819,7 @@ object RenderUtils { c.alpha / 255f * alphaMultiplier ) - //x + // x worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION) worldRenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex() worldRenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex() @@ -838,7 +838,7 @@ object RenderUtils { c.blue / 255f * 0.9f, c.alpha / 255f * alphaMultiplier ) - //z + // z worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION) worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex() worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex() @@ -865,7 +865,7 @@ object RenderUtils { * If set to `false`, will be relativized to [RenderUtils.getViewerPos]. */ renderRelativeToCamera: Boolean = false, - drawVerticalBarriers: Boolean = true + drawVerticalBarriers: Boolean = true, ) { drawFilledBoundingBox_nea(aabb, c, alphaMultiplier, renderRelativeToCamera, drawVerticalBarriers, partialTicks) } @@ -965,7 +965,7 @@ object RenderUtils { val tessellator = Tessellator.getInstance() val worldRenderer = tessellator.worldRenderer - //vertical + // vertical if (drawVerticalBarriers) { GlStateManager.color(c.red / 255f, c.green / 255f, c.blue / 255f, c.alpha / 255f * alphaMultiplier) worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION) @@ -990,7 +990,7 @@ object RenderUtils { c.alpha / 255f * alphaMultiplier ) - //x + // x worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION) with(effectiveAABB) { worldRenderer.pos(minX, minY, maxZ).endVertex() @@ -1011,7 +1011,7 @@ object RenderUtils { c.blue / 255f * 0.9f, c.alpha / 255f * alphaMultiplier ) - //z + // z worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION) with(effectiveAABB) { worldRenderer.pos(minX, maxY, minZ).endVertex() @@ -1035,7 +1035,7 @@ object RenderUtils { boundingBox: AxisAlignedBB, lineWidth: Int, colour: Color, - depth: Boolean + depth: Boolean, ) { val cornerOne = LorenzVec(boundingBox.minX, boundingBox.maxY, boundingBox.minZ) val cornerTwo = LorenzVec(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ) @@ -1049,7 +1049,7 @@ object RenderUtils { // TODO nea please merge with 'draw3DLine' fun LorenzRenderWorldEvent.draw3DLine_nea( - p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean + p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean, ) { GlStateManager.disableDepth() GlStateManager.disableCull() @@ -1094,7 +1094,7 @@ object RenderUtils { offset: Float = 0f, saturation: Float = 1F, brightness: Float = 0.8F, - timeOverride: Long = System.currentTimeMillis() + timeOverride: Long = System.currentTimeMillis(), ): Color { return Color( Color.HSBtoRGB( @@ -1109,7 +1109,7 @@ object RenderUtils { xPos: Int, yPos: Int, text: String, - scale: Float + scale: Float, ) { val fontRenderer = Minecraft.getMinecraft().fontRendererObj diff --git a/src/main/java/at/hannibal2/skyhanni/utils/Season.kt b/src/main/java/at/hannibal2/skyhanni/utils/Season.kt index ef139c15c..33dd9a221 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/Season.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/Season.kt @@ -23,7 +23,7 @@ enum class Season( fun getCurrentSeason(): Season? = getSeasonByName(SkyBlockTime.now().monthName) - private fun getSeasonByName(name: String): Season? = seasonPattern.matchMatcher(name) { entries.find { it.season.endsWith(group("season")) } } + private fun getSeasonByName(name: String): Season? = + seasonPattern.matchMatcher(name) { entries.find { it.season.endsWith(group("season")) } } } - } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt b/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt index 66629d11d..728a9f4ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt @@ -36,6 +36,7 @@ value class SimpleTimeMark(private val millis: Long) : Comparable<SimpleTimeMark fun toSkyBlockTime() = SkyBlockTime.fromInstant(Instant.ofEpochMilli(millis)) companion object { + fun now() = SimpleTimeMark(System.currentTimeMillis()) fun farPast() = SimpleTimeMark(0) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index d485e2c99..e4bc8b074 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -15,6 +15,7 @@ import net.minecraft.util.ResourceLocation import java.util.Locale object SkyBlockItemModifierUtils { + private val drillPartTypes = listOf("drill_part_upgrade_module", "drill_part_engine", "drill_part_fuel_tank") fun ItemStack.getHotPotatoCount() = getAttributeInt("hot_potato_count") @@ -225,7 +226,7 @@ object SkyBlockItemModifierUtils { val quality = GemstoneQuality.getByName(value) if (quality == null) { - LorenzUtils.debug("Gemstone quality is null for item $name: ('$key' = '$value')") + ChatUtils.debug("Gemstone quality is null for item $name: ('$key' = '$value')") continue } if (type != null) { @@ -234,7 +235,7 @@ object SkyBlockItemModifierUtils { val newKey = gemstones.getString(key + "_gem") val newType = GemstoneType.getByName(newKey) if (newType == null) { - LorenzUtils.debug("Gemstone type is null for item $name: ('$newKey' with '$key' = '$value')") + ChatUtils.debug("Gemstone type is null for item $name: ('$newKey' with '$key' = '$value')") continue } list.add(GemstoneSlot(newType, quality)) @@ -260,6 +261,7 @@ object SkyBlockItemModifierUtils { fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes") class GemstoneSlot(val type: GemstoneType, val quality: GemstoneQuality) { + fun getInternalName() = "${quality}_${type}_GEM".asInternalName() } @@ -272,6 +274,7 @@ object SkyBlockItemModifierUtils { ; companion object { + fun getByName(name: String) = entries.firstOrNull { it.name == name } } } @@ -288,6 +291,7 @@ object SkyBlockItemModifierUtils { ; companion object { + fun getByName(name: String) = entries.firstOrNull { it.name == name } } } @@ -309,6 +313,7 @@ object SkyBlockItemModifierUtils { ; companion object { + fun getColorCode(name: String) = entries.stream().filter { name.uppercase(Locale.ENGLISH).contains(it.name) }.findFirst().get().colorCode diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt index c9892a9bf..42ca4ee00 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt @@ -7,6 +7,7 @@ import net.minecraft.client.audio.SoundCategory import net.minecraft.util.ResourceLocation object SoundUtils { + private val beepSound by lazy { createSound("random.orb", 1f) } private val clickSound by lazy { createSound("gui.button.press", 1f) } private val errorSound by lazy { createSound("mob.endermen.portal", 0f) } @@ -58,7 +59,7 @@ object SoundUtils { fun command(args: Array<String>) { if (args.isEmpty()) { - LorenzUtils.userError("Specify a sound effect to test") + ChatUtils.userError("Specify a sound effect to test") return } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 11b843b64..10c2eebfd 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -16,6 +16,7 @@ import java.util.regex.Matcher import java.util.regex.Pattern object StringUtils { + // TODO USE SH-REPO private val playerChatPattern = "(?<important>.*?)(?:§[f7r])*: .*".toPattern() private val chatUsernamePattern = diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index fe07509be..4fd442c09 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.mixins.hooks.tabListGuard import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay -import at.hannibal2.skyhanni.utils.LorenzUtils.conditionalTransform -import at.hannibal2.skyhanni.utils.LorenzUtils.transformIf +import at.hannibal2.skyhanni.utils.ConditionalUtils.conditionalTransform +import at.hannibal2.skyhanni.utils.ConditionalUtils.transformIf import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.common.collect.ComparisonChain import com.google.common.collect.Ordering @@ -21,6 +21,7 @@ import net.minecraftforge.fml.relauncher.SideOnly class TabListData { companion object { + private var cache = emptyList<String>() private var debugCache: List<String>? = null @@ -29,20 +30,20 @@ class TabListData { fun toggleDebugCommand() { if (debugCache != null) { - LorenzUtils.chat("Disabled tab list debug.") + ChatUtils.chat("Disabled tab list debug.") debugCache = null return } SkyHanniMod.coroutineScope.launch { val clipboard = OSUtils.readFromClipboard() ?: return@launch debugCache = clipboard.lines() - LorenzUtils.chat("Enabled tab list debug with your clipboard.") + ChatUtils.chat("Enabled tab list debug with your clipboard.") } } fun copyCommand(args: Array<String>) { if (debugCache != null) { - LorenzUtils.clickableChat("Tab list debug is enabled!", "shdebugtablist") + ChatUtils.clickableChat("Tab list debug is enabled!", "shdebugtablist") return } @@ -53,11 +54,13 @@ class TabListData { if (tabListLine != "") resultList.add("'$tabListLine'") } val tabList = Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay - val tabHeader = tabList.header_skyhanni.conditionalTransform(noColor, { unformattedText }, { formattedText }) - val tabFooter = tabList.footer_skyhanni.conditionalTransform(noColor, { unformattedText }, { formattedText }) + val tabHeader = + tabList.header_skyhanni.conditionalTransform(noColor, { unformattedText }, { formattedText }) + val tabFooter = + tabList.footer_skyhanni.conditionalTransform(noColor, { unformattedText }, { formattedText }) val string = "Header:\n\n$tabHeader\n\nBody:\n\n${resultList.joinToString("\n")}\n\nFooter:\n\n$tabFooter" OSUtils.copyToClipboard(string) - LorenzUtils.chat("Tab list copied into the clipboard!") + ChatUtils.chat("Tab list copied into the clipboard!") } } @@ -65,6 +68,7 @@ class TabListData { @SideOnly(Side.CLIENT) internal class PlayerComparator : Comparator<NetworkPlayerInfo> { + override fun compare(o1: NetworkPlayerInfo, o2: NetworkPlayerInfo): Int { val team1 = o1.playerTeam val team2 = o2.playerTeam diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeMark.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeMark.kt index 83285550d..be5f59322 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeMark.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeMark.kt @@ -3,14 +3,14 @@ package at.hannibal2.skyhanni.utils import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds - data class TimeMark(val long: Long) { fun hasNeverHappened() = long == 0L fun passedTime() = if (long == 0L) Duration.Companion.INFINITE else (System.currentTimeMillis() - long).milliseconds companion object { + fun never() = TimeMark(0) fun now() = TimeMark(System.currentTimeMillis()) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index e8175cb6d..43af202a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -6,12 +6,14 @@ import io.github.moulberry.notenoughupdates.util.SkyBlockTime import java.time.LocalDate import java.time.ZoneId import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit import kotlin.time.toDuration object TimeUtils { + private val pattern = "(?:(?<y>\\d+) ?y(?:\\w* ?)?)?(?:(?<d>\\d+) ?d(?:\\w* ?)?)?(?:(?<h>\\d+) ?h(?:\\w* ?)?)?(?:(?<m>\\d+) ?m(?:\\w* ?)?)?(?:(?<s>\\d+) ?s(?:\\w* ?)?)?".toPattern() @@ -19,7 +21,7 @@ object TimeUtils { biggestUnit: TimeUnit = TimeUnit.YEAR, showMilliSeconds: Boolean = false, longName: Boolean = false, - maxUnits: Int = -1 + maxUnits: Int = -1, ): String = formatDuration( inWholeMilliseconds - 999, biggestUnit, showMilliSeconds, longName, maxUnits ) @@ -37,7 +39,7 @@ object TimeUtils { biggestUnit: TimeUnit = TimeUnit.YEAR, showMilliSeconds: Boolean = false, longName: Boolean = false, - maxUnits: Int = -1 + maxUnits: Int = -1, ): String { // TODO: if this weird offset gets removed, also remove that subtraction from formatDuration(kotlin.time.Duration) var milliseconds = millis + 999 @@ -143,6 +145,9 @@ object TimeUtils { } fun getCurrentLocalDate(): LocalDate = LocalDate.now(ZoneId.of("UTC")) + + val Long.ticks get() = (this * 50).milliseconds + val Int.ticks get() = (this * 50).milliseconds } private const val FACTOR_SECONDS = 1000L diff --git a/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt b/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt index 2a6d1f5ab..60f13a089 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/Timer.kt @@ -10,7 +10,7 @@ class Timer( @Expose private var started: SimpleTimeMark = SimpleTimeMark.now(), - startPaused: Boolean = false + startPaused: Boolean = false, ) : Comparable<Timer> { @Expose @@ -39,5 +39,4 @@ class Timer( } override fun compareTo(other: Timer): Int = remaining.compareTo(other.remaining) - } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt index b381ddf1c..014a1ad54 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt @@ -18,7 +18,9 @@ object UtilsPatterns { **/ val rarityLoreLinePattern by patternGroup.pattern( "item.lore.rarity.line", - "^(?:§.){2,3}(?:.§. (?:§.){4})?(?:SHINY )?(?<rarity>${enumJoinToPattern<LorenzRarity> { it.name.replace("_", " ") }}) ?(?:DUNGEON )?(?<itemCategory>[^§]*)(?: (?:§.){3}.)?$" + "^(?:§.){2,3}(?:.§. (?:§.){4})?(?:SHINY )?(?<rarity>" + + enumJoinToPattern<LorenzRarity> { it.name.replace("_", " ") } + + ") ?(?:DUNGEON )?(?<itemCategory>[^§]*)(?: (?:§.){3}.)?$" ) val abiPhonePattern by patternGroup.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt index 9cb7457ff..ec39dc7af 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt @@ -16,7 +16,7 @@ object RenderLineTooltips { fun drawHoveringText( posX: Int, posY: Int, tips: List<String?>, stack: ItemStack? = null, mouseX: Int = Utils.getMouseX(), - mouseY: Int = Utils.getMouseY() + mouseY: Int = Utils.getMouseY(), ) { if (tips.isNotEmpty()) { var textLines = tips @@ -198,7 +198,7 @@ object RenderLineTooltips { right: Int, bottom: Int, startColor: Int, - endColor: Int + endColor: Int, ) { val startAlpha = (startColor shr 24 and 255).toFloat() / 255.0f val startRed = (startColor shr 16 and 255).toFloat() / 255.0f diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt index 68b29e2fc..933b61d38 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt @@ -18,6 +18,7 @@ import java.util.Collections import kotlin.math.max interface Renderable { + val width: Int val height: Int @@ -35,6 +36,7 @@ interface Renderable { fun render(posX: Int, posY: Int) companion object { + val logger = LorenzLogger("debug/renderable") val list = mutableMapOf<Pair<Int, Int>, List<Int>>() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt index 6af2cf2fe..715c907e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt @@ -42,6 +42,7 @@ import kotlin.reflect.KProperty * of slightly more options. */ interface RepoPattern : ReadOnlyProperty<Any?, Pattern> { + /** * Check whether [value] has been loaded remotely or from the fallback value at [defaultPattern]. In case this is * accessed off-thread there are no guarantees for the correctness of this value in relation to any specific call @@ -78,8 +79,8 @@ interface RepoPattern : ReadOnlyProperty<Any?, Pattern> { return value } - companion object { + /** * Obtain a reference to a [Pattern] backed by either a local regex, or a remote regex. * Check the documentation of [RepoPattern] for more information. diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGroup.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGroup.kt index 326f447d5..1b00e4d83 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGroup.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGroup.kt @@ -6,6 +6,7 @@ import org.intellij.lang.annotations.Language * A utility class for allowing easier definitions of [RepoPattern]s with a common prefix. */ class RepoPatternGroup internal constructor(val prefix: String) { + init { RepoPatternManager.verifyKeyShape(prefix) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt index 2a2393686..efc41bffa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternGui.kt @@ -12,7 +12,9 @@ import io.github.moulberry.moulconfig.xml.XMLUniverse * Gui for analyzing [RepoPattern]s */ class RepoPatternGui private constructor() { + companion object { + /** * Open the [RepoPatternGui] */ @@ -34,10 +36,10 @@ class RepoPatternGui private constructor() { .map { RepoPatternInfo(it) } private var searchCache = ObservableList(mutableListOf<RepoPatternInfo>()) - class RepoPatternInfo( - repoPatternImpl: RepoPatternImpl + repoPatternImpl: RepoPatternImpl, ) { + @field:Bind val key: String = repoPatternImpl.key diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternImpl.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternImpl.kt index 89e9f99ec..1116bbf76 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternImpl.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternImpl.kt @@ -10,6 +10,7 @@ class RepoPatternImpl( override val defaultPattern: String, override val key: String, ) : RepoPattern { + var compiledPattern: Pattern = Pattern.compile(defaultPattern) var wasLoadedRemotely = false override var wasOverridden = false @@ -37,7 +38,6 @@ class RepoPatternImpl( RepoPatternManager.checkExclusivity(owner, key) } - override val value: Pattern get() { return compiledPattern diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt index a0bc09da7..3e32cbcb9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzEvent import at.hannibal2.skyhanni.events.PreInitFinishedEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.StringUtils.matches import net.minecraft.launchwrapper.Launch import net.minecraftforge.fml.common.FMLCommonHandler @@ -19,6 +19,7 @@ import java.util.regex.PatternSyntaxException * Manages [RepoPattern]s. */ object RepoPatternManager { + val allPatterns: Collection<RepoPatternImpl> get() = usedKeys.values /** @@ -77,7 +78,6 @@ object RepoPatternManager { reloadPatterns() } - @SubscribeEvent fun onConfigInit(event: ConfigLoadEvent) { config.forceLocal.afterChange { reloadPatterns() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderHelper.kt index 2576b4248..6f24d0e89 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderHelper.kt @@ -17,7 +17,9 @@ import org.lwjgl.opengl.GLContext * Credit: [ShaderHelper.java](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/shader/ShaderHelper.java) */ class ShaderHelper { + companion object { + private var SHADERS_SUPPORTED: Boolean private var USING_ARB_SHADERS: Boolean diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt index 3dbec3c6e..6df5c92f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/ShaderManager.kt @@ -18,9 +18,11 @@ object ShaderManager { * in the when expression */ enum class Shaders(val shader: Shader) { + CHROMA(ChromaShader.INSTANCE); companion object { + fun getShaderInstance(shaderName: String): Shader? = when (shaderName) { "chroma" -> CHROMA.shader else -> { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt index d57398ea4..c9602d423 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.utils.shader -import java.util.* +import java.util.Objects import java.util.function.Supplier /** @@ -14,11 +14,12 @@ class Uniform<T>( shader: Shader, private val uniformType: UniformType<T>, val name: String, - private val uniformValuesSupplier: Supplier<T> + private val uniformValuesSupplier: Supplier<T>, ) { class UniformType<T> { companion object { + val FLOAT: UniformType<Float> = UniformType() val VEC3: UniformType<FloatArray> = UniformType() val BOOL: UniformType<Boolean> = UniformType() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt index 7aa2cf4f9..8aeec5f32 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt @@ -36,6 +36,7 @@ abstract class ItemTrackerData : TrackerData() { var items: MutableMap<NEUInternalName, TrackedItem> = HashMap() class TrackedItem { + @Expose var internalName: NEUInternalName? = null diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt index b831ade3f..ce10ecbee 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt @@ -5,12 +5,13 @@ import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.test.PriceSource +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.ItemUtils.getNameWithEnchantment 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.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil @@ -27,6 +28,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( ) : SkyHanniTracker<Data>(name, createNewSession, getStorage, drawDisplay) { companion object { + val SKYBLOCK_COIN by lazy { "SKYBLOCK_COIN".asInternalName() } } @@ -47,7 +49,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( val (itemName, price) = SlayerAPI.getItemNameAndPrice(internalName, amount) if (config.warnings.chat && price >= config.warnings.minimumChat) { - LorenzUtils.chat("§a+Tracker Drop§7: §r$itemName") + ChatUtils.chat("§a+Tracker Drop§7: §r$itemName") } if (config.warnings.title && price >= config.warnings.minimumTitle) { LorenzUtils.sendTitle("§a+ $itemName", 5.seconds) @@ -71,7 +73,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( fun drawItems( data: Data, filter: (NEUInternalName) -> Boolean, - lists: MutableList<List<Any>> + lists: MutableList<List<Any>>, ): Double { var profit = 0.0 val items = mutableMapOf<Renderable, Long>() @@ -106,7 +108,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( if (System.currentTimeMillis() > lastClickDelay + 150) { if (KeyboardManager.isModifierKeyDown()) { data.items.remove(internalName) - LorenzUtils.chat("Removed $cleanName §efrom $name.") + ChatUtils.chat("Removed $cleanName §efrom $name.") lastClickDelay = System.currentTimeMillis() + 500 } else { modify { @@ -152,7 +154,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( item: ItemTrackerData.TrackedItem, hidden: Boolean, newDrop: Boolean, - internalName: NEUInternalName + internalName: NEUInternalName, ) = buildList { if (internalName == SKYBLOCK_COIN) { addAll(data.getCoinDescription(item)) @@ -185,5 +187,4 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( val text = "§eTotal Profit: $profitPrefix$profitFormat coins" return Renderable.hoverTips(text, tips) } - } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index 4a78641ef..b4f7bfef0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -8,8 +8,9 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.TrackerManager import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData 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.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull @@ -26,6 +27,7 @@ open class SkyHanniTracker<Data : TrackerData>( private val getStorage: (Storage.ProfileSpecific) -> Data, private val drawDisplay: (Data) -> List<List<Any>>, ) { + private var inventoryOpen = false private var displayMode: DisplayMode? = null private val currentSessions = mutableMapOf<Storage.ProfileSpecific, Data>() @@ -34,6 +36,7 @@ open class SkyHanniTracker<Data : TrackerData>( private var dirty = false companion object { + val config get() = SkyHanniMod.feature.misc.tracker private val storedTrackers get() = SkyHanniMod.feature.storage.trackerDisplayModes @@ -53,7 +56,7 @@ open class SkyHanniTracker<Data : TrackerData>( return } - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Are you sure you want to reset your total $name? Click here to confirm.", "$command confirm" ) @@ -145,7 +148,7 @@ open class SkyHanniTracker<Data : TrackerData>( private fun reset(displayMode: DisplayMode, message: String) { getSharedTracker()?.let { it.get(displayMode).reset() - LorenzUtils.chat(message) + ChatUtils.chat(message) update() } } @@ -163,6 +166,7 @@ open class SkyHanniTracker<Data : TrackerData>( } class SharedTracker<Data : TrackerData>(private val total: Data, private val currentSession: Data) { + fun modify(modifyFunction: (Data) -> Unit) { modifyFunction(total) modifyFunction(currentSession) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/TrackerData.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/TrackerData.kt index 3c4a8bbd0..24f417850 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/TrackerData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/TrackerData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.utils.tracker abstract class TrackerData { + abstract fun reset() } diff --git a/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt b/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt index ec385d0da..6bb7a77f9 100644 --- a/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt +++ b/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.test -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import net.minecraft.block.Block import net.minecraft.block.BlockFire import net.minecraft.init.Bootstrap @@ -13,6 +13,7 @@ import java.util.concurrent.locks.ReentrantLock class BootstrapHook : BeforeAllCallback, Extension { companion object { + private val LOCK: Lock = ReentrantLock() private var bootstrapped = false } @@ -32,4 +33,4 @@ class BootstrapHook : BeforeAllCallback, Extension { LOCK.unlock() } } -}
\ No newline at end of file +} |