From 362e3efddab52c954a46766e217d6b4faba5332e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 1 Jan 2023 17:30:29 +0100 Subject: 0.13.1 color fix --- CHANGELOG.md | 5 +++++ build.gradle.kts | 2 +- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 +- .../java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ff538037..7e3818601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # SkyHanni - Change Log +## Version 0.13.1 + +### Fixes ++ Dungeon level color fixed wrong colors. + ## Version 0.13 ### Features diff --git a/build.gradle.kts b/build.gradle.kts index ad8158481..398adb850 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.13" +version = "0.13.1" // Toolchains: java { diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index eccfc78c9..fa5cc233f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -62,7 +62,7 @@ import java.util.List; public class SkyHanniMod { public static final String MODID = "skyhanni"; - public static final String VERSION = "0.13"; + public static final String VERSION = "0.13.1"; public static Features feature; diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt index 796f93ef4..740296f47 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt @@ -45,7 +45,7 @@ class DungeonLevelColor { if (level >= 50) return "§c§l" if (level >= 45) return "§c" if (level >= 40) return "§d" - if (level >= 35) return "§b" + if (level >= 35) return "§6" if (level >= 30) return "§5" if (level >= 25) return "§9" if (level >= 20) return "§a" -- cgit From 139a55b1c40ba5fa7eeae352cdde5034516a150d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:12:44 +0100 Subject: debug command logic and console filter changes --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 -- .../at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt | 2 +- .../hannibal2/skyhanni/test/command/CopyItemCommand.kt | 1 - src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt | 9 ++++++++- .../java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 17 ++++++++++++----- .../hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt | 10 +++++++--- 6 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index fa5cc233f..a88ef4696 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -186,11 +186,9 @@ public class SkyHanniMod { private void registerEvent(Object object) { listenerClasses.add(object); String simpleName = object.getClass().getSimpleName(); - consoleLog("SkyHanni registering '" + simpleName + "'"); long start = System.currentTimeMillis(); MinecraftForge.EVENT_BUS.register(object); long duration = System.currentTimeMillis() - start; - consoleLog("Done after " + duration + " ms!"); } public static GuiScreen screenToOpen = null; 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 c2c8bcb18..857305c27 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack class BazaarApi { companion object { - private val bazaarMap = mutableMapOf() + val bazaarMap = mutableMapOf() fun isBazaarInventory(inventoryName: String): Boolean { if (inventoryName.contains(" ➜ ") && !inventoryName.contains("Museum")) return true 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 5395dbf36..92275ed69 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -38,7 +38,6 @@ object CopyItemCommand { val string = resultList.joinToString("\n") OSUtils.copyToClipboard(string) - LorenzUtils.debug("item info printed!") LorenzUtils.chat("§e[SkyHanni] item info copied into the clipboard!") } catch (_: Throwable) { LorenzUtils.chat("§c[SkyHanni] No item in hand!") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt index 5584da0fe..908d8b810 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod import com.google.gson.JsonObject import com.google.gson.JsonParser +import com.google.gson.stream.MalformedJsonException import org.apache.http.client.config.RequestConfig import org.apache.http.client.methods.HttpGet import org.apache.http.impl.client.HttpClientBuilder @@ -40,7 +41,13 @@ object APIUtil { val entity = response.entity if (entity != null) { val retSrc = EntityUtils.toString(entity) - return parser.parse(retSrc) as JsonObject + try { + return parser.parse(retSrc) as JsonObject + } catch (e: MalformedJsonException) { + LorenzUtils.error("MalformedJsonException!") + println("MalformedJsonException at '$urlString'") + e.printStackTrace() + } } } } catch (throwable: Throwable) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index c4c9cedca..e37aedbc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -33,11 +33,17 @@ object LorenzUtils { val inKuudraFight: Boolean get() = skyBlockIsland == "Instanced" - const val DEBUG_PREFIX = "[Debug] §7" + const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private val log = LorenzLogger("chat/mod_sent") fun debug(message: String) { - internalChat(DEBUG_PREFIX + message) + if (SkyHanniMod.feature.dev.debugEnabled) { + if (internalChat(DEBUG_PREFIX + message)) { + consoleLog("[Debug] $message") + } + } else { + consoleLog("[Debug] $message") + } } fun warning(message: String) { @@ -52,21 +58,22 @@ object LorenzUtils { internalChat(message) } - private fun internalChat(message: String) { + private fun internalChat(message: String): Boolean { log.log(message) val minecraft = Minecraft.getMinecraft() if (minecraft == null) { consoleLog(message.removeColor()) - return + return false } val thePlayer = minecraft.thePlayer if (thePlayer == null) { consoleLog(message.removeColor()) - return + return false } thePlayer.addChatMessage(ChatComponentText(message)) + return true } //TODO move into StringUtils diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt index c0e64c7be..9882f8578 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt @@ -130,15 +130,19 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { if (cause.stackTrace.isNotEmpty()) { val first = cause.stackTrace[0] if (SkyHanniMod.feature.dev.filterScoreboardErrors) { - if (first.toString() == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:229)") { + val firstName = first.toString() + if (firstName == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:229)" || + firstName == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:262)" + ) { filterConsole("NullPointerException at Scoreboard.removeTeam") return Filter.Result.DENY } - if (first.toString() == "net.minecraft.scoreboard.Scoreboard.createTeam(Scoreboard.java:218)") { + if (firstName == "net.minecraft.scoreboard.Scoreboard.createTeam(Scoreboard.java:218)") { filterConsole("IllegalArgumentException at Scoreboard.createTeam") return Filter.Result.DENY } - if (first.toString() == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:179)") { + if (firstName == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:179)" || + firstName == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:198)") { filterConsole("IllegalArgumentException at Scoreboard.removeObjective") return Filter.Result.DENY } -- cgit From cab4689a096a1c150de3106e2089eb4d6c54b45b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:26:46 +0100 Subject: Added /shtrackcollection. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 + .../at/hannibal2/skyhanni/config/Features.java | 5 + .../hannibal2/skyhanni/config/commands/Commands.kt | 2 + .../hannibal2/skyhanni/config/features/Misc.java | 5 + .../skyhanni/features/CollectionCounter.kt | 155 +++++++++++++++++++++ 5 files changed, 168 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index a88ef4696..ba48a5103 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -163,6 +163,7 @@ public class SkyHanniMod { registerEvent(new GriffinBurrowHelper()); registerEvent(new GriffinBurrowParticleFinder()); registerEvent(new BurrowWarpHelper()); + registerEvent(new CollectionCounter()); registerEvent(new HighlightBonzoMasks()); registerEvent(new DungeonLevelColor()); registerEvent(new BazaarCancelledBuyOrderClipboard()); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 0f7f0fd6c..976a0d9da 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -37,6 +37,11 @@ public class Features extends Config { return; } + if (runnableId.equals("collectionCounter")) { + editOverlay(activeConfigCategory, 200, 16, misc.collectionCounterPos); + return; + } + if (runnableId.equals("debugPos")) { editOverlay(activeConfigCategory, 200, 16, dev.debugPos); return; 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 5d94d850c..e51f9d92c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigEditor import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnable import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper +import at.hannibal2.skyhanni.features.CollectionCounter import at.hannibal2.skyhanni.features.MarkedPlayerManager import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.test.LorenzTest @@ -37,6 +38,7 @@ object Commands { registerCommand("togglepacketlog") { LorenzTest.togglePacketLog() } registerCommand("shreloadlisteners") { LorenzTest.reloadListeners() } registerCommand("shresetburrowwarps") { BurrowWarpHelper.resetDisabledWarps() } + registerCommand("shtrackcollection") { CollectionCounter.command(it) } } private fun registerCommand(name: String, function: (Array) -> Unit) { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 5420aec36..a47b7979e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -134,4 +134,9 @@ public class Misc { @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") @ConfigEditorBoolean public boolean configButtonOnPause = true; + + @Expose + @ConfigOption(name = "Collection Counter Position", desc = "Tracking the number of items you collect. §cDoes not work with sacks.") + @ConfigEditorButton(runnableId = "collectionCounter", buttonText = "Edit") + public Position collectionCounterPos = new Position(10, 10, false, true); } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt new file mode 100644 index 000000000..4124762b8 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt @@ -0,0 +1,155 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent +import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.bazaar.BazaarData +import at.hannibal2.skyhanni.test.GriffinJavaUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import net.minecraft.client.Minecraft +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class CollectionCounter { + + companion object { + + private var textToRender = "" + private var itemName = "" + private var itemApiName = "" + private var itemAmount = -1 + + private var lastAmountInInventory = -1 + + private val apiCollectionData = mutableMapOf() + + fun command(args: Array) { + if (args.isEmpty()) { + if (itemName == "") { + LorenzUtils.chat("§c/shtrackcollection ") + return + } + LorenzUtils.chat("§e[SkyHanni] Disabled collection tracking for $itemName") + apiCollectionData[itemApiName] = itemAmount + resetData() + return + } + + var name = args.joinToString(" ") + + var data: BazaarData? = null + for (bazaarData in BazaarApi.bazaarMap.values) { + if (bazaarData.itemName.equals(name, ignoreCase = true)) { + data = bazaarData + break + } + } + + if (data == null) { + LorenzUtils.error("Item '$name' not found!") + return + } + name = data.itemName + + val apiName = data.apiName + if (!apiCollectionData.contains(apiName)) { + LorenzUtils.error("Item '$name' not in collection data!") + return + } + + if (itemAmount != -1) { + resetData() + } + + itemName = name + itemApiName = apiName + itemAmount = apiCollectionData[apiName]!! + + lastAmountInInventory = countCurrentlyInInventory() + update() + LorenzUtils.chat("§e[SkyHanni] Enabled collection tracking for $itemName") + } + + private fun resetData() { + itemAmount = -1 + itemName = "" + itemApiName = "" + + lastAmountInInventory = -1 + textToRender = "" + } + + private fun update() { + val format = GriffinJavaUtils.formatInteger(itemAmount) + textToRender = "$itemName collection: $format" + } + + private fun countCurrentlyInInventory(): Int { + var currentlyInInventory = 0 + val player = Minecraft.getMinecraft().thePlayer + for (stack in player.inventory.mainInventory) { + if (stack == null) continue + val internalName = stack.getInternalName() + if (internalName == itemApiName) { + currentlyInInventory += stack.stackSize + } + } + return currentlyInInventory + } + } + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + val thePlayer = Minecraft.getMinecraft().thePlayer ?: return + thePlayer.worldObj ?: return + + if (lastAmountInInventory == -1) return + + if (Minecraft.getMinecraft().currentScreen != null) return + + val currentlyInInventory = countCurrentlyInInventory() + val diff = currentlyInInventory - lastAmountInInventory + if (diff != 0) { + if (diff > 0) { + itemAmount += diff + update() + } else { + LorenzUtils.debug("Collection counter! Negative collection change: $diff") + } + } + + lastAmountInInventory = currentlyInInventory + } + + @SubscribeEvent + fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { + val profileData = event.profileData + val collection = profileData["collection"].asJsonObject + + apiCollectionData.clear() + for (entry in collection.entrySet()) { + val name = entry.key + val value = entry.value.asInt + apiCollectionData[name] = value + if (name == itemApiName) { + val diff = value - itemAmount + if (diff != 0) { + LorenzUtils.debug("Collection counter was wrong by $diff items. (Compared against API data)") + } + itemAmount = value + update() + } + } + } + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + if (!LorenzUtils.inSkyblock) return + + SkyHanniMod.feature.misc.collectionCounterPos.renderString(textToRender) + } +} \ No newline at end of file -- cgit From 640bc1dfb63b974712ff0c69bec3606378f69afa Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:27:00 +0100 Subject: Added /shtrackcollection. --- CHANGELOG.md | 3 +++ FEATURES.md | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e3818601..3d69e944d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Version 0.13.1 +### Features ++ Added /shtrackcollection - This tracks the number of items you collect, but it does not work with sacks. + ### Fixes + Dungeon level color fixed wrong colors. diff --git a/FEATURES.md b/FEATURES.md index 552552f9c..7f44a497d 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -140,6 +140,7 @@ ## Commands - /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki) - /shmarkplayer (marking a player with yellow color) +- /shtrackcollection - This tracks the number of items you collect, but it does not work with sacks. - ## Misc - Allow to copy, paste, and mark selected text in signs (not visual, but it's working still) -- cgit From 1b066b9cc3f2267750719b5fa52b4173f9662c1c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:27:58 +0100 Subject: Reloading the profile data every 3 minutes. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 +- .../at/hannibal2/skyhanni/data/ApiDataLoader.kt | 146 +++++++++++++++++++++ .../at/hannibal2/skyhanni/data/ApiKeyGrabber.kt | 127 ------------------ 3 files changed, 147 insertions(+), 128 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/data/ApiKeyGrabber.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index ba48a5103..0c68a9f89 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -89,7 +89,7 @@ public class SkyHanniMod { registerEvent(new HypixelData()); registerEvent(new DungeonData()); registerEvent(new ScoreboardData()); - registerEvent(new ApiKeyGrabber()); + registerEvent(new ApiDataLoader()); registerEvent(new SeaCreatureManager()); registerEvent(new ItemRenderBackground()); registerEvent(new EntityData()); diff --git a/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt new file mode 100644 index 000000000..bea039212 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt @@ -0,0 +1,146 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import java.io.File +import java.util.* + +class ApiDataLoader { + + private var currentProfileName = "" + + private var nextApiCallTime = -1L + private var currentProfileId = "" + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + val thePlayer = Minecraft.getMinecraft().thePlayer ?: return + thePlayer.worldObj ?: return + + if (nextApiCallTime != -1L && System.currentTimeMillis() > nextApiCallTime) { + nextApiCallTime = System.currentTimeMillis() + 60_000 * 5 + SkyHanniMod.coroutineScope.launch { + val apiKey = SkyHanniMod.feature.hidden.apiKey + val uuid = Minecraft.getMinecraft().thePlayer.uniqueID.toDashlessUUID() + loadProfileData(apiKey, uuid, currentProfileId) + } + } + } + + @SubscribeEvent + fun onStatusBar(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith("§aYour new API key is §r§b")) { + SkyHanniMod.feature.hidden.apiKey = message.substring(26) + LorenzUtils.chat("§b[SkyHanni] A new API Key has been detected and installed") + + if (currentProfileName != "") { + updateApiData() + } + } + } + + @SubscribeEvent + fun onStatusBar(event: ProfileJoinEvent) { + currentProfileName = event.name + updateApiData() + } + + private suspend fun tryUpdateProfileDataAndVerifyKey(apiKey: String): Boolean { + val uuid = Minecraft.getMinecraft().thePlayer.uniqueID.toDashlessUUID() + val url = "https://api.hypixel.net/player?key=$apiKey&uuid=$uuid" + val jsonObject = withContext(Dispatchers.IO) { APIUtil.getJSONResponse(url) } + + if (jsonObject["success"]?.asBoolean == false) { + if (jsonObject["throttle"]?.asBoolean == true) return true // 429 Too Many Requests does not make an invalid key. + val cause = jsonObject["cause"].asString + if (cause == "Invalid API key") { + return false + } else { + throw RuntimeException("API error for url '$url': $cause") + } + } + val player = jsonObject["player"].asJsonObject + val stats = player["stats"].asJsonObject + val skyBlock = stats["SkyBlock"].asJsonObject + val profiles = skyBlock["profiles"].asJsonObject + for (entry in profiles.entrySet()) { + val asJsonObject = entry.value.asJsonObject + val name = asJsonObject["cute_name"].asString + if (currentProfileName == name.lowercase()) { + currentProfileId = asJsonObject["profile_id"].asString + loadProfileData(apiKey, uuid, currentProfileId) + } + } + return true + } + + private fun updateApiData() { + nextApiCallTime = -1 + SkyHanniMod.coroutineScope.launch { + val oldApiKey = SkyHanniMod.feature.hidden.apiKey + if (oldApiKey.isNotEmpty() && tryUpdateProfileDataAndVerifyKey(oldApiKey)) { + return@launch + } + findApiCandidatesFromOtherMods().forEach { (modName, newApiKey) -> + if (tryUpdateProfileDataAndVerifyKey(newApiKey)) { + SkyHanniMod.feature.hidden.apiKey = newApiKey + LorenzUtils.chat("§e[SkyHanni] Imported valid new API key from $modName.") + return@launch + } else { + LorenzUtils.error("§c[SkyHanni] Invalid API key from $modName") + } + } + LorenzUtils.error("§c[SkyHanni] SkyHanni has no API key set. Please run /api new") + } + } + + private fun findApiCandidatesFromOtherMods(): Map { + LorenzUtils.consoleLog("Trying to find the API Key from the config of other mods..") + val candidates = mutableMapOf() + for (mod in OtherMod.values()) { + val modName = mod.modName + val file = File(mod.configPath) + if (file.exists()) { + val reader = APIUtil.readFile(file) + try { + val key = mod.readKey(reader).replace("\n", "").replace(" ", "") + UUID.fromString(key) + candidates[modName] = key + } catch (e: Throwable) { + LorenzUtils.consoleLog("- $modName: wrong config format! (" + e.message + ")") + continue + } + } else { + LorenzUtils.consoleLog("- $modName: no config found!") + } + } + return candidates + } + + private suspend fun loadProfileData(apiKey: String, playerUuid: String, profileId: String) { + val url = "https://api.hypixel.net/skyblock/profile?key=$apiKey&profile=$profileId" + + val jsonObject = withContext(Dispatchers.IO) { APIUtil.getJSONResponse(url) } + val profile = jsonObject["profile"]?.asJsonObject ?: return + val members = profile["members"]?.asJsonObject ?: return + for (entry in members.entrySet()) { + if (entry.key == playerUuid) { + val profileData = entry.value.asJsonObject + ProfileApiDataLoadedEvent(profileData).postAndCatch() + nextApiCallTime = System.currentTimeMillis() + 60_000 * 3 + } + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/ApiKeyGrabber.kt b/src/main/java/at/hannibal2/skyhanni/data/ApiKeyGrabber.kt deleted file mode 100644 index 000d21805..000000000 --- a/src/main/java/at/hannibal2/skyhanni/data/ApiKeyGrabber.kt +++ /dev/null @@ -1,127 +0,0 @@ -package at.hannibal2.skyhanni.data - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent -import at.hannibal2.skyhanni.events.ProfileJoinEvent -import at.hannibal2.skyhanni.utils.APIUtil -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext -import net.minecraft.client.Minecraft -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.io.File -import java.util.* - -class ApiKeyGrabber { - - private var currentProfileName = "" - - @SubscribeEvent - fun onStatusBar(event: LorenzChatEvent) { - val message = event.message - if (message.startsWith("§aYour new API key is §r§b")) { - SkyHanniMod.feature.hidden.apiKey = message.substring(26) - LorenzUtils.chat("§b[SkyHanni] A new API Key has been detected and installed") - - if (currentProfileName != "") { - updateApiData() - } - } - } - - @SubscribeEvent - fun onStatusBar(event: ProfileJoinEvent) { - currentProfileName = event.name - updateApiData() - } - - - private suspend fun tryUpdateProfileDataAndVerifyKey(apiKey: String): Boolean { - val uuid = Minecraft.getMinecraft().thePlayer.uniqueID.toDashlessUUID() - val url = "https://api.hypixel.net/player?key=$apiKey&uuid=$uuid" - val jsonObject = withContext(Dispatchers.IO) { APIUtil.getJSONResponse(url) } - - if (jsonObject["success"]?.asBoolean == false) { - if (jsonObject["throttle"]?.asBoolean == true) return true // 429 Too Many Requests does not make an invalid key. - val cause = jsonObject["cause"].asString - if (cause == "Invalid API key") { - return false - } else { - throw RuntimeException("API error for url '$url': $cause") - } - } - val player = jsonObject["player"].asJsonObject - val stats = player["stats"].asJsonObject - val skyblock = stats["SkyBlock"].asJsonObject - val profiles = skyblock["profiles"].asJsonObject - for (entry in profiles.entrySet()) { - val asJsonObject = entry.value.asJsonObject - val name = asJsonObject["cute_name"].asString - if (currentProfileName == name.lowercase()) { - val profileId = asJsonObject["profile_id"].asString - loadProfile(apiKey, uuid, profileId) - } - } - return true - } - - private fun updateApiData() { - SkyHanniMod.coroutineScope.launch { - val oldApiKey = SkyHanniMod.feature.hidden.apiKey - if (oldApiKey.isNotEmpty() && tryUpdateProfileDataAndVerifyKey(oldApiKey)) { - return@launch - } - findApiCandidatesFromOtherMods().forEach { (modName, newApiKey) -> - if (tryUpdateProfileDataAndVerifyKey(newApiKey)) { - SkyHanniMod.feature.hidden.apiKey = newApiKey - LorenzUtils.chat("§e[SkyHanni] Imported valid new API key from $modName.") - return@launch - } else { - LorenzUtils.error("§c[SkyHanni] Invalid API key from $modName") - } - } - LorenzUtils.error("§c[SkyHanni] SkyHanni has no API key set. Please run /api new") - } - } - - private fun findApiCandidatesFromOtherMods(): Map { - LorenzUtils.consoleLog("Trying to find the API Key from the config of other mods..") - val candidates = mutableMapOf() - for (mod in OtherMod.values()) { - val modName = mod.modName - val file = File(mod.configPath) - if (file.exists()) { - val reader = APIUtil.readFile(file) - try { - val key = mod.readKey(reader).replace("\n", "").replace(" ", "") - UUID.fromString(key) - candidates[modName] = key - } catch (e: Throwable) { - LorenzUtils.consoleLog("- $modName: wrong config format! (" + e.message + ")") - continue - } - } else { - LorenzUtils.consoleLog("- $modName: no config found!") - } - } - return candidates - } - - private suspend fun loadProfile(apiKey: String, playerUuid: String, profileId: String) { - val url = "https://api.hypixel.net/skyblock/profile?key=$apiKey&profile=$profileId" - - val jsonObject = withContext(Dispatchers.IO) { APIUtil.getJSONResponse(url) } - - val profile = jsonObject["profile"]?.asJsonObject ?: return - val members = profile["members"]?.asJsonObject ?: return - for (entry in members.entrySet()) { - if (entry.key == playerUuid) { - val profileData = entry.value.asJsonObject - ProfileApiDataLoadedEvent(profileData).postAndCatch() - } - } - } -} \ No newline at end of file -- cgit From e03f9232c5915cc7155c98abd3feba704ae3bb74 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:28:47 +0100 Subject: Renaming onRenderOverlay. --- src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt | 2 +- src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt | 2 +- src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt | 2 +- src/main/java/at/hannibal2/skyhanni/features/RealTime.kt | 2 +- src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt | 2 +- .../java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt | 2 +- .../at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt | 2 +- .../hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt | 2 +- .../skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt | 2 +- .../hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt | 2 +- .../at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt | 2 +- .../at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt | 2 +- src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt index eda151f97..f3807be83 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt @@ -20,7 +20,7 @@ class SendTitleHelper { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (System.currentTimeMillis() > endTime) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt index 0048114a3..29d5d037c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt @@ -37,7 +37,7 @@ class CurrentPetDisplay { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!LorenzUtils.inSkyblock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt index 7f449b0ba..5ac2a00dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt @@ -178,7 +178,7 @@ class NonGodPotEffectDisplay { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt index de1d1b06e..a3c9e9685 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt @@ -12,7 +12,7 @@ class RealTime { private val format = SimpleDateFormat("HH:mm:ss") @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index ef19d53ec..15d1475f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -126,7 +126,7 @@ class DungeonCopilot { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return 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 a65ee67c1..672e2d262 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -85,7 +85,7 @@ class DungeonDeathCounter { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return 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 97798b04b..9457d4a5d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -84,7 +84,7 @@ class DungeonMilestonesDisplay { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return 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 3c6c6af88..92692cc65 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 @@ -26,7 +26,7 @@ class AshfangFreezeCooldown { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return val duration = System.currentTimeMillis() - lastHit 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 ec171e2d8..8590c2b36 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 @@ -30,7 +30,7 @@ class AshfangNextResetCooldown { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return if (spawnTime == -1L) return 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 793764000..4ae548836 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 @@ -245,7 +245,7 @@ class BlazeSlayerDaggerHelper { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return if (textTopLeft.isEmpty()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt index 214e25eb7..22f22e904 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt @@ -96,7 +96,7 @@ class BlazeSlayerPillar { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return if (lastPillarSpawnTime == -1L) return 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 41357fbb8..a4047a7c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -137,7 +137,7 @@ class SummoningMobManager { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!LorenzUtils.inSkyblock) return if (!SkyHanniMod.feature.summonings.summoningMobDisplay) return diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 8f0c4cc2c..3f1cfa4da 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -120,7 +120,7 @@ class LorenzTest { } @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!LorenzUtils.inSkyblock) return if (!SkyHanniMod.feature.dev.debugEnabled) return -- cgit From b572e995a4e932c61753ecbc2f9bf8da4a8ef151 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:53:51 +0100 Subject: Fixed 1/1000000 crash. --- src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 97bba3099..3f8f1ce68 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -424,7 +424,8 @@ object RenderUtils { return lastValue + (currentValue - lastValue) * multiplier } - fun Position.renderString(string: String, offsetY: Int = 0) { + fun Position.renderString(string: String?, offsetY: Int = 0) { + if (string == null) return if (string == "") return val textToRender = "§f$string" -- cgit From 13fae8fb00cca71a3eb6f4f02aab46db7f0bc7b2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 00:39:06 +0100 Subject: Show collection gain. --- .../skyhanni/features/CollectionCounter.kt | 67 +++++++++++++++++----- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt index 4124762b8..98488815f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt @@ -15,15 +15,21 @@ import net.minecraftforge.fml.common.gameevent.TickEvent class CollectionCounter { + private val RECENT_GAIN_TIME = 1_500 + companion object { - private var textToRender = "" + private var display = "" + private var itemName = "" private var itemApiName = "" private var itemAmount = -1 private var lastAmountInInventory = -1 + private var recentGain = 0 + private var lastGainTime = -1L + private val apiCollectionData = mutableMapOf() fun command(args: Array) { @@ -32,7 +38,7 @@ class CollectionCounter { LorenzUtils.chat("§c/shtrackcollection ") return } - LorenzUtils.chat("§e[SkyHanni] Disabled collection tracking for $itemName") + LorenzUtils.chat("§e[SkyHanni] Stopped collection tracker.") apiCollectionData[itemApiName] = itemAmount resetData() return @@ -49,14 +55,14 @@ class CollectionCounter { } if (data == null) { - LorenzUtils.error("Item '$name' not found!") + LorenzUtils.chat("§c[SkyHanni] Item '$name' not found!") return } name = data.itemName val apiName = data.apiName if (!apiCollectionData.contains(apiName)) { - LorenzUtils.error("Item '$name' not in collection data!") + LorenzUtils.chat("§c[SkyHanni] Item $name not in collection data!") return } @@ -69,8 +75,8 @@ class CollectionCounter { itemAmount = apiCollectionData[apiName]!! lastAmountInInventory = countCurrentlyInInventory() - update() - LorenzUtils.chat("§e[SkyHanni] Enabled collection tracking for $itemName") + updateDisplay() + LorenzUtils.chat("§e[SkyHanni] Started tracking $itemName collection.") } private fun resetData() { @@ -79,12 +85,20 @@ class CollectionCounter { itemApiName = "" lastAmountInInventory = -1 - textToRender = "" + display = "" + + recentGain = 0 } - private fun update() { + private fun updateDisplay() { val format = GriffinJavaUtils.formatInteger(itemAmount) - textToRender = "$itemName collection: $format" + + var gainText = "" + if (recentGain != 0) { + gainText = "§a+" + GriffinJavaUtils.formatInteger(recentGain) + } + + display = "$itemName collection: §e$format $gainText" } private fun countCurrentlyInInventory(): Int { @@ -106,16 +120,19 @@ class CollectionCounter { val thePlayer = Minecraft.getMinecraft().thePlayer ?: return thePlayer.worldObj ?: return - if (lastAmountInInventory == -1) return + compareInventory() + updateGain() + } + private fun compareInventory() { + if (lastAmountInInventory == -1) return if (Minecraft.getMinecraft().currentScreen != null) return val currentlyInInventory = countCurrentlyInInventory() val diff = currentlyInInventory - lastAmountInInventory if (diff != 0) { if (diff > 0) { - itemAmount += diff - update() + gainItems(diff) } else { LorenzUtils.debug("Collection counter! Negative collection change: $diff") } @@ -124,6 +141,27 @@ class CollectionCounter { lastAmountInInventory = currentlyInInventory } + private fun updateGain() { + if (recentGain != 0) { + if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { + recentGain = 0 + updateDisplay() + } + } + } + + private fun gainItems(amount: Int) { + itemAmount += amount + + if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { + recentGain = 0 + } + lastGainTime = System.currentTimeMillis() + recentGain += amount + + updateDisplay() + } + @SubscribeEvent fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { val profileData = event.profileData @@ -140,7 +178,8 @@ class CollectionCounter { LorenzUtils.debug("Collection counter was wrong by $diff items. (Compared against API data)") } itemAmount = value - update() + recentGain = 0 + updateDisplay() } } } @@ -150,6 +189,6 @@ class CollectionCounter { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!LorenzUtils.inSkyblock) return - SkyHanniMod.feature.misc.collectionCounterPos.renderString(textToRender) + SkyHanniMod.feature.misc.collectionCounterPos.renderString(display) } } \ No newline at end of file -- cgit From abd2c854bf10206b2e718364430281be6b7fefdd Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 01:22:50 +0100 Subject: Don't render overlays when tab list key is pressed. --- CHANGELOG.md | 3 +++ src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d69e944d..6de968e79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Features + Added /shtrackcollection - This tracks the number of items you collect, but it does not work with sacks. +### Changes ++ Don't render overlays when tab list key is pressed. + ### Fixes + Dungeon level color fixed wrong colors. diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 3f8f1ce68..3697838c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -425,14 +425,17 @@ object RenderUtils { } fun Position.renderString(string: String?, offsetY: Int = 0) { + val minecraft = Minecraft.getMinecraft() + if (minecraft.gameSettings.keyBindPlayerList.isKeyDown) return + if (string == null) return if (string == "") return val textToRender = "§f$string" GlStateManager.pushMatrix() - val resolution = ScaledResolution(Minecraft.getMinecraft()) + val resolution = ScaledResolution(minecraft) - val renderer = Minecraft.getMinecraft().renderManager.fontRenderer ?: return + val renderer = minecraft.renderManager.fontRenderer ?: return val offsetX = (200 - renderer.getStringWidth(textToRender.removeColor())) / 2 -- cgit From 1db51193a1a1475ef2b0b2949d224e38ed06962c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 01:34:47 +0100 Subject: changed color for CroesusUnopenedChestTracker --- .../hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt index ae5d5511d..8cda8aade 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt @@ -30,7 +30,7 @@ class CroesusUnopenedChestTracker { val lore = stack.getLore() if (lore.any { it.contains("Click to view") }) { if (!lore.any { it.contains("Chests have been opened!") }) { - slot highlight LorenzColor.GREEN + slot highlight LorenzColor.DARK_PURPLE } } } -- cgit From 87520e30a3627bcfca4ebde7dfce84f4af346857 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 01:58:03 +0100 Subject: Add support for ironman, stranded and bingo. --- .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 55 +++++++++++++++++----- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 6 +++ 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 53a1286d3..8026ecac8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -19,6 +19,13 @@ class HypixelData { var skyblock = false var skyBlockIsland: String = "" + //Ironman, Stranded and Bingo + var noTrade = false + + var ironman = false + var stranded = false + var bingo = false + fun readSkyBlockArea(): String { for (line in ScoreboardData.sidebarLinesFormatted()) { if (line.startsWith(" §7⏣ ")) { @@ -28,7 +35,6 @@ class HypixelData { return "invalid" } - } var loggerIslandChange = LorenzLogger("debug/island_change") @@ -57,7 +63,6 @@ class HypixelData { if (!hypixel) return val message = event.message.removeColor().lowercase() - if (message.startsWith("your profile was changed to:")) { val stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim() ProfileJoinEvent(stripped).postAndCatch() @@ -65,7 +70,6 @@ class HypixelData { if (message.startsWith("you are playing on profile:")) { val stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim() ProfileJoinEvent(stripped).postAndCatch() - } } @@ -80,13 +84,42 @@ class HypixelData { if (tick % 5 != 0) return - val newState = checkScoreboard() - if (newState) { + val inSkyBlock = checkScoreboard() + if (inSkyBlock) { checkIsland() + checkSidebar() } - if (newState == skyblock) return - skyblock = newState + if (inSkyBlock == skyblock) return + skyblock = inSkyBlock + } + + private fun checkSidebar() { + ironman = false + stranded = false + bingo = false + + for (line in ScoreboardData.sidebarLinesFormatted()) { + when (line) { + " §7Ⓑ §7Bingo", // No Rank + " §bⒷ §bBingo", // Rank 1 + " §9Ⓑ §9Bingo", // Rank 2 + " §5Ⓑ §5Bingo", // Rank 3 + " §6Ⓑ §6Bingo", // Rank 4 + -> { + bingo = true + } + + // TODO implemennt stranded check + + " §7♲ §7Ironman" -> { + ironman = true + } + + } + } + + noTrade = ironman || stranded || bingo } private fun checkIsland() { @@ -115,12 +148,8 @@ class HypixelData { val minecraft = Minecraft.getMinecraft() val world = minecraft.theWorld ?: return false - val sidebarObjective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false - - val displayName = sidebarObjective.displayName - + val objective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false + val displayName = objective.displayName return displayName.removeColor().contains("SKYBLOCK") - } - } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index e37aedbc6..f6e2e319c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -33,6 +33,12 @@ object LorenzUtils { val inKuudraFight: Boolean get() = skyBlockIsland == "Instanced" + val noTradeMode: Boolean + get() = HypixelData.noTrade + + val isBingoProfile: Boolean + get() = inSkyblock && HypixelData.bingo + const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private val log = LorenzLogger("chat/mod_sent") -- cgit From 46a5b1c258fce1f22d06c0cee20c9d43032a988d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 01:58:22 +0100 Subject: Removed unused code. --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 0c68a9f89..5a1e9fb7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -186,10 +186,7 @@ public class SkyHanniMod { private void registerEvent(Object object) { listenerClasses.add(object); - String simpleName = object.getClass().getSimpleName(); - long start = System.currentTimeMillis(); MinecraftForge.EVENT_BUS.register(object); - long duration = System.currentTimeMillis() - start; } public static GuiScreen screenToOpen = null; -- cgit From c0626bdc53ef5184279241a9110daa1696ac27e7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 01:59:53 +0100 Subject: No longer blocking the sell of bazaar items to NPC when on ironman, stranded or bingo mode. --- CHANGELOG.md | 1 + .../hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de968e79..4eac20119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Changes + Don't render overlays when tab list key is pressed. ++ No longer blocking the sell of bazaar items to NPC when on ironman, stranded or bingo mode. ### Fixes + Dungeon level color fixed wrong colors. 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 78735b5f9..0202566a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -306,6 +306,12 @@ class HideNotClickableItems { } if (!ItemUtils.isRecombobulated(stack)) { + if (LorenzUtils.noTradeMode) { + if (BazaarApi.isBazaarItem(stack)) { + return false + } + } + if (hideNpcSellFilter.match(name)) return false val id = stack.getInternalName() -- cgit From cbbcdccf949cba0f152cb52a18b8e02c4d6f3b0e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 02:23:14 +0100 Subject: Compact Bingo and Potion Effect chat messages. --- CHANGELOG.md | 4 +- FEATURES.md | 4 + .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 + .../at/hannibal2/skyhanni/config/Features.java | 4 + .../hannibal2/skyhanni/config/features/Bingo.java | 14 +++ .../hannibal2/skyhanni/config/features/Chat.java | 7 +- .../skyhanni/features/CompactBingoChat.kt | 112 +++++++++++++++++++++ .../features/CompactSplashPotionMessage.kt | 35 +++++++ 8 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java create mode 100644 src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eac20119..72210d27a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,12 @@ ### Features + Added /shtrackcollection - This tracks the number of items you collect, but it does not work with sacks. ++ Added Compact Bingo Chat Messages ++ Added Compact Potion Effect Chat Messages ### Changes + Don't render overlays when tab list key is pressed. -+ No longer blocking the sell of bazaar items to NPC when on ironman, stranded or bingo mode. ++ Do no longer prevent the selling of bazaar items to NPC when on ironman, stranded or bingo mode. ### Fixes + Dungeon level color fixed wrong colors. diff --git a/FEATURES.md b/FEATURES.md index 7f44a497d..9687098b0 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -19,6 +19,7 @@ - Option to hide the death messages of other players, except for players who are close to the player, inside the dungeon or during a Kuudra fight. - Scan messages sent by players in all-chat for blacklisted words and greys out the message. - Chat peeking (holding key to display chat without opening the chat gui) +- Compact Potion Effect Messages ## Dungeon - Clicked Blocks (Showing the block behind walls AFTER clicked on a chest, wither essence or a lever) @@ -137,6 +138,9 @@ + Highlight marked player names in chat. + Mark the own player name. +## Bingo ++ Shortens chat messages about skill level ups, collection gains, new area discoveries, and bestiarity upgrades while on bingo. + ## Commands - /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki) - /shmarkplayer (marking a player with yellow color) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 5a1e9fb7c..d7670e810 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -167,7 +167,9 @@ public class SkyHanniMod { registerEvent(new HighlightBonzoMasks()); registerEvent(new DungeonLevelColor()); registerEvent(new BazaarCancelledBuyOrderClipboard()); + registerEvent(new CompactSplashPotionMessage()); registerEvent(new CroesusUnopenedChestTracker()); + registerEvent(new CompactBingoChat()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 976a0d9da..083220b29 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -164,6 +164,10 @@ public class Features extends Config { @Category(name = "Marked Players", desc = "Players that got marked with /shmarkplayer") public MarkedPlayers markedPlayers = new MarkedPlayers(); + @Expose + @Category(name = "Bingo", desc = "Features for the Bingo mode.") + public Bingo bingo = new Bingo(); + @Expose @Category(name = "Misc", desc = "Settings without a category.") public Misc misc = new Misc(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java b/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java new file mode 100644 index 000000000..002841d22 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java @@ -0,0 +1,14 @@ +package at.hannibal2.skyhanni.config.features; + +import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorBoolean; +import at.hannibal2.skyhanni.config.core.config.annotations.ConfigOption; +import com.google.gson.annotations.Expose; + +public class Bingo { + + @Expose + @ConfigOption(name = "Compact Chat Messages", desc = "Shortens chat messages about skill level ups, collection gains, " + + "new area discoveries, and bestiarity upgrades while on bingo.") + @ConfigEditorBoolean + public boolean compactChatMessages = true; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java index 029731f96..386a8fd4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java @@ -91,7 +91,7 @@ public class Chat { @Expose @ConfigOption(name = "Dungeon Filter", desc = "Hide annoying messages in the dungeon.") @ConfigEditorBoolean - public boolean dungeonMessages = false; + public boolean dungeonMessages = true; @Expose @ConfigOption(name = "Dungeon Boss Messages", desc = "Hide messages from watcher and bosses in the dungeon.") @@ -103,4 +103,9 @@ public class Chat { "except for players who are close to the player, inside dungeon or during a Kuudra fight.") @ConfigEditorBoolean public boolean hideFarDeathMessages = false; + + @Expose + @ConfigOption(name = "Compact Potion Message", desc = "Shorten chat messages about player potion effects.") + @ConfigEditorBoolean + public boolean compactPotionMessage = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt new file mode 100644 index 000000000..236236bb6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt @@ -0,0 +1,112 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CompactBingoChat { + + private var blockedSkillLevelUp = false + private var blockedCollectionLevelUp = false + private var collectionLevelUpLastLine: String? = null + private var newArea = 0//0 = nothing, 1 = after first message, 2 = after second message + private var blockedBestiarity = false + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.isBingoProfile) return + if (!SkyHanniMod.feature.bingo.compactChatMessages) return + + onSkillLevelUp(event) + onCollectionLevelUp(event) + onNewAreaDiscovered(event) + onBestiarityUpgrade(event) + } + + private fun onSkillLevelUp(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith(" §r§b§lSKILL LEVEL UP ")) { + blockedSkillLevelUp = true + return + } + if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedSkillLevelUp = false + return + } + + if (blockedSkillLevelUp) { + if (!message.contains("Access to") && !message.endsWith(" Enchantment")) { + event.blockedReason = "compact skill level up" + } + } + } + + private fun onCollectionLevelUp(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith(" §r§6§lCOLLECTION LEVEL UP ")) { + blockedCollectionLevelUp = true + return + } + if (message == "§e§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedCollectionLevelUp = false + return + } + + if (blockedCollectionLevelUp) { + if (message.contains("Trade") || message.contains("Recipe")) { + var text = message.removeColor().replace(" ", "") + if (text == "Trade" || text == "Recipe") { + collectionLevelUpLastLine?.let { LorenzUtils.chat(it) } + } + } else { + event.blockedReason = "compact collection level up" + collectionLevelUpLastLine = message + } + } + } + + private fun onNewAreaDiscovered(event: LorenzChatEvent) { + var message = event.message + + if (message == " §r§6§lNEW AREA DISCOVERED!") { + newArea = 1 + println("new area $newArea $message") + return + } + + if (message != "") { + if (newArea == 1) { + newArea = 2 + println("new area $newArea $message") + return + } + + if (newArea == 2) { + if (message.startsWith("§7 ■ §r") || message.startsWith(" §r")) { + event.blockedReason = "compact new area discovered" + } else { + newArea = 0 + println("new area $newArea $message") + } + } + } + } + + private fun onBestiarityUpgrade(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith(" §r§3§lBESTIARY §b§l")) { + blockedBestiarity = true + return + } + if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedBestiarity = false + return + } + + if (blockedBestiarity) { + event.blockedReason = "compact bestiarity upgrade" + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt new file mode 100644 index 000000000..04740bbbd --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.util.ChatComponentText +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class CompactSplashPotionMessage { + + private val POTION_EFFECT_PATTERN = + Pattern.compile("§a§lBUFF! §fYou have gained §r(.*)§r§f! Press TAB or type /effects to view your active effects!") + + private val POTION_EFFECT_OTHERS_PATTERN = + Pattern.compile("§a§lBUFF! §fYou were splashed by (.*) §fwith §r(.*)§r§f! Press TAB or type /effects to view your active effects!") + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyblock || !SkyHanniMod.feature.chat.compactPotionMessage) return + + var matcher = POTION_EFFECT_PATTERN.matcher(event.message) + if (matcher.matches()) { + val name = matcher.group(1) + event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$name") + } + + matcher = POTION_EFFECT_OTHERS_PATTERN.matcher(event.message) + if (matcher.matches()) { + val playerName = matcher.group(1) + val effectName = matcher.group(2) + event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$effectName §7(by $playerName§7)") + } + } +} \ No newline at end of file -- cgit From 8bfeb09e1a89293ddceebda55624747c9cb43f69 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 02:27:43 +0100 Subject: Create misc package for the features. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 +- .../at/hannibal2/skyhanni/config/Features.java | 4 +- .../hannibal2/skyhanni/config/commands/Commands.kt | 4 +- .../hannibal2/skyhanni/features/ButtonOnPause.kt | 51 ----- .../skyhanni/features/CollectionCounter.kt | 194 ------------------ .../skyhanni/features/CompactBingoChat.kt | 112 ----------- .../features/CompactSplashPotionMessage.kt | 35 ---- .../skyhanni/features/CorruptedMobHighlight.kt | 61 ------ .../skyhanni/features/CurrentPetDisplay.kt | 48 ----- .../skyhanni/features/ExpBottleOnGroundHider.kt | 20 -- .../at/hannibal2/skyhanni/features/HideArmor.kt | 216 --------------------- .../skyhanni/features/HideDamageSplash.kt | 22 --- .../skyhanni/features/MarkedPlayerManager.kt | 120 ------------ .../skyhanni/features/NonGodPotEffectDisplay.kt | 208 -------------------- .../at/hannibal2/skyhanni/features/RealTime.kt | 25 --- .../skyhanni/features/ThunderSparksHighlight.kt | 67 ------- .../skyhanni/features/chat/PlayerDeathMessages.kt | 2 +- .../features/chat/playerchat/PlayerChatModifier.kt | 2 +- .../skyhanni/features/misc/ButtonOnPause.kt | 51 +++++ .../skyhanni/features/misc/CollectionCounter.kt | 194 ++++++++++++++++++ .../skyhanni/features/misc/CompactBingoChat.kt | 112 +++++++++++ .../features/misc/CompactSplashPotionMessage.kt | 35 ++++ .../features/misc/CorruptedMobHighlight.kt | 61 ++++++ .../skyhanni/features/misc/CurrentPetDisplay.kt | 48 +++++ .../features/misc/ExpBottleOnGroundHider.kt | 20 ++ .../hannibal2/skyhanni/features/misc/HideArmor.kt | 216 +++++++++++++++++++++ .../skyhanni/features/misc/HideDamageSplash.kt | 22 +++ .../skyhanni/features/misc/MarkedPlayerManager.kt | 120 ++++++++++++ .../features/misc/NonGodPotEffectDisplay.kt | 208 ++++++++++++++++++++ .../hannibal2/skyhanni/features/misc/RealTime.kt | 25 +++ .../features/misc/ThunderSparksHighlight.kt | 67 +++++++ 31 files changed, 1186 insertions(+), 1186 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/ButtonOnPause.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/ExpBottleOnGroundHider.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/RealTime.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/CompactBingoChat.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index d7670e810..893792936 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.config.Features; import at.hannibal2.skyhanni.config.commands.Commands; import at.hannibal2.skyhanni.data.*; import at.hannibal2.skyhanni.data.repo.RepoManager; -import at.hannibal2.skyhanni.features.*; import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper; import at.hannibal2.skyhanni.features.bazaar.BazaarApi; import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod; @@ -30,6 +29,7 @@ import at.hannibal2.skyhanni.features.inventory.*; import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles; import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown; import at.hannibal2.skyhanni.features.minion.MinionFeatures; +import at.hannibal2.skyhanni.features.misc.*; import at.hannibal2.skyhanni.features.nether.MilleniaAgedBlazeColor; import at.hannibal2.skyhanni.features.nether.ashfang.*; import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 083220b29..39d20d74b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -8,8 +8,8 @@ import at.hannibal2.skyhanni.config.core.config.Position; import at.hannibal2.skyhanni.config.core.config.annotations.Category; import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor; import at.hannibal2.skyhanni.config.features.*; -import at.hannibal2.skyhanni.features.HideArmor; -import at.hannibal2.skyhanni.features.MarkedPlayerManager; +import at.hannibal2.skyhanni.features.misc.HideArmor; +import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager; import com.google.gson.annotations.Expose; import net.minecraft.client.Minecraft; 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 e51f9d92c..9bda0fda1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigEditor import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnable import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper -import at.hannibal2.skyhanni.features.CollectionCounter -import at.hannibal2.skyhanni.features.MarkedPlayerManager import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper +import at.hannibal2.skyhanni.features.misc.CollectionCounter +import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.test.LorenzTest import at.hannibal2.skyhanni.test.command.CopyItemCommand import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand diff --git a/src/main/java/at/hannibal2/skyhanni/features/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/features/ButtonOnPause.kt deleted file mode 100644 index 9769f5196..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/ButtonOnPause.kt +++ /dev/null @@ -1,51 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigEditor -import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.gui.GuiButton -import net.minecraft.client.gui.GuiIngameMenu -import net.minecraftforge.client.event.GuiScreenEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class ButtonOnPause { - private val buttonId = System.nanoTime().toInt() - - @SubscribeEvent - fun onGuiAction(event: GuiScreenEvent.ActionPerformedEvent.Post) { - if (!LorenzUtils.isOnHypixel) return - - if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) { - SkyHanniMod.screenToOpen = GuiScreenElementWrapper( - ConfigEditor( - SkyHanniMod.feature - ) - ) - } - } - - @SubscribeEvent - fun onGuiInitPost(event: GuiScreenEvent.InitGuiEvent.Post) { - if (!LorenzUtils.isOnHypixel) return - - if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu) { - val x = event.gui.width - 105 - val x2 = x + 100 - var y = event.gui.height - 22 - var y2 = y + 20 - val sorted = event.buttonList.sortedWith { a, b -> b.yPosition + b.height - a.yPosition + a.height } - for (button in sorted) { - val otherX = button.xPosition - val otherX2 = button.xPosition + button.width - val otherY = button.yPosition - val otherY2 = button.yPosition + button.height - if (otherX2 > x && otherX < x2 && otherY2 > y && otherY < y2) { - y = otherY - 20 - 2 - y2 = y + 20 - } - } - event.buttonList.add(GuiButton(buttonId, x, 0.coerceAtLeast(y), 100, 20, "SkyHanni")) - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt deleted file mode 100644 index 98488815f..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/CollectionCounter.kt +++ /dev/null @@ -1,194 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent -import at.hannibal2.skyhanni.features.bazaar.BazaarApi -import at.hannibal2.skyhanni.features.bazaar.BazaarData -import at.hannibal2.skyhanni.test.GriffinJavaUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import net.minecraft.client.Minecraft -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class CollectionCounter { - - private val RECENT_GAIN_TIME = 1_500 - - companion object { - - private var display = "" - - private var itemName = "" - private var itemApiName = "" - private var itemAmount = -1 - - private var lastAmountInInventory = -1 - - private var recentGain = 0 - private var lastGainTime = -1L - - private val apiCollectionData = mutableMapOf() - - fun command(args: Array) { - if (args.isEmpty()) { - if (itemName == "") { - LorenzUtils.chat("§c/shtrackcollection ") - return - } - LorenzUtils.chat("§e[SkyHanni] Stopped collection tracker.") - apiCollectionData[itemApiName] = itemAmount - resetData() - return - } - - var name = args.joinToString(" ") - - var data: BazaarData? = null - for (bazaarData in BazaarApi.bazaarMap.values) { - if (bazaarData.itemName.equals(name, ignoreCase = true)) { - data = bazaarData - break - } - } - - if (data == null) { - LorenzUtils.chat("§c[SkyHanni] Item '$name' not found!") - return - } - name = data.itemName - - val apiName = data.apiName - if (!apiCollectionData.contains(apiName)) { - LorenzUtils.chat("§c[SkyHanni] Item $name not in collection data!") - return - } - - if (itemAmount != -1) { - resetData() - } - - itemName = name - itemApiName = apiName - itemAmount = apiCollectionData[apiName]!! - - lastAmountInInventory = countCurrentlyInInventory() - updateDisplay() - LorenzUtils.chat("§e[SkyHanni] Started tracking $itemName collection.") - } - - private fun resetData() { - itemAmount = -1 - itemName = "" - itemApiName = "" - - lastAmountInInventory = -1 - display = "" - - recentGain = 0 - } - - private fun updateDisplay() { - val format = GriffinJavaUtils.formatInteger(itemAmount) - - var gainText = "" - if (recentGain != 0) { - gainText = "§a+" + GriffinJavaUtils.formatInteger(recentGain) - } - - display = "$itemName collection: §e$format $gainText" - } - - private fun countCurrentlyInInventory(): Int { - var currentlyInInventory = 0 - val player = Minecraft.getMinecraft().thePlayer - for (stack in player.inventory.mainInventory) { - if (stack == null) continue - val internalName = stack.getInternalName() - if (internalName == itemApiName) { - currentlyInInventory += stack.stackSize - } - } - return currentlyInInventory - } - } - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - val thePlayer = Minecraft.getMinecraft().thePlayer ?: return - thePlayer.worldObj ?: return - - compareInventory() - updateGain() - } - - private fun compareInventory() { - if (lastAmountInInventory == -1) return - if (Minecraft.getMinecraft().currentScreen != null) return - - val currentlyInInventory = countCurrentlyInInventory() - val diff = currentlyInInventory - lastAmountInInventory - if (diff != 0) { - if (diff > 0) { - gainItems(diff) - } else { - LorenzUtils.debug("Collection counter! Negative collection change: $diff") - } - } - - lastAmountInInventory = currentlyInInventory - } - - private fun updateGain() { - if (recentGain != 0) { - if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { - recentGain = 0 - updateDisplay() - } - } - } - - private fun gainItems(amount: Int) { - itemAmount += amount - - if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { - recentGain = 0 - } - lastGainTime = System.currentTimeMillis() - recentGain += amount - - updateDisplay() - } - - @SubscribeEvent - fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { - val profileData = event.profileData - val collection = profileData["collection"].asJsonObject - - apiCollectionData.clear() - for (entry in collection.entrySet()) { - val name = entry.key - val value = entry.value.asInt - apiCollectionData[name] = value - if (name == itemApiName) { - val diff = value - itemAmount - if (diff != 0) { - LorenzUtils.debug("Collection counter was wrong by $diff items. (Compared against API data)") - } - itemAmount = value - recentGain = 0 - updateDisplay() - } - } - } - - @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inSkyblock) return - - SkyHanniMod.feature.misc.collectionCounterPos.renderString(display) - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt deleted file mode 100644 index 236236bb6..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/CompactBingoChat.kt +++ /dev/null @@ -1,112 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class CompactBingoChat { - - private var blockedSkillLevelUp = false - private var blockedCollectionLevelUp = false - private var collectionLevelUpLastLine: String? = null - private var newArea = 0//0 = nothing, 1 = after first message, 2 = after second message - private var blockedBestiarity = false - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.isBingoProfile) return - if (!SkyHanniMod.feature.bingo.compactChatMessages) return - - onSkillLevelUp(event) - onCollectionLevelUp(event) - onNewAreaDiscovered(event) - onBestiarityUpgrade(event) - } - - private fun onSkillLevelUp(event: LorenzChatEvent) { - val message = event.message - if (message.startsWith(" §r§b§lSKILL LEVEL UP ")) { - blockedSkillLevelUp = true - return - } - if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { - blockedSkillLevelUp = false - return - } - - if (blockedSkillLevelUp) { - if (!message.contains("Access to") && !message.endsWith(" Enchantment")) { - event.blockedReason = "compact skill level up" - } - } - } - - private fun onCollectionLevelUp(event: LorenzChatEvent) { - val message = event.message - if (message.startsWith(" §r§6§lCOLLECTION LEVEL UP ")) { - blockedCollectionLevelUp = true - return - } - if (message == "§e§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { - blockedCollectionLevelUp = false - return - } - - if (blockedCollectionLevelUp) { - if (message.contains("Trade") || message.contains("Recipe")) { - var text = message.removeColor().replace(" ", "") - if (text == "Trade" || text == "Recipe") { - collectionLevelUpLastLine?.let { LorenzUtils.chat(it) } - } - } else { - event.blockedReason = "compact collection level up" - collectionLevelUpLastLine = message - } - } - } - - private fun onNewAreaDiscovered(event: LorenzChatEvent) { - var message = event.message - - if (message == " §r§6§lNEW AREA DISCOVERED!") { - newArea = 1 - println("new area $newArea $message") - return - } - - if (message != "") { - if (newArea == 1) { - newArea = 2 - println("new area $newArea $message") - return - } - - if (newArea == 2) { - if (message.startsWith("§7 ■ §r") || message.startsWith(" §r")) { - event.blockedReason = "compact new area discovered" - } else { - newArea = 0 - println("new area $newArea $message") - } - } - } - } - - private fun onBestiarityUpgrade(event: LorenzChatEvent) { - val message = event.message - if (message.startsWith(" §r§3§lBESTIARY §b§l")) { - blockedBestiarity = true - return - } - if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { - blockedBestiarity = false - return - } - - if (blockedBestiarity) { - event.blockedReason = "compact bestiarity upgrade" - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt deleted file mode 100644 index 04740bbbd..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/CompactSplashPotionMessage.kt +++ /dev/null @@ -1,35 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.util.ChatComponentText -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.util.regex.Pattern - -class CompactSplashPotionMessage { - - private val POTION_EFFECT_PATTERN = - Pattern.compile("§a§lBUFF! §fYou have gained §r(.*)§r§f! Press TAB or type /effects to view your active effects!") - - private val POTION_EFFECT_OTHERS_PATTERN = - Pattern.compile("§a§lBUFF! §fYou were splashed by (.*) §fwith §r(.*)§r§f! Press TAB or type /effects to view your active effects!") - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock || !SkyHanniMod.feature.chat.compactPotionMessage) return - - var matcher = POTION_EFFECT_PATTERN.matcher(event.message) - if (matcher.matches()) { - val name = matcher.group(1) - event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$name") - } - - matcher = POTION_EFFECT_OTHERS_PATTERN.matcher(event.message) - if (matcher.matches()) { - val playerName = matcher.group(1) - val effectName = matcher.group(2) - event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$effectName §7(by $playerName§7)") - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt deleted file mode 100644 index c9d806fcc..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt +++ /dev/null @@ -1,61 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent -import at.hannibal2.skyhanni.events.RenderMobColoredEvent -import at.hannibal2.skyhanni.events.ResetEntityHurtEvent -import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth -import net.minecraft.entity.EntityLivingBase -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class CorruptedMobHighlight { - - private val corruptedMobs = mutableListOf() - - @SubscribeEvent - fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) { - if (!LorenzUtils.inSkyblock) return - - val entity = event.entity - if (entity in corruptedMobs) return - - val baseMaxHealth = entity.baseMaxHealth.toFloat() - if (event.health == baseMaxHealth * 3) { - corruptedMobs.add(entity) - } - } - - @SubscribeEvent - fun onRenderMobColored(event: RenderMobColoredEvent) { - if (!isEnabled()) return - val entity = event.entity - - if (entity in corruptedMobs) { - event.color = LorenzColor.DARK_PURPLE.toColor().withAlpha(127) - } - } - - @SubscribeEvent - fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { - if (!isEnabled()) return - val entity = event.entity - - if (entity in corruptedMobs) { - event.shouldReset = true - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - corruptedMobs.clear() - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.corruptedMobHighlight && - LorenzUtils.skyBlockIsland != "Private Island" - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt deleted file mode 100644 index 29d5d037c..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt +++ /dev/null @@ -1,48 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.between -import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex -import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class CurrentPetDisplay { - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return - - var blocked = false - - val message = event.message - if (message.matchRegex("§aYou summoned your §r(.*)§r§a!")) { - SkyHanniMod.feature.hidden.currentPet = message.between("your §r", "§r§a") - blocked = true - } - if (message.matchRegex("§cAutopet §eequipped your §7(.*)§e! §a§lVIEW RULE")) { - SkyHanniMod.feature.hidden.currentPet = message.between("] ", "§e!") - blocked = true - } - if (message.matchRegex("§aYou despawned your §r(.*)§r§a!")) { - SkyHanniMod.feature.hidden.currentPet = "" - blocked = true - } - - if (blocked && SkyHanniMod.feature.misc.petDisplay) { - event.blockedReason = "pets" - } - } - - @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inSkyblock) return - - if (!SkyHanniMod.feature.misc.petDisplay) return - - SkyHanniMod.feature.misc.petDisplayPos.renderString(SkyHanniMod.feature.hidden.currentPet) - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/ExpBottleOnGroundHider.kt b/src/main/java/at/hannibal2/skyhanni/features/ExpBottleOnGroundHider.kt deleted file mode 100644 index 1a1a0f6c7..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/ExpBottleOnGroundHider.kt +++ /dev/null @@ -1,20 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.CheckRenderEntityEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.entity.item.EntityXPOrb -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class ExpBottleOnGroundHider { - - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!LorenzUtils.inSkyblock) return - if (!SkyHanniMod.feature.misc.hideExpBottles) return - - if (event.entity is EntityXPOrb) { - event.isCanceled = true - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt deleted file mode 100644 index e691f4812..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt +++ /dev/null @@ -1,216 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.Minecraft -import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraft.client.entity.EntityPlayerSP -import net.minecraft.client.gui.inventory.GuiInventory -import net.minecraft.entity.player.EntityPlayer -import net.minecraft.item.ItemStack -import net.minecraft.network.play.server.S04PacketEntityEquipment -import net.minecraft.network.play.server.S2FPacketSetSlot -import net.minecraft.network.play.server.S30PacketWindowItems -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class HideArmor { - - private var invOpen = false - private val laterCheck = mutableListOf() - - @SubscribeEvent - fun onGuiInventoryToggle(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return // TODO test this - - fixOtherArmor() - - if (!SkyHanniMod.feature.misc.hideArmorEnabled) return - - val currentScreen = Minecraft.getMinecraft().currentScreen - if (currentScreen == null || currentScreen !is GuiInventory) { - if (invOpen) { - invOpen = false - changeArmor(Minecraft.getMinecraft().thePlayer, null) - } - } else { - if (!invOpen) { - invOpen = true - val thePlayer = Minecraft.getMinecraft().thePlayer - val entityId = thePlayer.entityId - changeArmor(thePlayer, getCachedArmor(entityId)) - } - } - } - - // Since S04PacketEntityEquipment gets sent before the entity is fully loaded, I need to remove the armor later - private fun fixOtherArmor() { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity !is EntityOtherPlayerMP) continue - - val entityId = entity.entityId - if (entityId !in laterCheck) continue - - laterCheck.remove(entityId) - if (SkyHanniMod.feature.misc.hideArmorEnabled) { - val armorInventory = entity.inventory.armorInventory - for ((equipmentSlot, _) in armorInventory.withIndex()) { - if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || equipmentSlot == 3) { - armorInventory[equipmentSlot] = null - } - } - } - } - } - - @SubscribeEvent - fun onPacketReceive(event: PacketEvent.ReceiveEvent) { - val packet = event.packet - - //own player world switch - if (packet is S30PacketWindowItems) { - - // check window id - if (packet.func_148911_c() != 0) return - - for ((slot, itemStack) in packet.itemStacks.withIndex()) { - - if (slot !in 5..8) continue - - val armorSlot = (slot - 5) * -1 + 3 - val armor = getCachedArmor(Minecraft.getMinecraft().thePlayer.entityId) - armor[armorSlot] = itemStack - - val currentScreen = Minecraft.getMinecraft().currentScreen - if (currentScreen == null || currentScreen !is GuiInventory) { - if (SkyHanniMod.feature.misc.hideArmorEnabled) { - if (SkyHanniMod.feature.misc.hideArmorOwn) { - if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || armorSlot == 3) { - packet.itemStacks[slot] = null - } - } - } - } - } - return - } - - - //own player armor change - if (packet is S2FPacketSetSlot) { - val slot = packet.func_149173_d() - - // check window id - if (packet.func_149175_c() != 0) return - if (slot !in 5..8) return - - val armorSlot = (slot - 5) * -1 + 3 - val armor = getCachedArmor(Minecraft.getMinecraft().thePlayer.entityId) - // set item in cache - armor[armorSlot] = packet.func_149174_e() - - val currentScreen = Minecraft.getMinecraft().currentScreen - if (currentScreen == null || currentScreen !is GuiInventory) { - if (SkyHanniMod.feature.misc.hideArmorEnabled) { - if (SkyHanniMod.feature.misc.hideArmorOwn) { - if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || armorSlot == 3) { - event.isCanceled = true - } - } - } - } - return - } - - - //other player armor switch - if (packet is S04PacketEntityEquipment) { - val entityID = packet.entityID - val equipmentSlot = packet.equipmentSlot - 1 - if (equipmentSlot == -1) return - - val entity = Minecraft.getMinecraft().theWorld?.getEntityByID(entityID) - if (entity == null) { - laterCheck.add(entityID) - return - } - - if (entity !is EntityOtherPlayerMP) return - - val armor = getCachedArmor(entityID) - - // set item in cache - armor[equipmentSlot] = packet.itemStack - - if (SkyHanniMod.feature.misc.hideArmorEnabled) { - if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || equipmentSlot == 3) { - event.isCanceled = true - } - } - } - } - - private fun getCachedArmor(entityID: Int): Array { - val armor: Array = if (armorCache.containsKey(entityID)) { - armorCache[entityID]!! - } else { - val new = arrayOf(null, null, null, null) - armorCache[entityID] = new - new - } - return armor - } - - companion object { - var armorCache: MutableMap> = mutableMapOf() - - fun updateArmor() { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity !is EntityPlayer) continue - - val entityId = entity.entityId - armorCache[entityId]?.let { - changeArmor(entity, it) - } - - if (SkyHanniMod.feature.misc.hideArmorEnabled) { - changeArmor(entity, null) - } - } - } - - private fun changeArmor(entity: EntityPlayer, new: Array?) { - if (!LorenzUtils.inSkyblock) return - - val current = entity.inventory.armorInventory - if (new != null) { - current[0] = new[0] - current[1] = new[1] - current[2] = new[2] - current[3] = new[3] - return - } - - if (!SkyHanniMod.feature.misc.hideArmorOwn) { - if (entity is EntityPlayerSP) { - return - } - } - - if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet) { - current[0] = null - current[1] = null - current[2] = null - } - current[3] = null - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - armorCache.clear() - laterCheck.clear() - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt deleted file mode 100644 index 23146f5f6..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt +++ /dev/null @@ -1,22 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.entity.EntityLivingBase -import net.minecraftforge.client.event.RenderLivingEvent -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class HideDamageSplash { - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onRenderDamage(event: RenderLivingEvent.Specials.Pre) { - if (!LorenzUtils.inSkyblock) return - if (!SkyHanniMod.feature.misc.hideDamageSplash) return - - if (DamageIndicatorManager.isDamageSplash(event.entity)) { - event.isCanceled = true - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt deleted file mode 100644 index 17ebec137..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt +++ /dev/null @@ -1,120 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.RenderMobColoredEvent -import at.hannibal2.skyhanni.events.ResetEntityHurtEvent -import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.Minecraft -import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class MarkedPlayerManager { - - companion object { - val playerNamesToMark = mutableListOf() - private val markedPlayers = mutableMapOf() - - fun command(args: Array) { - if (args.size != 1) { - LorenzUtils.chat("§cUsage: /shmarkplayer ") - return - } - - val displayName = args[0] - val name = displayName.lowercase() - - - if (name == Minecraft.getMinecraft().thePlayer.name.lowercase()) { - LorenzUtils.chat("§c[SkyHanni] 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("§e[SkyHanni] §aMarked §eplayer §b$displayName§e!") - } else { - playerNamesToMark.remove(name) - markedPlayers.remove(name) - LorenzUtils.chat("§e[SkyHanni] §cUnmarked §eplayer §b$displayName§e!") - } - } - - private fun findPlayers() { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityOtherPlayerMP) { - if (entity in markedPlayers.values) continue - - val name = entity.name.lowercase() - if (name in playerNamesToMark) { - markedPlayers[name] = entity - } - } - } - } - - fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark - - fun toggleOwn() { - val ownName = SkyHanniMod.feature.markedPlayers.markOwnName - val name = Minecraft.getMinecraft().thePlayer.name - if (ownName) { - if (!playerNamesToMark.contains(name)) { - playerNamesToMark.add(name) - } - } else { - playerNamesToMark.remove(name) - } - } - } - - var tick = 0 - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return - - if (tick++ % 20 == 0) { - findPlayers() - } - } - - @SubscribeEvent - fun onRenderMobColored(event: RenderMobColoredEvent) { - if (!LorenzUtils.inSkyblock) return - if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return - - val entity = event.entity - if (entity in markedPlayers.values) { - event.color = LorenzColor.YELLOW.toColor().withAlpha(127) - } - } - - @SubscribeEvent - fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { - if (!LorenzUtils.inSkyblock) return - if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return - - val entity = event.entity - if (entity in markedPlayers.values) { - event.shouldReset = true - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - if (Minecraft.getMinecraft().thePlayer == null) return - - markedPlayers.clear() - if (SkyHanniMod.feature.markedPlayers.markOwnName) { - val name = Minecraft.getMinecraft().thePlayer.name - if (!playerNamesToMark.contains(name)) { - playerNamesToMark.add(name) - } - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt deleted file mode 100644 index 5ac2a00dd..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/NonGodPotEffectDisplay.kt +++ /dev/null @@ -1,208 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent -import at.hannibal2.skyhanni.test.GriffinJavaUtils -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.RenderUtils.renderStrings -import at.hannibal2.skyhanni.utils.StringUtils -import net.minecraft.network.play.server.S30PacketWindowItems -import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent -import java.util.regex.Pattern - -class NonGodPotEffectDisplay { - - private var checkFooter = false - private val activeEffects = mutableMapOf() - private val textToRender = mutableListOf() - private var lastTick = 0L - - private var nonGodPotEffects = mapOf( - "smoldering_polarization" to "§aSmoldering Polarization I", - "mushed_glowy_tonic" to "§2Mushed Glowy Tonic I", - "wisp_ice" to "§bWisp's Ice-Flavored Water I", - ) - - private var patternEffectsCount = Pattern.compile("§7You have §e(\\d+) §7non-god effects\\.") - private var totalEffectsCount = 0 - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (event.message == "§aYou ate a §r§aRe-heated Gummy Polar Bear§r§a!") { - checkFooter = true - activeEffects["§aSmoldering Polarization I"] = System.currentTimeMillis() + 1000 * 60 * 60 - format() - } - - if (event.message == "§a§lBUFF! §fYou have gained §r§2Mushed Glowy Tonic I§r§f! Press TAB or type /effects to view your active effects!") { - checkFooter = true - activeEffects["§2Mushed Glowy Tonic I"] = System.currentTimeMillis() + 1000 * 60 * 60 - format() - } - - if (event.message == "§a§lBUFF! §fYou splashed yourself with §r§bWisp's Ice-Flavored Water I§r§f! Press TAB or type /effects to view your active effects!") { - checkFooter = true - activeEffects["§bWisp's Ice-Flavored Water I"] = System.currentTimeMillis() + 1000 * 60 * 5 - format() - } - } - - private fun format() { - val now = System.currentTimeMillis() - textToRender.clear() - if (activeEffects.values.removeIf { now > it }) { - //to fetch the real amount of active pots - totalEffectsCount = 0 - checkFooter = true - } - for (effect in GriffinJavaUtils.sortByValue(activeEffects)) { - val label = effect.key - val until = effect.value - val seconds = (until - now) / 1000 - val format = StringUtils.formatDuration(seconds) - - val color = colorForTime(seconds) - - textToRender.add("$label $color$format") - } - val diff = totalEffectsCount - activeEffects.size - if (diff > 0) { - textToRender.add("§eOpen the /effects inventory") - textToRender.add("§eto show the missing $diff effects!") - checkFooter = true - } - } - - private fun colorForTime(seconds: Long): String { - return if (seconds <= 60) { - "§c" - } else if (seconds <= 60 * 3) { - "§6" - } else if (seconds <= 60 * 10) { - "§e" - } else { - "§f" - } - } - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return - if (lastTick + 1_000 > System.currentTimeMillis()) return - lastTick = System.currentTimeMillis() - - format() - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - checkFooter = true - } - - @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { - val packet = event.packet - if (packet is S30PacketWindowItems) { - for (stack in packet.itemStacks) { - val name = stack?.name ?: continue - if (name in nonGodPotEffects.values) { - for (line in stack.getLore()) { - if (line.contains("Remaining")) { - val duration = readDuration(line.split("§f")[1]) - activeEffects[name] = System.currentTimeMillis() + duration - format() - } - } - } - } - } - - if (!checkFooter) return - if (packet is S47PacketPlayerListHeaderFooter) { - val formattedText = packet.footer.formattedText - val lines = formattedText.replace("§r", "").split("\n") - - if (!lines.any { it.contains("§a§lActive Effects") }) return - checkFooter = false - - var effectsCount = 0 - for (line in lines) { - if (line.startsWith("§2Mushed Glowy Tonic I")) { - val duration = readDuration(line.split("§f")[1]) - activeEffects["§2Mushed Glowy Tonic I"] = System.currentTimeMillis() + duration - format() - } - val matcher = patternEffectsCount.matcher(line) - if (matcher.matches()) { - val group = matcher.group(1) - effectsCount = group.toInt() - } - } - totalEffectsCount = effectsCount - } - } - - private fun readDuration(text: String): Int { - val split = text.split(":") - return when (split.size) { - 3 -> { - val hours = split[0].toInt() * 1000 * 60 * 60 - val minutes = split[1].toInt() * 1000 * 60 - val seconds = split[2].toInt() * 1000 - seconds + minutes + hours - } - - 2 -> { - val minutes = split[0].toInt() * 1000 * 60 - val seconds = split[1].toInt() * 1000 - seconds + minutes - } - - 1 -> { - split[0].toInt() * 1000 - } - - else -> { - throw RuntimeException("Invalid format: '$text'") - } - } - } - - @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!isEnabled()) return - - SkyHanniMod.feature.misc.nonGodPotEffectPos.renderStrings(textToRender) - } - - @SubscribeEvent - fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { - val profileData = event.profileData - val effects = profileData["active_effects"]?.asJsonArray ?: return - for (element in effects) { - val effect = element.asJsonObject - val name = effect["effect"].asString - val label = nonGodPotEffects[name] ?: continue - - val time = effect["ticks_remaining"].asLong / 20 - val newValue = System.currentTimeMillis() + time * 1000 - val old = activeEffects.getOrDefault(label, 0) - val diff = newValue - old - activeEffects[label] = newValue - } - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.nonGodPotEffectDisplay && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt deleted file mode 100644 index a3c9e9685..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt +++ /dev/null @@ -1,25 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.text.SimpleDateFormat - -class RealTime { - - private val format = SimpleDateFormat("HH:mm:ss") - - @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!isEnabled()) return - - SkyHanniMod.feature.misc.realTimePos.renderString(format.format(System.currentTimeMillis())) - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.realTime - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt deleted file mode 100644 index 20fd10f6a..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/ThunderSparksHighlight.kt +++ /dev/null @@ -1,67 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled -import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt -import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture -import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils.drawString -import at.hannibal2.skyhanni.utils.SpecialColour -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft -import net.minecraft.entity.item.EntityArmorStand -import net.minecraft.init.Blocks -import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent -import java.awt.Color - -class ThunderSparksHighlight { - - private val texture = - "ewogICJ0aW1lc3RhbXAiIDogMTY0MzUwNDM3MjI1NiwKICAicHJvZmlsZUlkIiA6ICI2MzMyMDgwZTY3YTI0Y2MxYjE3ZGJhNzZmM2MwMGYxZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUZWFtSHlkcmEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2IzMzI4ZDNlOWQ3MTA0MjAzMjI1NTViMTcyMzkzMDdmMTIyNzBhZGY4MWJmNjNhZmM1MGZhYTA0YjVjMDZlMSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" - private val sparks = mutableListOf() - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return - - Minecraft.getMinecraft().theWorld.loadedEntityList.filter { - it is EntityArmorStand && it !in sparks && it.hasSkullTexture(texture) - }.forEach { sparks.add(it as EntityArmorStand) } - } - - @SubscribeEvent - fun onRenderWorld(event: RenderWorldLastEvent) { - if (!isEnabled()) return - - val special = SkyHanniMod.feature.fishing.thunderSparkColor - val color = Color(SpecialColour.specialToChromaRGB(special), true) - - val playerLocation = LocationUtils.playerLocation() - for (spark in sparks) { - if (spark.isDead) continue - val sparkLocation = spark.getLorenzVec() - val block = sparkLocation.getBlockAt() - val seeThroughBlocks = - sparkLocation.distance(LocationUtils.playerLocation()) < 6 && (block == Blocks.flowing_lava || block == Blocks.lava) - event.drawWaypointFilled( - sparkLocation.add(-0.5, 0.0, -0.5), color, extraSize = -0.25, seeThroughBlocks = seeThroughBlocks - ) - if (sparkLocation.distance(playerLocation) < 10) { - event.drawString(sparkLocation.add(0.0, 1.5, 0.0), "Thunder Spark", seeThroughBlocks = seeThroughBlocks) - } - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - sparks.clear() - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.fishing.thunderSparkHighlight - } -} \ No newline at end of file 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 891249c23..2bcf36102 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.features.MarkedPlayerManager +import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor 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 5072152a7..7967fddba 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 @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.chat.playerchat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.features.MarkedPlayerManager +import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import net.minecraft.util.ChatComponentText import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt new file mode 100644 index 000000000..b54cff9da --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -0,0 +1,51 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigEditor +import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.gui.GuiButton +import net.minecraft.client.gui.GuiIngameMenu +import net.minecraftforge.client.event.GuiScreenEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class ButtonOnPause { + private val buttonId = System.nanoTime().toInt() + + @SubscribeEvent + fun onGuiAction(event: GuiScreenEvent.ActionPerformedEvent.Post) { + if (!LorenzUtils.isOnHypixel) return + + if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) { + SkyHanniMod.screenToOpen = GuiScreenElementWrapper( + ConfigEditor( + SkyHanniMod.feature + ) + ) + } + } + + @SubscribeEvent + fun onGuiInitPost(event: GuiScreenEvent.InitGuiEvent.Post) { + if (!LorenzUtils.isOnHypixel) return + + if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu) { + val x = event.gui.width - 105 + val x2 = x + 100 + var y = event.gui.height - 22 + var y2 = y + 20 + val sorted = event.buttonList.sortedWith { a, b -> b.yPosition + b.height - a.yPosition + a.height } + for (button in sorted) { + val otherX = button.xPosition + val otherX2 = button.xPosition + button.width + val otherY = button.yPosition + val otherY2 = button.yPosition + button.height + if (otherX2 > x && otherX < x2 && otherY2 > y && otherY < y2) { + y = otherY - 20 - 2 + y2 = y + 20 + } + } + event.buttonList.add(GuiButton(buttonId, x, 0.coerceAtLeast(y), 100, 20, "SkyHanni")) + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt new file mode 100644 index 000000000..277ecafb6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt @@ -0,0 +1,194 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent +import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.bazaar.BazaarData +import at.hannibal2.skyhanni.test.GriffinJavaUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import net.minecraft.client.Minecraft +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class CollectionCounter { + + private val RECENT_GAIN_TIME = 1_500 + + companion object { + + private var display = "" + + private var itemName = "" + private var itemApiName = "" + private var itemAmount = -1 + + private var lastAmountInInventory = -1 + + private var recentGain = 0 + private var lastGainTime = -1L + + private val apiCollectionData = mutableMapOf() + + fun command(args: Array) { + if (args.isEmpty()) { + if (itemName == "") { + LorenzUtils.chat("§c/shtrackcollection ") + return + } + LorenzUtils.chat("§e[SkyHanni] Stopped collection tracker.") + apiCollectionData[itemApiName] = itemAmount + resetData() + return + } + + var name = args.joinToString(" ") + + var data: BazaarData? = null + for (bazaarData in BazaarApi.bazaarMap.values) { + if (bazaarData.itemName.equals(name, ignoreCase = true)) { + data = bazaarData + break + } + } + + if (data == null) { + LorenzUtils.chat("§c[SkyHanni] Item '$name' not found!") + return + } + name = data.itemName + + val apiName = data.apiName + if (!apiCollectionData.contains(apiName)) { + LorenzUtils.chat("§c[SkyHanni] Item $name not in collection data!") + return + } + + if (itemAmount != -1) { + resetData() + } + + itemName = name + itemApiName = apiName + itemAmount = apiCollectionData[apiName]!! + + lastAmountInInventory = countCurrentlyInInventory() + updateDisplay() + LorenzUtils.chat("§e[SkyHanni] Started tracking $itemName collection.") + } + + private fun resetData() { + itemAmount = -1 + itemName = "" + itemApiName = "" + + lastAmountInInventory = -1 + display = "" + + recentGain = 0 + } + + private fun updateDisplay() { + val format = GriffinJavaUtils.formatInteger(itemAmount) + + var gainText = "" + if (recentGain != 0) { + gainText = "§a+" + GriffinJavaUtils.formatInteger(recentGain) + } + + display = "$itemName collection: §e$format $gainText" + } + + private fun countCurrentlyInInventory(): Int { + var currentlyInInventory = 0 + val player = Minecraft.getMinecraft().thePlayer + for (stack in player.inventory.mainInventory) { + if (stack == null) continue + val internalName = stack.getInternalName() + if (internalName == itemApiName) { + currentlyInInventory += stack.stackSize + } + } + return currentlyInInventory + } + } + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + val thePlayer = Minecraft.getMinecraft().thePlayer ?: return + thePlayer.worldObj ?: return + + compareInventory() + updateGain() + } + + private fun compareInventory() { + if (lastAmountInInventory == -1) return + if (Minecraft.getMinecraft().currentScreen != null) return + + val currentlyInInventory = countCurrentlyInInventory() + val diff = currentlyInInventory - lastAmountInInventory + if (diff != 0) { + if (diff > 0) { + gainItems(diff) + } else { + LorenzUtils.debug("Collection counter! Negative collection change: $diff") + } + } + + lastAmountInInventory = currentlyInInventory + } + + private fun updateGain() { + if (recentGain != 0) { + if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { + recentGain = 0 + updateDisplay() + } + } + } + + private fun gainItems(amount: Int) { + itemAmount += amount + + if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { + recentGain = 0 + } + lastGainTime = System.currentTimeMillis() + recentGain += amount + + updateDisplay() + } + + @SubscribeEvent + fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { + val profileData = event.profileData + val collection = profileData["collection"].asJsonObject + + apiCollectionData.clear() + for (entry in collection.entrySet()) { + val name = entry.key + val value = entry.value.asInt + apiCollectionData[name] = value + if (name == itemApiName) { + val diff = value - itemAmount + if (diff != 0) { + LorenzUtils.debug("Collection counter was wrong by $diff items. (Compared against API data)") + } + itemAmount = value + recentGain = 0 + updateDisplay() + } + } + } + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + if (!LorenzUtils.inSkyblock) return + + SkyHanniMod.feature.misc.collectionCounterPos.renderString(display) + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactBingoChat.kt new file mode 100644 index 000000000..a4becd8c4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactBingoChat.kt @@ -0,0 +1,112 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CompactBingoChat { + + private var blockedSkillLevelUp = false + private var blockedCollectionLevelUp = false + private var collectionLevelUpLastLine: String? = null + private var newArea = 0//0 = nothing, 1 = after first message, 2 = after second message + private var blockedBestiarity = false + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.isBingoProfile) return + if (!SkyHanniMod.feature.bingo.compactChatMessages) return + + onSkillLevelUp(event) + onCollectionLevelUp(event) + onNewAreaDiscovered(event) + onBestiarityUpgrade(event) + } + + private fun onSkillLevelUp(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith(" §r§b§lSKILL LEVEL UP ")) { + blockedSkillLevelUp = true + return + } + if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedSkillLevelUp = false + return + } + + if (blockedSkillLevelUp) { + if (!message.contains("Access to") && !message.endsWith(" Enchantment")) { + event.blockedReason = "compact skill level up" + } + } + } + + private fun onCollectionLevelUp(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith(" §r§6§lCOLLECTION LEVEL UP ")) { + blockedCollectionLevelUp = true + return + } + if (message == "§e§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedCollectionLevelUp = false + return + } + + if (blockedCollectionLevelUp) { + if (message.contains("Trade") || message.contains("Recipe")) { + var text = message.removeColor().replace(" ", "") + if (text == "Trade" || text == "Recipe") { + collectionLevelUpLastLine?.let { LorenzUtils.chat(it) } + } + } else { + event.blockedReason = "compact collection level up" + collectionLevelUpLastLine = message + } + } + } + + private fun onNewAreaDiscovered(event: LorenzChatEvent) { + var message = event.message + + if (message == " §r§6§lNEW AREA DISCOVERED!") { + newArea = 1 + println("new area $newArea $message") + return + } + + if (message != "") { + if (newArea == 1) { + newArea = 2 + println("new area $newArea $message") + return + } + + if (newArea == 2) { + if (message.startsWith("§7 ■ §r") || message.startsWith(" §r")) { + event.blockedReason = "compact new area discovered" + } else { + newArea = 0 + println("new area $newArea $message") + } + } + } + } + + private fun onBestiarityUpgrade(event: LorenzChatEvent) { + val message = event.message + if (message.startsWith(" §r§3§lBESTIARY §b§l")) { + blockedBestiarity = true + return + } + if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedBestiarity = false + return + } + + if (blockedBestiarity) { + event.blockedReason = "compact bestiarity upgrade" + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt new file mode 100644 index 000000000..2f7bc254c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.util.ChatComponentText +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class CompactSplashPotionMessage { + + private val POTION_EFFECT_PATTERN = + Pattern.compile("§a§lBUFF! §fYou have gained §r(.*)§r§f! Press TAB or type /effects to view your active effects!") + + private val POTION_EFFECT_OTHERS_PATTERN = + Pattern.compile("§a§lBUFF! §fYou were splashed by (.*) §fwith §r(.*)§r§f! Press TAB or type /effects to view your active effects!") + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyblock || !SkyHanniMod.feature.chat.compactPotionMessage) return + + var matcher = POTION_EFFECT_PATTERN.matcher(event.message) + if (matcher.matches()) { + val name = matcher.group(1) + event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$name") + } + + matcher = POTION_EFFECT_OTHERS_PATTERN.matcher(event.message) + if (matcher.matches()) { + val playerName = matcher.group(1) + val effectName = matcher.group(2) + event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$effectName §7(by $playerName§7)") + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt new file mode 100644 index 000000000..b831bc927 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt @@ -0,0 +1,61 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import net.minecraft.entity.EntityLivingBase +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CorruptedMobHighlight { + + private val corruptedMobs = mutableListOf() + + @SubscribeEvent + fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) { + if (!LorenzUtils.inSkyblock) return + + val entity = event.entity + if (entity in corruptedMobs) return + + val baseMaxHealth = entity.baseMaxHealth.toFloat() + if (event.health == baseMaxHealth * 3) { + corruptedMobs.add(entity) + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in corruptedMobs) { + event.color = LorenzColor.DARK_PURPLE.toColor().withAlpha(127) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in corruptedMobs) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + corruptedMobs.clear() + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.corruptedMobHighlight && + LorenzUtils.skyBlockIsland != "Private Island" + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt new file mode 100644 index 000000000..53f56c37c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -0,0 +1,48 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.between +import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CurrentPetDisplay { + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyblock) return + + var blocked = false + + val message = event.message + if (message.matchRegex("§aYou summoned your §r(.*)§r§a!")) { + SkyHanniMod.feature.hidden.currentPet = message.between("your §r", "§r§a") + blocked = true + } + if (message.matchRegex("§cAutopet §eequipped your §7(.*)§e! §a§lVIEW RULE")) { + SkyHanniMod.feature.hidden.currentPet = message.between("] ", "§e!") + blocked = true + } + if (message.matchRegex("§aYou despawned your §r(.*)§r§a!")) { + SkyHanniMod.feature.hidden.currentPet = "" + blocked = true + } + + if (blocked && SkyHanniMod.feature.misc.petDisplay) { + event.blockedReason = "pets" + } + } + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + if (!LorenzUtils.inSkyblock) return + + if (!SkyHanniMod.feature.misc.petDisplay) return + + SkyHanniMod.feature.misc.petDisplayPos.renderString(SkyHanniMod.feature.hidden.currentPet) + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt new file mode 100644 index 000000000..99ccb4cea --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.item.EntityXPOrb +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class ExpBottleOnGroundHider { + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.misc.hideExpBottles) return + + if (event.entity is EntityXPOrb) { + event.isCanceled = true + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt new file mode 100644 index 000000000..b6623331d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt @@ -0,0 +1,216 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraft.client.entity.EntityPlayerSP +import net.minecraft.client.gui.inventory.GuiInventory +import net.minecraft.entity.player.EntityPlayer +import net.minecraft.item.ItemStack +import net.minecraft.network.play.server.S04PacketEntityEquipment +import net.minecraft.network.play.server.S2FPacketSetSlot +import net.minecraft.network.play.server.S30PacketWindowItems +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class HideArmor { + + private var invOpen = false + private val laterCheck = mutableListOf() + + @SubscribeEvent + fun onGuiInventoryToggle(event: TickEvent.ClientTickEvent) { + if (!LorenzUtils.inSkyblock) return // TODO test this + + fixOtherArmor() + + if (!SkyHanniMod.feature.misc.hideArmorEnabled) return + + val currentScreen = Minecraft.getMinecraft().currentScreen + if (currentScreen == null || currentScreen !is GuiInventory) { + if (invOpen) { + invOpen = false + changeArmor(Minecraft.getMinecraft().thePlayer, null) + } + } else { + if (!invOpen) { + invOpen = true + val thePlayer = Minecraft.getMinecraft().thePlayer + val entityId = thePlayer.entityId + changeArmor(thePlayer, getCachedArmor(entityId)) + } + } + } + + // Since S04PacketEntityEquipment gets sent before the entity is fully loaded, I need to remove the armor later + private fun fixOtherArmor() { + for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { + if (entity !is EntityOtherPlayerMP) continue + + val entityId = entity.entityId + if (entityId !in laterCheck) continue + + laterCheck.remove(entityId) + if (SkyHanniMod.feature.misc.hideArmorEnabled) { + val armorInventory = entity.inventory.armorInventory + for ((equipmentSlot, _) in armorInventory.withIndex()) { + if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || equipmentSlot == 3) { + armorInventory[equipmentSlot] = null + } + } + } + } + } + + @SubscribeEvent + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { + val packet = event.packet + + //own player world switch + if (packet is S30PacketWindowItems) { + + // check window id + if (packet.func_148911_c() != 0) return + + for ((slot, itemStack) in packet.itemStacks.withIndex()) { + + if (slot !in 5..8) continue + + val armorSlot = (slot - 5) * -1 + 3 + val armor = getCachedArmor(Minecraft.getMinecraft().thePlayer.entityId) + armor[armorSlot] = itemStack + + val currentScreen = Minecraft.getMinecraft().currentScreen + if (currentScreen == null || currentScreen !is GuiInventory) { + if (SkyHanniMod.feature.misc.hideArmorEnabled) { + if (SkyHanniMod.feature.misc.hideArmorOwn) { + if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || armorSlot == 3) { + packet.itemStacks[slot] = null + } + } + } + } + } + return + } + + + //own player armor change + if (packet is S2FPacketSetSlot) { + val slot = packet.func_149173_d() + + // check window id + if (packet.func_149175_c() != 0) return + if (slot !in 5..8) return + + val armorSlot = (slot - 5) * -1 + 3 + val armor = getCachedArmor(Minecraft.getMinecraft().thePlayer.entityId) + // set item in cache + armor[armorSlot] = packet.func_149174_e() + + val currentScreen = Minecraft.getMinecraft().currentScreen + if (currentScreen == null || currentScreen !is GuiInventory) { + if (SkyHanniMod.feature.misc.hideArmorEnabled) { + if (SkyHanniMod.feature.misc.hideArmorOwn) { + if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || armorSlot == 3) { + event.isCanceled = true + } + } + } + } + return + } + + + //other player armor switch + if (packet is S04PacketEntityEquipment) { + val entityID = packet.entityID + val equipmentSlot = packet.equipmentSlot - 1 + if (equipmentSlot == -1) return + + val entity = Minecraft.getMinecraft().theWorld?.getEntityByID(entityID) + if (entity == null) { + laterCheck.add(entityID) + return + } + + if (entity !is EntityOtherPlayerMP) return + + val armor = getCachedArmor(entityID) + + // set item in cache + armor[equipmentSlot] = packet.itemStack + + if (SkyHanniMod.feature.misc.hideArmorEnabled) { + if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet || equipmentSlot == 3) { + event.isCanceled = true + } + } + } + } + + private fun getCachedArmor(entityID: Int): Array { + val armor: Array = if (armorCache.containsKey(entityID)) { + armorCache[entityID]!! + } else { + val new = arrayOf(null, null, null, null) + armorCache[entityID] = new + new + } + return armor + } + + companion object { + var armorCache: MutableMap> = mutableMapOf() + + fun updateArmor() { + for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { + if (entity !is EntityPlayer) continue + + val entityId = entity.entityId + armorCache[entityId]?.let { + changeArmor(entity, it) + } + + if (SkyHanniMod.feature.misc.hideArmorEnabled) { + changeArmor(entity, null) + } + } + } + + private fun changeArmor(entity: EntityPlayer, new: Array?) { + if (!LorenzUtils.inSkyblock) return + + val current = entity.inventory.armorInventory + if (new != null) { + current[0] = new[0] + current[1] = new[1] + current[2] = new[2] + current[3] = new[3] + return + } + + if (!SkyHanniMod.feature.misc.hideArmorOwn) { + if (entity is EntityPlayerSP) { + return + } + } + + if (!SkyHanniMod.feature.misc.hideArmorOnlyHelmet) { + current[0] = null + current[1] = null + current[2] = null + } + current[3] = null + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + armorCache.clear() + laterCheck.clear() + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt new file mode 100644 index 000000000..8c4a0fcac --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt @@ -0,0 +1,22 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.EntityLivingBase +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class HideDamageSplash { + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderDamage(event: RenderLivingEvent.Specials.Pre) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.misc.hideDamageSplash) return + + if (DamageIndicatorManager.isDamageSplash(event.entity)) { + event.isCanceled = true + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt new file mode 100644 index 000000000..38e3babbc --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -0,0 +1,120 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class MarkedPlayerManager { + + companion object { + val playerNamesToMark = mutableListOf() + private val markedPlayers = mutableMapOf() + + fun command(args: Array) { + if (args.size != 1) { + LorenzUtils.chat("§cUsage: /shmarkplayer ") + return + } + + val displayName = args[0] + val name = displayName.lowercase() + + + if (name == Minecraft.getMinecraft().thePlayer.name.lowercase()) { + LorenzUtils.chat("§c[SkyHanni] 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("§e[SkyHanni] §aMarked §eplayer §b$displayName§e!") + } else { + playerNamesToMark.remove(name) + markedPlayers.remove(name) + LorenzUtils.chat("§e[SkyHanni] §cUnmarked §eplayer §b$displayName§e!") + } + } + + private fun findPlayers() { + for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { + if (entity is EntityOtherPlayerMP) { + if (entity in markedPlayers.values) continue + + val name = entity.name.lowercase() + if (name in playerNamesToMark) { + markedPlayers[name] = entity + } + } + } + } + + fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark + + fun toggleOwn() { + val ownName = SkyHanniMod.feature.markedPlayers.markOwnName + val name = Minecraft.getMinecraft().thePlayer.name + if (ownName) { + if (!playerNamesToMark.contains(name)) { + playerNamesToMark.add(name) + } + } else { + playerNamesToMark.remove(name) + } + } + } + + var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!LorenzUtils.inSkyblock) return + + if (tick++ % 20 == 0) { + findPlayers() + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return + + val entity = event.entity + if (entity in markedPlayers.values) { + event.color = LorenzColor.YELLOW.toColor().withAlpha(127) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return + + val entity = event.entity + if (entity in markedPlayers.values) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + if (Minecraft.getMinecraft().thePlayer == null) return + + markedPlayers.clear() + if (SkyHanniMod.feature.markedPlayers.markOwnName) { + val name = Minecraft.getMinecraft().thePlayer.name + if (!playerNamesToMark.contains(name)) { + playerNamesToMark.add(name) + } + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt new file mode 100644 index 000000000..9f91e1c82 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -0,0 +1,208 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent +import at.hannibal2.skyhanni.test.GriffinJavaUtils +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.RenderUtils.renderStrings +import at.hannibal2.skyhanni.utils.StringUtils +import net.minecraft.network.play.server.S30PacketWindowItems +import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import java.util.regex.Pattern + +class NonGodPotEffectDisplay { + + private var checkFooter = false + private val activeEffects = mutableMapOf() + private val textToRender = mutableListOf() + private var lastTick = 0L + + private var nonGodPotEffects = mapOf( + "smoldering_polarization" to "§aSmoldering Polarization I", + "mushed_glowy_tonic" to "§2Mushed Glowy Tonic I", + "wisp_ice" to "§bWisp's Ice-Flavored Water I", + ) + + private var patternEffectsCount = Pattern.compile("§7You have §e(\\d+) §7non-god effects\\.") + private var totalEffectsCount = 0 + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (event.message == "§aYou ate a §r§aRe-heated Gummy Polar Bear§r§a!") { + checkFooter = true + activeEffects["§aSmoldering Polarization I"] = System.currentTimeMillis() + 1000 * 60 * 60 + format() + } + + if (event.message == "§a§lBUFF! §fYou have gained §r§2Mushed Glowy Tonic I§r§f! Press TAB or type /effects to view your active effects!") { + checkFooter = true + activeEffects["§2Mushed Glowy Tonic I"] = System.currentTimeMillis() + 1000 * 60 * 60 + format() + } + + if (event.message == "§a§lBUFF! §fYou splashed yourself with §r§bWisp's Ice-Flavored Water I§r§f! Press TAB or type /effects to view your active effects!") { + checkFooter = true + activeEffects["§bWisp's Ice-Flavored Water I"] = System.currentTimeMillis() + 1000 * 60 * 5 + format() + } + } + + private fun format() { + val now = System.currentTimeMillis() + textToRender.clear() + if (activeEffects.values.removeIf { now > it }) { + //to fetch the real amount of active pots + totalEffectsCount = 0 + checkFooter = true + } + for (effect in GriffinJavaUtils.sortByValue(activeEffects)) { + val label = effect.key + val until = effect.value + val seconds = (until - now) / 1000 + val format = StringUtils.formatDuration(seconds) + + val color = colorForTime(seconds) + + textToRender.add("$label $color$format") + } + val diff = totalEffectsCount - activeEffects.size + if (diff > 0) { + textToRender.add("§eOpen the /effects inventory") + textToRender.add("§eto show the missing $diff effects!") + checkFooter = true + } + } + + private fun colorForTime(seconds: Long): String { + return if (seconds <= 60) { + "§c" + } else if (seconds <= 60 * 3) { + "§6" + } else if (seconds <= 60 * 10) { + "§e" + } else { + "§f" + } + } + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + if (lastTick + 1_000 > System.currentTimeMillis()) return + lastTick = System.currentTimeMillis() + + format() + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + checkFooter = true + } + + @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) + fun onChatPacket(event: PacketEvent.ReceiveEvent) { + val packet = event.packet + if (packet is S30PacketWindowItems) { + for (stack in packet.itemStacks) { + val name = stack?.name ?: continue + if (name in nonGodPotEffects.values) { + for (line in stack.getLore()) { + if (line.contains("Remaining")) { + val duration = readDuration(line.split("§f")[1]) + activeEffects[name] = System.currentTimeMillis() + duration + format() + } + } + } + } + } + + if (!checkFooter) return + if (packet is S47PacketPlayerListHeaderFooter) { + val formattedText = packet.footer.formattedText + val lines = formattedText.replace("§r", "").split("\n") + + if (!lines.any { it.contains("§a§lActive Effects") }) return + checkFooter = false + + var effectsCount = 0 + for (line in lines) { + if (line.startsWith("§2Mushed Glowy Tonic I")) { + val duration = readDuration(line.split("§f")[1]) + activeEffects["§2Mushed Glowy Tonic I"] = System.currentTimeMillis() + duration + format() + } + val matcher = patternEffectsCount.matcher(line) + if (matcher.matches()) { + val group = matcher.group(1) + effectsCount = group.toInt() + } + } + totalEffectsCount = effectsCount + } + } + + private fun readDuration(text: String): Int { + val split = text.split(":") + return when (split.size) { + 3 -> { + val hours = split[0].toInt() * 1000 * 60 * 60 + val minutes = split[1].toInt() * 1000 * 60 + val seconds = split[2].toInt() * 1000 + seconds + minutes + hours + } + + 2 -> { + val minutes = split[0].toInt() * 1000 * 60 + val seconds = split[1].toInt() * 1000 + seconds + minutes + } + + 1 -> { + split[0].toInt() * 1000 + } + + else -> { + throw RuntimeException("Invalid format: '$text'") + } + } + } + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + if (!isEnabled()) return + + SkyHanniMod.feature.misc.nonGodPotEffectPos.renderStrings(textToRender) + } + + @SubscribeEvent + fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { + val profileData = event.profileData + val effects = profileData["active_effects"]?.asJsonArray ?: return + for (element in effects) { + val effect = element.asJsonObject + val name = effect["effect"].asString + val label = nonGodPotEffects[name] ?: continue + + val time = effect["ticks_remaining"].asLong / 20 + val newValue = System.currentTimeMillis() + time * 1000 + val old = activeEffects.getOrDefault(label, 0) + val diff = newValue - old + activeEffects[label] = newValue + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.nonGodPotEffectDisplay && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt new file mode 100644 index 000000000..8d7fafb1f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.text.SimpleDateFormat + +class RealTime { + + private val format = SimpleDateFormat("HH:mm:ss") + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + if (!isEnabled()) return + + SkyHanniMod.feature.misc.realTimePos.renderString(format.format(System.currentTimeMillis())) + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.realTime + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt new file mode 100644 index 000000000..c7432ffa9 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt @@ -0,0 +1,67 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture +import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawString +import at.hannibal2.skyhanni.utils.SpecialColour +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.client.Minecraft +import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.init.Blocks +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import java.awt.Color + +class ThunderSparksHighlight { + + private val texture = + "ewogICJ0aW1lc3RhbXAiIDogMTY0MzUwNDM3MjI1NiwKICAicHJvZmlsZUlkIiA6ICI2MzMyMDgwZTY3YTI0Y2MxYjE3ZGJhNzZmM2MwMGYxZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUZWFtSHlkcmEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2IzMzI4ZDNlOWQ3MTA0MjAzMjI1NTViMTcyMzkzMDdmMTIyNzBhZGY4MWJmNjNhZmM1MGZhYTA0YjVjMDZlMSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" + private val sparks = mutableListOf() + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + Minecraft.getMinecraft().theWorld.loadedEntityList.filter { + it is EntityArmorStand && it !in sparks && it.hasSkullTexture(texture) + }.forEach { sparks.add(it as EntityArmorStand) } + } + + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!isEnabled()) return + + val special = SkyHanniMod.feature.fishing.thunderSparkColor + val color = Color(SpecialColour.specialToChromaRGB(special), true) + + val playerLocation = LocationUtils.playerLocation() + for (spark in sparks) { + if (spark.isDead) continue + val sparkLocation = spark.getLorenzVec() + val block = sparkLocation.getBlockAt() + val seeThroughBlocks = + sparkLocation.distance(LocationUtils.playerLocation()) < 6 && (block == Blocks.flowing_lava || block == Blocks.lava) + event.drawWaypointFilled( + sparkLocation.add(-0.5, 0.0, -0.5), color, extraSize = -0.25, seeThroughBlocks = seeThroughBlocks + ) + if (sparkLocation.distance(playerLocation) < 10) { + event.drawString(sparkLocation.add(0.0, 1.5, 0.0), "Thunder Spark", seeThroughBlocks = seeThroughBlocks) + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + sparks.clear() + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.fishing.thunderSparkHighlight + } +} \ No newline at end of file -- cgit From 62f0750771748571d4f2f8f02f8b77a186c2d4c0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 02:28:50 +0100 Subject: renamed register event to module --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 176 ++++++++++----------- .../java/at/hannibal2/skyhanni/test/LorenzTest.kt | 18 +-- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 893792936..c59444b99 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -70,7 +70,7 @@ public class SkyHanniMod { public static ConfigManager configManager; private static Logger logger; - public static List listenerClasses = new ArrayList<>(); + public static List modules = new ArrayList<>(); public static Job globalJob = JobKt.Job(null); public static CoroutineScope coroutineScope = CoroutineScopeKt.CoroutineScope( @@ -84,97 +84,97 @@ public class SkyHanniMod { //API and utils new BazaarApi(); - registerEvent(this); - registerEvent(new ChatManager()); - registerEvent(new HypixelData()); - registerEvent(new DungeonData()); - registerEvent(new ScoreboardData()); - registerEvent(new ApiDataLoader()); - registerEvent(new SeaCreatureManager()); - registerEvent(new ItemRenderBackground()); - registerEvent(new EntityData()); - registerEvent(new EntityMovementData()); - registerEvent(new ItemClickData()); - registerEvent(new MinecraftData()); - registerEvent(new SendTitleHelper()); - registerEvent(new ItemTipHelper()); + loadModule(this); + loadModule(new ChatManager()); + loadModule(new HypixelData()); + loadModule(new DungeonData()); + loadModule(new ScoreboardData()); + loadModule(new ApiDataLoader()); + loadModule(new SeaCreatureManager()); + loadModule(new ItemRenderBackground()); + loadModule(new EntityData()); + loadModule(new EntityMovementData()); + loadModule(new ItemClickData()); + loadModule(new MinecraftData()); + loadModule(new SendTitleHelper()); + loadModule(new ItemTipHelper()); //features - registerEvent(new BazaarOrderHelper()); - registerEvent(new ChatFilter()); - registerEvent(new PlayerChatModifier()); - registerEvent(new DungeonChatFilter()); - registerEvent(new HideNotClickableItems()); - registerEvent(new ItemDisplayOverlayFeatures()); - registerEvent(new CurrentPetDisplay()); - registerEvent(new ExpBottleOnGroundHider()); - registerEvent(new DamageIndicatorManager()); - registerEvent(new ItemAbilityCooldown()); - registerEvent(new DungeonHighlightClickedBlocks()); - registerEvent(new DungeonMilestonesDisplay()); - registerEvent(new DungeonDeathCounter()); - registerEvent(new DungeonCleanEnd()); - registerEvent(new DungeonBossMessages()); - registerEvent(new DungeonBossHideDamageSplash()); - registerEvent(new TrophyFishMessages()); - registerEvent(new BazaarBestSellMethod()); - registerEvent(new AnvilCombineHelper()); - registerEvent(new SeaCreatureMessageShortener()); + loadModule(new BazaarOrderHelper()); + loadModule(new ChatFilter()); + loadModule(new PlayerChatModifier()); + loadModule(new DungeonChatFilter()); + loadModule(new HideNotClickableItems()); + loadModule(new ItemDisplayOverlayFeatures()); + loadModule(new CurrentPetDisplay()); + loadModule(new ExpBottleOnGroundHider()); + loadModule(new DamageIndicatorManager()); + loadModule(new ItemAbilityCooldown()); + loadModule(new DungeonHighlightClickedBlocks()); + loadModule(new DungeonMilestonesDisplay()); + loadModule(new DungeonDeathCounter()); + loadModule(new DungeonCleanEnd()); + loadModule(new DungeonBossMessages()); + loadModule(new DungeonBossHideDamageSplash()); + loadModule(new TrophyFishMessages()); + loadModule(new BazaarBestSellMethod()); + loadModule(new AnvilCombineHelper()); + loadModule(new SeaCreatureMessageShortener()); // registerEvent(new GriffinBurrowFinder()); - registerEvent(new AshfangFreezeCooldown()); - registerEvent(new AshfangNextResetCooldown()); - registerEvent(new SummoningSoulsName()); - registerEvent(new AshfangGravityOrbs()); - registerEvent(new AshfangBlazingSouls()); - registerEvent(new AshfangBlazes()); - registerEvent(new AshfangHideParticles()); - registerEvent(new AshfangHideDamageIndicator()); - registerEvent(new ItemStars()); - registerEvent(new MinionFeatures()); - registerEvent(new RealTime()); - registerEvent(new RngMeterInventory()); - registerEvent(new WikiCommand()); - registerEvent(new SummoningMobManager()); - registerEvent(new VoidlingExtremistColor()); - registerEvent(new MilleniaAgedBlazeColor()); - registerEvent(new CorruptedMobHighlight()); - registerEvent(new MarkedPlayerManager()); - registerEvent(new HighlightSlayerMiniboss()); - registerEvent(new PlayerDeathMessages()); - registerEvent(new HighlightDungeonDeathmite()); - registerEvent(new DungeonHideItems()); - registerEvent(new DungeonCopilot()); - registerEvent(new EndermanSlayerBeacon()); - registerEvent(new FireVeilWandParticles()); - registerEvent(new HideMobNames()); - registerEvent(new HideDamageSplash()); - registerEvent(new ThunderSparksHighlight()); - registerEvent(new BlazeSlayerPillar()); - registerEvent(new BlazeSlayerDaggerHelper()); - registerEvent(new HellionShieldHelper()); - registerEvent(new BlazeSlayerFirePitsWarning()); - registerEvent(new BlazeSlayerClearView()); - registerEvent(new PlayerChatFilter()); - registerEvent(new HideArmor()); - registerEvent(new SlayerQuestWarning()); - registerEvent(new StatsTuning()); - registerEvent(new NonGodPotEffectDisplay()); - registerEvent(new SoopyGuessBurrow()); - registerEvent(new GriffinBurrowHelper()); - registerEvent(new GriffinBurrowParticleFinder()); - registerEvent(new BurrowWarpHelper()); - registerEvent(new CollectionCounter()); - registerEvent(new HighlightBonzoMasks()); - registerEvent(new DungeonLevelColor()); - registerEvent(new BazaarCancelledBuyOrderClipboard()); - registerEvent(new CompactSplashPotionMessage()); - registerEvent(new CroesusUnopenedChestTracker()); - registerEvent(new CompactBingoChat()); + loadModule(new AshfangFreezeCooldown()); + loadModule(new AshfangNextResetCooldown()); + loadModule(new SummoningSoulsName()); + loadModule(new AshfangGravityOrbs()); + loadModule(new AshfangBlazingSouls()); + loadModule(new AshfangBlazes()); + loadModule(new AshfangHideParticles()); + loadModule(new AshfangHideDamageIndicator()); + loadModule(new ItemStars()); + loadModule(new MinionFeatures()); + loadModule(new RealTime()); + loadModule(new RngMeterInventory()); + loadModule(new WikiCommand()); + loadModule(new SummoningMobManager()); + loadModule(new VoidlingExtremistColor()); + loadModule(new MilleniaAgedBlazeColor()); + loadModule(new CorruptedMobHighlight()); + loadModule(new MarkedPlayerManager()); + loadModule(new HighlightSlayerMiniboss()); + loadModule(new PlayerDeathMessages()); + loadModule(new HighlightDungeonDeathmite()); + loadModule(new DungeonHideItems()); + loadModule(new DungeonCopilot()); + loadModule(new EndermanSlayerBeacon()); + loadModule(new FireVeilWandParticles()); + loadModule(new HideMobNames()); + loadModule(new HideDamageSplash()); + loadModule(new ThunderSparksHighlight()); + loadModule(new BlazeSlayerPillar()); + loadModule(new BlazeSlayerDaggerHelper()); + loadModule(new HellionShieldHelper()); + loadModule(new BlazeSlayerFirePitsWarning()); + loadModule(new BlazeSlayerClearView()); + loadModule(new PlayerChatFilter()); + loadModule(new HideArmor()); + loadModule(new SlayerQuestWarning()); + loadModule(new StatsTuning()); + loadModule(new NonGodPotEffectDisplay()); + loadModule(new SoopyGuessBurrow()); + loadModule(new GriffinBurrowHelper()); + loadModule(new GriffinBurrowParticleFinder()); + loadModule(new BurrowWarpHelper()); + loadModule(new CollectionCounter()); + loadModule(new HighlightBonzoMasks()); + loadModule(new DungeonLevelColor()); + loadModule(new BazaarCancelledBuyOrderClipboard()); + loadModule(new CompactSplashPotionMessage()); + loadModule(new CroesusUnopenedChestTracker()); + loadModule(new CompactBingoChat()); Commands.INSTANCE.init(); - registerEvent(new LorenzTest()); - registerEvent(new ButtonOnPause()); + loadModule(new LorenzTest()); + loadModule(new ButtonOnPause()); configManager = new ConfigManager(); configManager.firstLoad(); @@ -186,8 +186,8 @@ public class SkyHanniMod { repo.loadRepoInformation(); } - private void registerEvent(Object object) { - listenerClasses.add(object); + private void loadModule(Object object) { + modules.add(object); MinecraftForge.EVENT_BUS.register(object); } diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 3f1cfa4da..dce81b5df 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -83,25 +83,25 @@ class LorenzTest { emptyList() } - val listeners = SkyHanniMod.listenerClasses - for (oldListener in listeners.toMutableList()) { - val javaClass = oldListener.javaClass + val modules = SkyHanniMod.modules + for (original in modules.toMutableList()) { + val javaClass = original.javaClass val simpleName = javaClass.simpleName - MinecraftForge.EVENT_BUS.unregister(oldListener) + MinecraftForge.EVENT_BUS.unregister(original) println("Unregistered listener $simpleName") if (simpleName !in blockedFeatures) { - listeners.remove(oldListener) - val newListener = javaClass.newInstance() - listeners.add(newListener) + modules.remove(original) + val module = javaClass.newInstance() + modules.add(module) - MinecraftForge.EVENT_BUS.register(newListener) + MinecraftForge.EVENT_BUS.register(module) println("Registered listener $simpleName") } else { println("Skipped registering listener $simpleName") } } - LorenzUtils.chat("§e[SkyHanni] reloaded ${listeners.size} listener classes.") + LorenzUtils.chat("§e[SkyHanni] reloaded ${modules.size} listener classes.") } } -- cgit From 614eb4d782c5940e13df0e50c00cdfeacd55bad0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 02:32:01 +0100 Subject: Renamed hypixel and skyblock. --- src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt | 2 +- src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 10 +++++----- .../java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt | 2 +- src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt | 4 ++-- src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt | 4 ++-- .../at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt | 2 +- .../hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt | 2 +- .../features/bazaar/BazaarCancelledBuyOrderClipboard.kt | 2 +- .../at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt | 2 +- .../java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt | 2 +- .../at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt | 6 +++--- .../features/damageindicator/DamageIndicatorManager.kt | 4 ++-- .../skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt | 2 +- .../hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt | 4 ++-- .../hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt | 2 +- .../hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt | 2 +- .../skyhanni/features/event/diana/BurrowWarpHelper.kt | 2 +- .../features/event/diana/GriffinBurrowParticleFinder.kt | 4 ++-- .../skyhanni/features/fishing/SeaCreatureMessageShortener.kt | 2 +- .../hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt | 2 +- .../skyhanni/features/inventory/HideNotClickableItems.kt | 2 +- .../java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt | 2 +- .../hannibal2/skyhanni/features/inventory/RngMeterInventory.kt | 2 +- .../at/hannibal2/skyhanni/features/inventory/StatsTuning.kt | 2 +- .../skyhanni/features/itemabilities/FireVeilWandParticles.kt | 6 +++--- .../itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 4 ++-- .../at/hannibal2/skyhanni/features/minion/MinionFeatures.kt | 10 +++++----- .../java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt | 4 ++-- .../at/hannibal2/skyhanni/features/misc/CollectionCounter.kt | 2 +- .../skyhanni/features/misc/CompactSplashPotionMessage.kt | 2 +- .../hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt | 4 ++-- .../at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt | 4 ++-- .../hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt | 2 +- src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt | 4 ++-- .../at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt | 2 +- .../at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt | 6 +++--- .../hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt | 2 +- src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt | 2 +- .../hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt | 2 +- .../skyhanni/features/nether/MilleniaAgedBlazeColor.kt | 2 +- .../skyhanni/features/nether/ashfang/AshfangBlazes.kt | 2 +- .../skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt | 2 +- .../skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt | 2 +- .../skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt | 2 +- .../features/nether/ashfang/AshfangHideDamageIndicator.kt | 2 +- .../skyhanni/features/nether/ashfang/AshfangHideParticles.kt | 4 ++-- .../features/nether/ashfang/AshfangNextResetCooldown.kt | 2 +- .../hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt | 2 +- .../java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt | 2 +- .../skyhanni/features/slayer/HighlightSlayerMiniboss.kt | 2 +- .../hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt | 2 +- .../skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt | 4 ++-- .../skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt | 4 ++-- .../features/slayer/blaze/BlazeSlayerFirePitsWarning.kt | 2 +- .../skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt | 2 +- .../skyhanni/features/slayer/blaze/HellionShieldHelper.kt | 4 ++-- .../skyhanni/features/summonings/SummoningMobManager.kt | 8 ++++---- .../skyhanni/features/summonings/SummoningSoulsName.kt | 2 +- .../mixins/transformers/gui/inventory/GuiEditSignMixin.java | 8 ++++---- src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt | 2 +- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 10 +++++----- .../java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt | 2 +- 62 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index 2e4d13da6..30f88f48e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -25,7 +25,7 @@ class EntityMovementData { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return for (entity in entityLocation.keys) { if (entity.isDead) continue diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 8026ecac8..bbb3db69d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -16,7 +16,7 @@ class HypixelData { companion object { var hypixel = false - var skyblock = false + var skyBlock = false var skyBlockIsland: String = "" //Ironman, Stranded and Bingo @@ -49,13 +49,13 @@ class HypixelData { @SubscribeEvent fun onWorldChange(event: WorldEvent.Load) { - skyblock = false + skyBlock = false } @SubscribeEvent fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { hypixel = false - skyblock = false + skyBlock = false } @SubscribeEvent @@ -90,8 +90,8 @@ class HypixelData { checkSidebar() } - if (inSkyBlock == skyblock) return - skyblock = inSkyBlock + if (inSkyBlock == skyBlock) return + skyBlock = inSkyBlock } private fun checkSidebar() { diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt index 9b25933ea..1576ff4ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt @@ -30,7 +30,7 @@ class ItemRenderBackground { @SubscribeEvent fun renderOverlayLol(event: RenderRealOverlayEvent) { val stack = event.stack - if (LorenzUtils.inSkyblock) { + if (LorenzUtils.inSkyBlock) { if (stack != null) { val color = stack.background if (color != -1) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index 69ae9fa2d..30b9ad03f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -20,7 +20,7 @@ class ItemTipHelper { @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { val stack = event.stack ?: return - if (!LorenzUtils.inSkyblock || stack.stackSize != 1) return + if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return // val uuid = stacremovek.getLore().joinToString { ", " } val stackTip: String @@ -51,7 +51,7 @@ class ItemTipHelper { @SubscribeEvent(priority = EventPriority.HIGHEST) fun onRenderInventoryItemOverlayPost(event: DrawScreenAfterEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val gui = Minecraft.getMinecraft().currentScreen if (gui !is GuiChest) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index 16facaf90..f463391e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -13,7 +13,7 @@ class MinecraftData { @SubscribeEvent(receiveCanceled = true) fun onSoundPacket(event: PacketEvent.ReceiveEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val packet = event.packet if (packet !is S29PacketSoundEffect) return @@ -31,7 +31,7 @@ class MinecraftData { @SubscribeEvent(receiveCanceled = true) fun onParticlePacketReceive(event: PacketEvent.ReceiveEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val packet = event.packet if (packet !is S2APacketParticles) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt index b2d397714..9604cb05c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt @@ -14,7 +14,7 @@ class AnvilCombineHelper { @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.inventory.anvilCombineHelper) return if (event.gui !is GuiChest) return 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 c5d8c10a1..eb6d98d31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -78,6 +78,6 @@ class BazaarBestSellMethod { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.bazaar.bestSellMethod + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.bazaar.bestSellMethod } } \ No newline at end of file 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 3943e7d44..9ee430050 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt @@ -53,6 +53,6 @@ class BazaarCancelledBuyOrderClipboard { } fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.bazaar.cancelledBuyOrderClipboard + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.bazaar.cancelledBuyOrderClipboard } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt index 25abe82e1..bcf1b3e48 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt @@ -40,7 +40,7 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap { 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 21703d227..6670a4a3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt @@ -9,7 +9,7 @@ class SeaCreatureMessageShortener { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.fishing.shortenFishingMessage) return val seaCreature = SeaCreatureManager.getSeaCreature(event.message) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt index 99c8b7063..2db229525 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt @@ -40,7 +40,7 @@ class TrophyFishMessages { @SubscribeEvent fun onStatusBar(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.fishing.trophyCounter) return val message = event.message 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 0202566a0..4ec29baf2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -65,7 +65,7 @@ class HideNotClickableItems { @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (isDisabled()) return if (event.gui !is GuiChest) return val guiChest = event.gui 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 4573ffa70..af27b8f45 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -19,7 +19,7 @@ class ItemStars { @SubscribeEvent(priority = EventPriority.LOW) fun onTooltip(event: ItemTooltipEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val stack = event.itemStack ?: return if (stack.stackSize != 1) return 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 feb489349..ec381a124 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt @@ -40,7 +40,7 @@ class RngMeterInventory { @SubscribeEvent(priority = EventPriority.LOW) fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (event.gui !is GuiChest) return val guiChest = event.gui 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 bc1a5c9fd..d33f03042 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -105,7 +105,7 @@ class StatsTuning { @SubscribeEvent(priority = EventPriority.LOW) fun onDrawSelectedTemplate(event: GuiContainerEvent.BackgroundDrawnEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (event.gui !is GuiChest) return val guiChest = event.gui 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 93da7dc7a..c301070af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -19,7 +19,7 @@ class FireVeilWandParticles { @SubscribeEvent fun onChatPacket(event: ReceiveParticleEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (SkyHanniMod.feature.itemAbilities.fireVeilWandDisplay == 0) return if (System.currentTimeMillis() > lastClick + 5_500) return @@ -30,7 +30,7 @@ class FireVeilWandParticles { @SubscribeEvent fun onItemClick(event: ItemClickInHandEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (event.clickType != ItemClickInHandEvent.ClickType.RIGHT_CLICK) return val itemInHand = event.itemInHand ?: return @@ -43,7 +43,7 @@ class FireVeilWandParticles { @SubscribeEvent fun onRenderWorld(event: RenderWorldLastEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (SkyHanniMod.feature.itemAbilities.fireVeilWandDisplay != 1) return if (System.currentTimeMillis() > lastClick + 5_500) return 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 cbd75608a..152acf692 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 @@ -56,7 +56,7 @@ class ItemAbilityCooldown { @SubscribeEvent fun onItemClickSend(event: PacketEvent.SendEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val packet = event.packet if (packet is C07PacketPlayerDigging) { @@ -97,7 +97,7 @@ class ItemAbilityCooldown { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.itemAbilities.itemAbilityCooldown + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.itemAbilities.itemAbilityCooldown } private fun click(ability: ItemAbility) { 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 12ddf6f78..707c36405 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -47,7 +47,7 @@ class MinionFeatures { @SubscribeEvent fun onClick(event: InputEvent.MouseInputEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != "Private Island") return if (!Mouse.getEventButtonState()) return @@ -62,7 +62,7 @@ class MinionFeatures { @SubscribeEvent fun onRenderLastClickedMinion(event: RenderWorldLastEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != "Private Island") return if (!SkyHanniMod.feature.minions.lastClickedMinionDisplay) return @@ -174,7 +174,7 @@ class MinionFeatures { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != "Private Island") return if (event.message.matchRegex("§aYou received §r§6(.*) coins§r§a!")) { @@ -187,7 +187,7 @@ class MinionFeatures { @SubscribeEvent fun onRenderLastEmptied(event: RenderWorldLastEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.minions.emptiedTimeDisplay) return if (LorenzUtils.skyBlockIsland != "Private Island") return @@ -210,7 +210,7 @@ class MinionFeatures { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != "Private Island") return if (!SkyHanniMod.feature.minions.hideMobsNametagNearby) return 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 b54cff9da..d54cd7225 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -14,7 +14,7 @@ class ButtonOnPause { @SubscribeEvent fun onGuiAction(event: GuiScreenEvent.ActionPerformedEvent.Post) { - if (!LorenzUtils.isOnHypixel) return + if (!LorenzUtils.isHyPixel) return if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) { SkyHanniMod.screenToOpen = GuiScreenElementWrapper( @@ -27,7 +27,7 @@ class ButtonOnPause { @SubscribeEvent fun onGuiInitPost(event: GuiScreenEvent.InitGuiEvent.Post) { - if (!LorenzUtils.isOnHypixel) return + if (!LorenzUtils.isHyPixel) return if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu) { val x = event.gui.width - 105 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt index 277ecafb6..90d5c39ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt @@ -187,7 +187,7 @@ class CollectionCounter { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return SkyHanniMod.feature.misc.collectionCounterPos.renderString(display) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt index 2f7bc254c..4cf8c7816 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt @@ -17,7 +17,7 @@ class CompactSplashPotionMessage { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock || !SkyHanniMod.feature.chat.compactPotionMessage) return + if (!LorenzUtils.inSkyBlock || !SkyHanniMod.feature.chat.compactPotionMessage) return var matcher = POTION_EFFECT_PATTERN.matcher(event.message) if (matcher.matches()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt index b831bc927..d2ab1725a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt @@ -18,7 +18,7 @@ class CorruptedMobHighlight { @SubscribeEvent fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val entity = event.entity if (entity in corruptedMobs) return @@ -55,7 +55,7 @@ class CorruptedMobHighlight { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.corruptedMobHighlight && + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.corruptedMobHighlight && LorenzUtils.skyBlockIsland != "Private Island" } } \ No newline at end of file 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 53f56c37c..835b3ec06 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -13,7 +13,7 @@ class CurrentPetDisplay { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return var blocked = false @@ -39,7 +39,7 @@ class CurrentPetDisplay { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.petDisplay) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt index 99ccb4cea..b1f47f015 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpBottleOnGroundHider.kt @@ -10,7 +10,7 @@ class ExpBottleOnGroundHider { @SubscribeEvent fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.hideExpBottles) return if (event.entity is EntityXPOrb) { 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 b6623331d..146a11e3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt @@ -23,7 +23,7 @@ class HideArmor { @SubscribeEvent fun onGuiInventoryToggle(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return // TODO test this + if (!LorenzUtils.inSkyBlock) return // TODO test this fixOtherArmor() @@ -182,7 +182,7 @@ class HideArmor { } private fun changeArmor(entity: EntityPlayer, new: Array?) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return val current = entity.inventory.armorInventory if (new != null) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt index 8c4a0fcac..97448c316 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideDamageSplash.kt @@ -12,7 +12,7 @@ class HideDamageSplash { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderDamage(event: RenderLivingEvent.Specials.Pre) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.hideDamageSplash) return if (DamageIndicatorManager.isDamageSplash(event.entity)) { 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 38e3babbc..ec722eed4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -76,7 +76,7 @@ class MarkedPlayerManager { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (tick++ % 20 == 0) { findPlayers() @@ -85,7 +85,7 @@ class MarkedPlayerManager { @SubscribeEvent fun onRenderMobColored(event: RenderMobColoredEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return val entity = event.entity @@ -96,7 +96,7 @@ class MarkedPlayerManager { @SubscribeEvent fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.markedPlayers.highlightInWorld) return val entity = event.entity 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 9f91e1c82..d00d7a0df 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -203,6 +203,6 @@ class NonGodPotEffectDisplay { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.nonGodPotEffectDisplay && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.nonGodPotEffectDisplay && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt index 8d7fafb1f..c3a43853e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt @@ -20,6 +20,6 @@ class RealTime { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.realTime + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.realTime } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt index c7432ffa9..28f77626f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt @@ -62,6 +62,6 @@ class ThunderSparksHighlight { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.fishing.thunderSparkHighlight + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.thunderSparkHighlight } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt index 123e7a54b..2d25076a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt @@ -54,5 +54,5 @@ class MilleniaAgedBlazeColor { } private fun isEnabled() = - LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "Crimson Isle" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor + LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == "Crimson Isle" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor } \ No newline at end of file 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 dfbe44ca2..ef3f965a1 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 @@ -113,6 +113,6 @@ class AshfangBlazes { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) + return LorenzUtils.inSkyBlock && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file 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 9dba408bc..5649cc481 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 @@ -59,7 +59,7 @@ class AshfangBlazingSouls { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.blazingSouls && + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.blazingSouls && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file 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 92692cc65..760bfc36d 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 @@ -41,7 +41,7 @@ class AshfangFreezeCooldown { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.freezeCooldown && + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.freezeCooldown && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file 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 4f54bbd5c..be68a1583 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 @@ -55,7 +55,7 @@ class AshfangGravityOrbs { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.gravityOrbs && + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.gravityOrbs && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt index 3785a3f76..0eb6ac920 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt @@ -21,7 +21,7 @@ class AshfangHideDamageIndicator { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideDamageSplash && + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideDamageSplash && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file 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 b99f0ff7b..df242b159 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 @@ -19,7 +19,7 @@ class AshfangHideParticles { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (tick++ % 60 == 0) { val distance = DamageIndicatorManager.getDistanceTo(BossType.NETHER_ASHFANG) @@ -51,5 +51,5 @@ class AshfangHideParticles { } } - private fun isEnabled() = LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles && hideParticles + private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideParticles && hideParticles } \ 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 8590c2b36..5fe8c7d8a 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 @@ -51,7 +51,7 @@ class AshfangNextResetCooldown { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.nextResetCooldown && + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.nextResetCooldown && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt index e79157ed9..df3c5117f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt @@ -98,7 +98,7 @@ class EndermanSlayerBeacon { } } - private fun isEnabled(): Boolean = LorenzUtils.inSkyblock && + private fun isEnabled(): Boolean = LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.slayerEndermanBeacon && LorenzUtils.skyBlockIsland == "The End" && DamageIndicatorManager.isBossSpawned( diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt index 383419cda..2c0748962 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt @@ -46,7 +46,7 @@ class HideMobNames { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.slayer.hideMobNames) return val entity = event.entity diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt index d52287250..abbb2a315 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt @@ -87,6 +87,6 @@ class HighlightSlayerMiniboss { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.slayerMinibossHighlight && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.slayerMinibossHighlight && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight } } 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 22d9b9573..586911264 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -170,6 +170,6 @@ class SlayerQuestWarning { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.questWarning + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.questWarning } } \ No newline at end of file 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 3f0e8ad76..43c17ec5a 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 @@ -19,7 +19,7 @@ class BlazeSlayerClearView { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (tick++ % 60 == 0) { hideParticles = DamageIndicatorManager.getDistanceTo( BossType.SLAYER_BLAZE_1, @@ -62,6 +62,6 @@ class BlazeSlayerClearView { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.blazeClearView && hideParticles + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazeClearView && hideParticles } } \ 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 4ae548836..be0dc6b78 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 @@ -36,7 +36,7 @@ class BlazeSlayerDaggerHelper { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.slayer.blazeHideDaggerWarning) return val message = event.message @@ -199,7 +199,7 @@ class BlazeSlayerDaggerHelper { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.blazeDaggers + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazeDaggers } @SubscribeEvent 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 3c02ed472..f395793a1 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 @@ -65,7 +65,7 @@ class BlazeSlayerFirePitsWarning { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && DamageIndicatorManager.isBossSpawned( + return LorenzUtils.inSkyBlock && DamageIndicatorManager.isBossSpawned( BossType.SLAYER_BLAZE_3, BossType.SLAYER_BLAZE_4, BossType.SLAYER_BLAZE_QUAZII_3, diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt index 22f22e904..eea8414a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt @@ -147,7 +147,7 @@ class BlazeSlayerPillar { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && DamageIndicatorManager.isBossSpawned( + return LorenzUtils.inSkyBlock && DamageIndicatorManager.isBossSpawned( BossType.SLAYER_BLAZE_2, BossType.SLAYER_BLAZE_3, BossType.SLAYER_BLAZE_4, 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 c09419533..bddbc4e91 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 @@ -16,7 +16,7 @@ class HellionShieldHelper { @SubscribeEvent fun onRenderMobColored(event: RenderMobColoredEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return val shield = hellionShieldMobs.getOrDefault(event.entity, null) ?: return @@ -25,7 +25,7 @@ class HellionShieldHelper { @SubscribeEvent fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return hellionShieldMobs.getOrDefault(event.entity, null) ?: return 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 a4047a7c2..0e8fce8dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -41,7 +41,7 @@ class SummoningMobManager { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.isOnHypixel) return + if (!LorenzUtils.isHyPixel) return val message = event.message val matcher = spawnPatter.matcher(message) @@ -139,7 +139,7 @@ class SummoningMobManager { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.summonings.summoningMobDisplay) return if (summoningMobs.isEmpty()) return @@ -162,7 +162,7 @@ class SummoningMobManager { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.summonings.summoningMobHideNametag) return val entity = event.entity @@ -200,7 +200,7 @@ class SummoningMobManager { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && (SkyHanniMod.feature.summonings.summoningMobDisplay || SkyHanniMod.feature.summonings.summoningMobHideNametag) + return LorenzUtils.inSkyBlock && (SkyHanniMod.feature.summonings.summoningMobDisplay || SkyHanniMod.feature.summonings.summoningMobHideNametag) } class SummoningMob( 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 7c6c889b5..dc5ac9691 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -112,6 +112,6 @@ class SummoningSoulsName { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.summonings.summoningSoulDisplay + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.summonings.summoningSoulDisplay } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java index 25e553c63..99c56d8be 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java @@ -44,7 +44,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { // this.textInputUtil = new TextInputUtil(this.fontRendererObj, () -> ((IModifiedSign) this.that.tileSign).getText(this.editLine).getUnformattedText(), text -> ((IModifiedSign) this.that.tileSign).setText(this.editLine, new ChatComponentText(text)), 90); this.textInputUtil = new TextInputUtil(this.fontRendererObj, () -> ((IModifiedSign) getTileSign(this.that)).getText(this.editLine).getUnformattedText(), text -> ((IModifiedSign) getTileSign(this.that)).setText(this.editLine, new ChatComponentText(text)), 90); - if (LorenzUtils.INSTANCE.getInSkyblock() && SkyBlockcatiaConfig.enableSignSelectionList) { + if (LorenzUtils.INSTANCE.getInSkyBlock() && SkyBlockcatiaConfig.enableSignSelectionList) { List list = null; String title = null; @@ -87,7 +87,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { if (SkyBlockcatiaConfig.enableSignSelectionList) { Keyboard.enableRepeatEvents(false); - if (LorenzUtils.INSTANCE.getInSkyblock()) { + if (LorenzUtils.INSTANCE.getInSkyBlock()) { // String text = this.that.tileSign.signText[0].getUnformattedText(); String text = getTileSign(this.that).signText[0].getUnformattedText(); // if (!StringUtils.isNullOrEmpty(text)) @@ -196,7 +196,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { GlStateManager.popMatrix(); super.drawScreen(mouseX, mouseY, partialTicks); - if (LorenzUtils.INSTANCE.getInSkyblock() && SkyBlockcatiaConfig.enableSignSelectionList && this.globalSelector != null) { + if (LorenzUtils.INSTANCE.getInSkyBlock() && SkyBlockcatiaConfig.enableSignSelectionList && this.globalSelector != null) { this.globalSelector.drawScreen(mouseX, mouseY, partialTicks); } info.cancel(); @@ -205,7 +205,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { @Inject(method = "drawScreen(IIF)V", cancellable = true, at = @At("RETURN")) private void drawScreenPost(int mouseX, int mouseY, float partialTicks, CallbackInfo info) { - if (!SkyBlockcatiaConfig.enableOverwriteSignEditing && LorenzUtils.INSTANCE.getInSkyblock() && SkyBlockcatiaConfig.enableSignSelectionList && this.globalSelector != null) { + if (!SkyBlockcatiaConfig.enableOverwriteSignEditing && LorenzUtils.INSTANCE.getInSkyBlock() && SkyBlockcatiaConfig.enableSignSelectionList && this.globalSelector != null) { this.globalSelector.drawScreen(mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index dce81b5df..f7ab6a90b 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -122,7 +122,7 @@ class LorenzTest { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inSkyblock) return + if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.dev.debugEnabled) return SkyHanniMod.feature.dev.debugPos.renderString(text) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index f6e2e319c..4d0c5a2ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -14,14 +14,14 @@ import java.text.SimpleDateFormat object LorenzUtils { - val isOnHypixel: Boolean + val isHyPixel: Boolean get() = HypixelData.hypixel && Minecraft.getMinecraft().thePlayer != null - val inSkyblock: Boolean - get() = isOnHypixel && HypixelData.skyblock + val inSkyBlock: Boolean + get() = isHyPixel && HypixelData.skyBlock val inDungeons: Boolean - get() = inSkyblock && DungeonData.inDungeon() + get() = inSkyBlock && DungeonData.inDungeon() val skyBlockIsland: String get() = HypixelData.skyBlockIsland @@ -37,7 +37,7 @@ object LorenzUtils { get() = HypixelData.noTrade val isBingoProfile: Boolean - get() = inSkyblock && HypixelData.bingo + get() = inSkyBlock && HypixelData.bingo const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private val log = LorenzLogger("chat/mod_sent") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt index 9882f8578..1036dab62 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt @@ -158,7 +158,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { } if (!SkyHanniMod.feature.dev.printUnfilteredDebugs) return Filter.Result.ACCEPT - if (!SkyHanniMod.feature.dev.printUnfilteredDebugsOutsideSkyBlock && !LorenzUtils.inSkyblock) return Filter.Result.ACCEPT + if (!SkyHanniMod.feature.dev.printUnfilteredDebugsOutsideSkyBlock && !LorenzUtils.inSkyBlock) return Filter.Result.ACCEPT if (formattedMessage == "filtered console: ") return Filter.Result.ACCEPT debug(" ") -- cgit From ce0956ac232f444724f90f0633b4b35f3dd8cfdf Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 02:35:44 +0100 Subject: Renamed hypixel and skyblock. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 +- .../java/at/hannibal2/skyhanni/data/HyPixelData.kt | 155 +++++++++++++++++++++ .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 155 --------------------- .../skyhanni/features/chat/PlayerDeathMessages.kt | 7 - .../features/event/diana/BurrowWarpHelper.kt | 3 +- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 14 +- 6 files changed, 164 insertions(+), 172 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index c59444b99..298b01686 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -86,7 +86,7 @@ public class SkyHanniMod { new BazaarApi(); loadModule(this); loadModule(new ChatManager()); - loadModule(new HypixelData()); + loadModule(new HyPixelData()); loadModule(new DungeonData()); loadModule(new ScoreboardData()); loadModule(new ApiDataLoader()); diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt new file mode 100644 index 000000000..e1c466762 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt @@ -0,0 +1,155 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.IslandChangeEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.utils.LorenzLogger +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TabListUtils +import net.minecraft.client.Minecraft +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import net.minecraftforge.fml.common.network.FMLNetworkEvent + +class HyPixelData { + + companion object { + var hypixel = false + var skyBlock = false + var skyBlockIsland: String = "" + + //Ironman, Stranded and Bingo + var noTrade = false + + var ironman = false + var stranded = false + var bingo = false + + fun readSkyBlockArea(): String { + for (line in ScoreboardData.sidebarLinesFormatted()) { + if (line.startsWith(" §7⏣ ")) { + return line.substring(5).removeColor() + } + } + + return "invalid" + } + } + + private var loggerIslandChange = LorenzLogger("debug/island_change") + + @SubscribeEvent + fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) { + hypixel = Minecraft.getMinecraft().runCatching { + !event.isLocal && (thePlayer?.clientBrand?.lowercase()?.contains("hypixel") + ?: currentServerData?.serverIP?.lowercase()?.contains("hypixel") ?: false) + }.onFailure { it.printStackTrace() }.getOrDefault(false) + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + skyBlock = false + } + + @SubscribeEvent + fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { + hypixel = false + skyBlock = false + } + + @SubscribeEvent + fun onStatusBar(event: LorenzChatEvent) { + if (!hypixel) return + + val message = event.message.removeColor().lowercase() + if (message.startsWith("your profile was changed to:")) { + val stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim() + ProfileJoinEvent(stripped).postAndCatch() + } + if (message.startsWith("you are playing on profile:")) { + val stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim() + ProfileJoinEvent(stripped).postAndCatch() + } + } + + var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!hypixel) return + if (event.phase != TickEvent.Phase.START) return + + tick++ + + if (tick % 5 != 0) return + + val inSkyBlock = checkScoreboard() + if (inSkyBlock) { + checkIsland() + checkSidebar() + } + + if (inSkyBlock == skyBlock) return + skyBlock = inSkyBlock + } + + private fun checkSidebar() { + ironman = false + stranded = false + bingo = false + + for (line in ScoreboardData.sidebarLinesFormatted()) { + when (line) { + " §7Ⓑ §7Bingo", // No Rank + " §bⒷ §bBingo", // Rank 1 + " §9Ⓑ §9Bingo", // Rank 2 + " §5Ⓑ §5Bingo", // Rank 3 + " §6Ⓑ §6Bingo", // Rank 4 + -> { + bingo = true + } + + // TODO implemennt stranded check + + " §7♲ §7Ironman" -> { + ironman = true + } + + } + } + + noTrade = ironman || stranded || bingo + } + + private fun checkIsland() { + var newIsland = "" + var guesting = false + for (line in TabListUtils.getTabList()) { + if (line.startsWith("§r§b§lArea: ")) { + newIsland = line.split(": ")[1].removeColor() + } + if (line == "§r Status: §r§9Guest§r") { + guesting = true + } + } + if (guesting) { + newIsland = "$newIsland guesting" + } + + if (skyBlockIsland != newIsland) { + IslandChangeEvent(newIsland, skyBlockIsland).postAndCatch() + loggerIslandChange.log(newIsland) + skyBlockIsland = newIsland + } + } + + private fun checkScoreboard(): Boolean { + val minecraft = Minecraft.getMinecraft() + val world = minecraft.theWorld ?: return false + + val objective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false + val displayName = objective.displayName + return displayName.removeColor().contains("SKYBLOCK") + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt deleted file mode 100644 index bbb3db69d..000000000 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ /dev/null @@ -1,155 +0,0 @@ -package at.hannibal2.skyhanni.data - -import at.hannibal2.skyhanni.events.IslandChangeEvent -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.ProfileJoinEvent -import at.hannibal2.skyhanni.utils.LorenzLogger -import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import at.hannibal2.skyhanni.utils.TabListUtils -import net.minecraft.client.Minecraft -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent -import net.minecraftforge.fml.common.network.FMLNetworkEvent - -class HypixelData { - - companion object { - var hypixel = false - var skyBlock = false - var skyBlockIsland: String = "" - - //Ironman, Stranded and Bingo - var noTrade = false - - var ironman = false - var stranded = false - var bingo = false - - fun readSkyBlockArea(): String { - for (line in ScoreboardData.sidebarLinesFormatted()) { - if (line.startsWith(" §7⏣ ")) { - return line.substring(5).removeColor() - } - } - - return "invalid" - } - } - - var loggerIslandChange = LorenzLogger("debug/island_change") - - @SubscribeEvent - fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) { - hypixel = Minecraft.getMinecraft().runCatching { - !event.isLocal && (thePlayer?.clientBrand?.lowercase()?.contains("hypixel") - ?: currentServerData?.serverIP?.lowercase()?.contains("hypixel") ?: false) - }.onFailure { it.printStackTrace() }.getOrDefault(false) - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - skyBlock = false - } - - @SubscribeEvent - fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) { - hypixel = false - skyBlock = false - } - - @SubscribeEvent - fun onStatusBar(event: LorenzChatEvent) { - if (!hypixel) return - - val message = event.message.removeColor().lowercase() - if (message.startsWith("your profile was changed to:")) { - val stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim() - ProfileJoinEvent(stripped).postAndCatch() - } - if (message.startsWith("you are playing on profile:")) { - val stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim() - ProfileJoinEvent(stripped).postAndCatch() - } - } - - var tick = 0 - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!hypixel) return - if (event.phase != TickEvent.Phase.START) return - - tick++ - - if (tick % 5 != 0) return - - val inSkyBlock = checkScoreboard() - if (inSkyBlock) { - checkIsland() - checkSidebar() - } - - if (inSkyBlock == skyBlock) return - skyBlock = inSkyBlock - } - - private fun checkSidebar() { - ironman = false - stranded = false - bingo = false - - for (line in ScoreboardData.sidebarLinesFormatted()) { - when (line) { - " §7Ⓑ §7Bingo", // No Rank - " §bⒷ §bBingo", // Rank 1 - " §9Ⓑ §9Bingo", // Rank 2 - " §5Ⓑ §5Bingo", // Rank 3 - " §6Ⓑ §6Bingo", // Rank 4 - -> { - bingo = true - } - - // TODO implemennt stranded check - - " §7♲ §7Ironman" -> { - ironman = true - } - - } - } - - noTrade = ironman || stranded || bingo - } - - private fun checkIsland() { - var newIsland = "" - var guesting = false - for (line in TabListUtils.getTabList()) { - if (line.startsWith("§r§b§lArea: ")) { - newIsland = line.split(": ")[1].removeColor() - } - if (line == "§r Status: §r§9Guest§r") { - guesting = true - } - } - if (guesting) { - newIsland = "$newIsland guesting" - } - - if (skyBlockIsland != newIsland) { - IslandChangeEvent(newIsland, skyBlockIsland).postAndCatch() - loggerIslandChange.log(newIsland) - skyBlockIsland = newIsland - } - } - - private fun checkScoreboard(): Boolean { - val minecraft = Minecraft.getMinecraft() - val world = minecraft.theWorld ?: return false - - val objective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false - val displayName = objective.displayName - return displayName.removeColor().contains("SKYBLOCK") - } -} \ No newline at end of file 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 27e520ad0..8e6cd4d4a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.utils.LocationUtils @@ -10,7 +9,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.regex.Pattern @@ -62,11 +60,6 @@ class PlayerDeathMessages { } } - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - HypixelData.skyBlock = false - } - private fun checkOtherPlayers() { val location = LocationUtils.playerLocation() for (otherPlayer in Minecraft.getMinecraft().theWorld.loadedEntityList 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 cbfa28c9a..245fa85af 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 @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.event.diana -import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils @@ -44,7 +43,7 @@ class BurrowWarpHelper { @SubscribeEvent fun onStatusBar(event: LorenzChatEvent) { - if (!HypixelData.skyBlock) return + if (!LorenzUtils.inSkyBlock) return if (event.message == "§cYou haven't unlocked this fast travel destination!") { val time = System.currentTimeMillis() - lastWarpTime diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 4d0c5a2ff..8140cddfa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.HyPixelData import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft @@ -15,29 +15,29 @@ import java.text.SimpleDateFormat object LorenzUtils { val isHyPixel: Boolean - get() = HypixelData.hypixel && Minecraft.getMinecraft().thePlayer != null + get() = HyPixelData.hypixel && Minecraft.getMinecraft().thePlayer != null val inSkyBlock: Boolean - get() = isHyPixel && HypixelData.skyBlock + get() = isHyPixel && HyPixelData.skyBlock val inDungeons: Boolean get() = inSkyBlock && DungeonData.inDungeon() val skyBlockIsland: String - get() = HypixelData.skyBlockIsland + get() = HyPixelData.skyBlockIsland //TODO add cache val skyBlockArea: String - get() = HypixelData.readSkyBlockArea() + get() = HyPixelData.readSkyBlockArea() val inKuudraFight: Boolean get() = skyBlockIsland == "Instanced" val noTradeMode: Boolean - get() = HypixelData.noTrade + get() = HyPixelData.noTrade val isBingoProfile: Boolean - get() = inSkyBlock && HypixelData.bingo + get() = inSkyBlock && HyPixelData.bingo const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private val log = LorenzLogger("chat/mod_sent") -- cgit From 0c711242c8d96517e49e0ecc7a081f8e15cdd7ed Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 03:11:17 +0100 Subject: Introduced IslandType enum. --- .../java/at/hannibal2/skyhanni/data/HyPixelData.kt | 24 +++++++++++++++------- .../java/at/hannibal2/skyhanni/data/IslandType.kt | 22 ++++++++++++++++++++ .../hannibal2/skyhanni/events/IslandChangeEvent.kt | 4 +++- .../features/end/VoidlingExtremistColor.kt | 3 ++- .../skyhanni/features/minion/MinionFeatures.kt | 13 ++++++------ .../features/misc/CorruptedMobHighlight.kt | 3 ++- .../features/nether/MilleniaAgedBlazeColor.kt | 3 ++- .../features/slayer/EndermanSlayerBeacon.kt | 3 ++- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 5 +++-- 9 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/IslandType.kt diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt index e1c466762..24738893f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt @@ -17,7 +17,7 @@ class HyPixelData { companion object { var hypixel = false var skyBlock = false - var skyBlockIsland: String = "" + var skyBlockIsland = IslandType.UNKNOWN //Ironman, Stranded and Bingo var noTrade = false @@ -133,14 +133,24 @@ class HyPixelData { guesting = true } } - if (guesting) { - newIsland = "$newIsland guesting" + + var islandType = IslandType.getBySidebarName(newIsland) + + if (islandType == IslandType.PRIVATE_ISLAND) { + if (guesting) { + islandType = IslandType.PRIVATE_ISLAND_GUEST + } } - if (skyBlockIsland != newIsland) { - IslandChangeEvent(newIsland, skyBlockIsland).postAndCatch() - loggerIslandChange.log(newIsland) - skyBlockIsland = newIsland + if (skyBlockIsland != islandType) { + IslandChangeEvent(islandType, skyBlockIsland).postAndCatch() + if (islandType == IslandType.UNKNOWN) { + println("Unknown island detected: '$newIsland'") + loggerIslandChange.log("Unknown: '$newIsland'") + } else { + loggerIslandChange.log(islandType.name) + } + skyBlockIsland = islandType } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt new file mode 100644 index 000000000..527cce548 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt @@ -0,0 +1,22 @@ +package at.hannibal2.skyhanni.data + +enum class IslandType(val displayName: String) { + PRIVATE_ISLAND("Private Island"), + PRIVATE_ISLAND_GUEST("Private Island Guest"), + THE_END("The End"), + KUUDRA_ARENA("Instanced"), + CRIMSON_ISLE("Crimson Isle"), + + HUB("Hub"), + THE_FARMING_ISLANDS("The Farming Islands"), + + NONE(""), + UNKNOWN("???"), + ; + + companion object { + fun getBySidebarName(name: String): IslandType { + return values().firstOrNull { it.displayName == name } ?: UNKNOWN + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt index 2dec9acad..291ccd995 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt @@ -1,3 +1,5 @@ package at.hannibal2.skyhanni.events -class IslandChangeEvent(val newIsland: String, val oldIsland: String?) : LorenzEvent() \ No newline at end of file +import at.hannibal2.skyhanni.data.IslandType + +class IslandChangeEvent(val newIsland: IslandType, val oldIsland: IslandType) : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt index 6f6a083d8..c9b02bf5d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.end import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha @@ -54,5 +55,5 @@ class VoidlingExtremistColor { } private fun isEnabled(): Boolean = - LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == "The End" && SkyHanniMod.feature.misc.voidlingExtremistColor + LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.THE_END && SkyHanniMod.feature.misc.voidlingExtremistColor } \ No newline at end of file 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 707c36405..ee72ff542 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.minion import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled @@ -48,7 +49,7 @@ class MinionFeatures { @SubscribeEvent fun onClick(event: InputEvent.MouseInputEvent) { if (!LorenzUtils.inSkyBlock) return - if (LorenzUtils.skyBlockIsland != "Private Island") return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (!Mouse.getEventButtonState()) return if (Mouse.getEventButton() != 1) return @@ -63,7 +64,7 @@ class MinionFeatures { @SubscribeEvent fun onRenderLastClickedMinion(event: RenderWorldLastEvent) { if (!LorenzUtils.inSkyBlock) return - if (LorenzUtils.skyBlockIsland != "Private Island") return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (!SkyHanniMod.feature.minions.lastClickedMinionDisplay) return val special = SkyHanniMod.feature.minions.lastOpenedMinionColor @@ -87,7 +88,7 @@ class MinionFeatures { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (LorenzUtils.skyBlockIsland != "Private Island") return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (InventoryUtils.currentlyOpenInventory().contains("Minion")) { if (lastClickedEntity != null) { @@ -175,7 +176,7 @@ class MinionFeatures { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - if (LorenzUtils.skyBlockIsland != "Private Island") return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (event.message.matchRegex("§aYou received §r§6(.*) coins§r§a!")) { lastCoinsRecived = System.currentTimeMillis() @@ -189,7 +190,7 @@ class MinionFeatures { fun onRenderLastEmptied(event: RenderWorldLastEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.minions.emptiedTimeDisplay) return - if (LorenzUtils.skyBlockIsland != "Private Island") return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return val playerLocation = LocationUtils.playerLocation() val playerEyeLocation = LocationUtils.playerEyeLocation() @@ -211,7 +212,7 @@ class MinionFeatures { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { if (!LorenzUtils.inSkyBlock) return - if (LorenzUtils.skyBlockIsland != "Private Island") return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (!SkyHanniMod.feature.minions.hideMobsNametagNearby) return val entity = event.entity diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt index d2ab1725a..0b4effca4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CorruptedMobHighlight.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent @@ -56,6 +57,6 @@ class CorruptedMobHighlight { private fun isEnabled(): Boolean { return LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.corruptedMobHighlight && - LorenzUtils.skyBlockIsland != "Private Island" + LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt index 2d25076a9..8a9cad4fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha @@ -54,5 +55,5 @@ class MilleniaAgedBlazeColor { } private fun isEnabled() = - LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == "Crimson Isle" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor + LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE && SkyHanniMod.feature.misc.milleniaAgedBlazeColor } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt index df3c5117f..a36db4820 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent @@ -100,7 +101,7 @@ class EndermanSlayerBeacon { private fun isEnabled(): Boolean = LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.slayerEndermanBeacon && - LorenzUtils.skyBlockIsland == "The End" && + LorenzUtils.skyBlockIsland == IslandType.THE_END && DamageIndicatorManager.isBossSpawned( BossType.SLAYER_ENDERMAN_2, BossType.SLAYER_ENDERMAN_3, diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 8140cddfa..043978277 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HyPixelData +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft @@ -23,7 +24,7 @@ object LorenzUtils { val inDungeons: Boolean get() = inSkyBlock && DungeonData.inDungeon() - val skyBlockIsland: String + val skyBlockIsland: IslandType get() = HyPixelData.skyBlockIsland //TODO add cache @@ -31,7 +32,7 @@ object LorenzUtils { get() = HyPixelData.readSkyBlockArea() val inKuudraFight: Boolean - get() = skyBlockIsland == "Instanced" + get() = skyBlockIsland == IslandType.KUUDRA_ARENA val noTradeMode: Boolean get() = HyPixelData.noTrade -- cgit From 319654afd68440c9cbc2eedd3ae4718b5c045519 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 03:20:00 +0100 Subject: Typo. --- src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt index 90d5c39ef..e36b5001e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt @@ -62,7 +62,7 @@ class CollectionCounter { val apiName = data.apiName if (!apiCollectionData.contains(apiName)) { - LorenzUtils.chat("§c[SkyHanni] Item $name not in collection data!") + LorenzUtils.chat("§c[SkyHanni] Item $name is not in collection data!") return } -- cgit From 7d0223d1cbc09909b8989c8aea2576a171acdaea Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 03:34:10 +0100 Subject: replaced "text to render" to "display" --- .../hannibal2/skyhanni/config/core/GuiElementTextField.java | 6 +++--- src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt | 6 +++--- .../skyhanni/features/bazaar/BazaarBestSellMethod.kt | 8 ++++---- .../skyhanni/features/dungeon/DungeonDeathCounter.kt | 8 ++++---- .../skyhanni/features/dungeon/DungeonMilestonesDisplay.kt | 12 ++++++------ .../skyhanni/features/misc/NonGodPotEffectDisplay.kt | 12 ++++++------ src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/GuiElementTextField.java b/src/main/java/at/hannibal2/skyhanni/config/core/GuiElementTextField.java index 3652f76f5..56114c161 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/GuiElementTextField.java +++ b/src/main/java/at/hannibal2/skyhanni/config/core/GuiElementTextField.java @@ -566,9 +566,9 @@ public class GuiElementTextField { ); GlScissorStack.pop(scaledresolution); } else { -// String toRender = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(ChromaUtils.INSTANCE.chromaStringByColourCode( - String toRender = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(texts[yOffI], searchBarXSize - 10); - Minecraft.getMinecraft().fontRendererObj.drawString(toRender, x + 5, +// String display = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(ChromaUtils.INSTANCE.chromaStringByColourCode( + String display = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(texts[yOffI], searchBarXSize - 10); + Minecraft.getMinecraft().fontRendererObj.drawString(display, x + 5, y + (searchBarYSize - 8) / 2 + yOff, customTextColour ); } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt index f3807be83..f0abb1427 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt @@ -10,11 +10,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SendTitleHelper { companion object { - private var textToRender = "" + private var display = "" private var endTime = 0L fun sendTitle(text: String, duration: Int) { - textToRender = text + display = text endTime = System.currentTimeMillis() + duration } } @@ -36,7 +36,7 @@ class SendTitleHelper { GlStateManager.pushMatrix() GlStateManager.translate((width / 2).toFloat(), (height / 1.8).toFloat(), 0.0f) GlStateManager.scale(4.0f, 4.0f, 4.0f) - TextRenderUtils.drawStringCenteredScaledMaxWidth(textToRender, renderer, 0f, 0f, false, 75, 0) + TextRenderUtils.drawStringCenteredScaledMaxWidth(display, renderer, 0f, 0f, false, 75, 0) GlStateManager.popMatrix() } } \ No newline at end of file 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 eb6d98d31..200c3e69e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -15,18 +15,18 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarBestSellMethod { companion object { - private var textToRender = "" + private var display = "" } @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.CloseWindowEvent) { - textToRender = "" + display = "" } @SubscribeEvent fun onGuiDraw(event: GuiScreenEvent.DrawScreenEvent.Post) { if (!isEnabled()) return - textToRender = getNewText(event) + display = getNewText(event) } private fun getNewText(event: GuiScreenEvent.DrawScreenEvent.Post): String { @@ -74,7 +74,7 @@ class BazaarBestSellMethod { fun renderOverlay(event: GuiScreenEvent.BackgroundDrawnEvent) { if (!isEnabled()) return - SkyHanniMod.feature.bazaar.bestSellMethodPos.renderString(textToRender) + SkyHanniMod.feature.bazaar.bestSellMethodPos.renderString(display) } private fun isEnabled(): Boolean { 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 672e2d262..e40b66968 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -12,7 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonDeathCounter { - private var textToRender = "" + private var display = "" private var deaths = 0 private fun isDeathMessage(message: String): Boolean = when { @@ -60,7 +60,7 @@ class DungeonDeathCounter { private fun update() { if (deaths == 0) { - textToRender = "" + display = "" return } @@ -69,7 +69,7 @@ class DungeonDeathCounter { 3 -> "§c" else -> "§4" } - textToRender = color + "Deaths: $deaths" + display = color + "Deaths: $deaths" } @SubscribeEvent @@ -89,7 +89,7 @@ class DungeonDeathCounter { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return - SkyHanniMod.feature.dungeon.deathCounterPos.renderString(DungeonMilestonesDisplay.color + textToRender) + SkyHanniMod.feature.dungeon.deathCounterPos.renderString(DungeonMilestonesDisplay.color + display) } private fun isEnabled(): Boolean { 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 9457d4a5d..692a077de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -15,7 +15,7 @@ class DungeonMilestonesDisplay { companion object { - private var textToRender = "" + private var display = "" var color = "" var currentMilestone = 0 var timeReached = 0L @@ -40,8 +40,8 @@ class DungeonMilestonesDisplay { private fun checkVisibility() { if (currentMilestone >= 3) { if (System.currentTimeMillis() > timeReached + 3_000) - if (textToRender != "") { - textToRender = textToRender.substring(1) + if (display != "") { + display = display.substring(1) } } } @@ -68,12 +68,12 @@ class DungeonMilestonesDisplay { 2 -> "§e" else -> "§a" } - textToRender = "Current Milestone: $currentMilestone" + display = "Current Milestone: $currentMilestone" } @SubscribeEvent fun onWorldChange(event: WorldEvent.Load) { - textToRender = "" + display = "" currentMilestone = 0 } @@ -88,7 +88,7 @@ class DungeonMilestonesDisplay { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return - SkyHanniMod.feature.dungeon.showMileStonesDisplayPos.renderString(color + textToRender) + SkyHanniMod.feature.dungeon.showMileStonesDisplayPos.renderString(color + display) } private fun isEnabled(): Boolean { 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 d00d7a0df..44e9332f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -23,7 +23,7 @@ class NonGodPotEffectDisplay { private var checkFooter = false private val activeEffects = mutableMapOf() - private val textToRender = mutableListOf() + private val display = mutableListOf() private var lastTick = 0L private var nonGodPotEffects = mapOf( @@ -58,7 +58,7 @@ class NonGodPotEffectDisplay { private fun format() { val now = System.currentTimeMillis() - textToRender.clear() + display.clear() if (activeEffects.values.removeIf { now > it }) { //to fetch the real amount of active pots totalEffectsCount = 0 @@ -72,12 +72,12 @@ class NonGodPotEffectDisplay { val color = colorForTime(seconds) - textToRender.add("$label $color$format") + display.add("$label $color$format") } val diff = totalEffectsCount - activeEffects.size if (diff > 0) { - textToRender.add("§eOpen the /effects inventory") - textToRender.add("§eto show the missing $diff effects!") + display.add("§eOpen the /effects inventory") + display.add("§eto show the missing $diff effects!") checkFooter = true } } @@ -182,7 +182,7 @@ class NonGodPotEffectDisplay { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return if (!isEnabled()) return - SkyHanniMod.feature.misc.nonGodPotEffectPos.renderStrings(textToRender) + SkyHanniMod.feature.misc.nonGodPotEffectPos.renderStrings(display) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 3697838c7..ff28c52ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -430,20 +430,20 @@ object RenderUtils { if (string == null) return if (string == "") return - val textToRender = "§f$string" + val display = "§f$string" GlStateManager.pushMatrix() val resolution = ScaledResolution(minecraft) val renderer = minecraft.renderManager.fontRenderer ?: return - val offsetX = (200 - renderer.getStringWidth(textToRender.removeColor())) / 2 + val offsetX = (200 - renderer.getStringWidth(display.removeColor())) / 2 val x = getAbsX(resolution, 200) + offsetX val y = getAbsY(resolution, 16) + offsetY GlStateManager.translate(x + 1.0, y + 1.0, 0.0) - renderer.drawStringWithShadow(textToRender, 0f, 0f, 0) + renderer.drawStringWithShadow(display, 0f, 0f, 0) GlStateManager.popMatrix() } -- cgit From 2db3001ea732fd2d66ada70100459d095bb4ef26 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 03:36:08 +0100 Subject: Removed player rank color from custom potion splash message. --- .../hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt index 4cf8c7816..99e6395fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern @@ -27,9 +28,9 @@ class CompactSplashPotionMessage { matcher = POTION_EFFECT_OTHERS_PATTERN.matcher(event.message) if (matcher.matches()) { - val playerName = matcher.group(1) + val playerName = matcher.group(1).removeColor() val effectName = matcher.group(2) - event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$effectName §7(by $playerName§7)") + event.chatComponent = ChatComponentText("§a§lPotion Effect! §r$effectName §7(by §b$playerName§7)") } } } \ No newline at end of file -- cgit From 892429f7a1d3f433a759765b8d6e4d437ffd9899 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 03:47:44 +0100 Subject: More Kotlin love. --- src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt index 24738893f..2bb7c7678 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt @@ -27,13 +27,10 @@ class HyPixelData { var bingo = false fun readSkyBlockArea(): String { - for (line in ScoreboardData.sidebarLinesFormatted()) { - if (line.startsWith(" §7⏣ ")) { - return line.substring(5).removeColor() - } - } - - return "invalid" + return ScoreboardData.sidebarLinesFormatted() + .firstOrNull { it.startsWith(" §7⏣ ") } + ?.substring(5)?.removeColor() + ?: "invalid" } } -- cgit From cdfec7e6849c3a807812515eef26582933fbadd8 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 04:58:27 +0100 Subject: Fixed error in Sea Creature Guide inventory. --- CHANGELOG.md | 3 ++- .../features/inventory/ItemDisplayOverlayFeatures.kt | 12 ++++++++---- src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt | 11 +++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72210d27a..e8b1e9f92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ + Do no longer prevent the selling of bazaar items to NPC when on ironman, stranded or bingo mode. ### Fixes -+ Dungeon level color fixed wrong colors. ++ Fixed wrong dungeon level colors. (in Party Finder) ++ Fixed error in Sea Creature Guide inventory. ## Version 0.13 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 4e25e3c83..bc79fdbc5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.RenderItemTipEvent +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -61,10 +62,13 @@ class ItemDisplayOverlayFeatures { } if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(4)) { - if (ItemUtils.isPet(name)) { - val level = name.between("Lvl ", "] ").toInt() - if (level != ItemUtils.maxPetLevel(name)) { - return "$level" + val chestName = InventoryUtils.openInventoryName() + if (!chestName.endsWith("Sea Creature Guide")) { + if (ItemUtils.isPet(name)) { + val level = name.between("Lvl ", "] ").toInt() + if (level != ItemUtils.maxPetLevel(name)) { + return "$level" + } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index 1d51d1be9..f1f107e2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -32,4 +32,15 @@ object InventoryUtils { } return list } + + fun openInventoryName(): String { + val guiChest = Minecraft.getMinecraft().currentScreen + val chestName = if (guiChest is GuiChest) { + val chest = guiChest.inventorySlots as ContainerChest + chest.lowerChestInventory.displayName.unformattedText.trim() + } else { + "" + } + return chestName + } } \ No newline at end of file -- cgit From 2b78f5b11d480c632b4a5d5b4a4a8f659d8d3ea7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 05:39:53 +0100 Subject: Using getInventoryName methods. --- .../at/hannibal2/skyhanni/events/GuiContainerEvent.kt | 17 ++++++++++------- .../skyhanni/features/anvil/AnvilCombineHelper.kt | 6 +++--- .../skyhanni/features/bazaar/BazaarOrderHelper.kt | 3 ++- .../features/dungeon/CroesusUnopenedChestTracker.kt | 7 +------ .../skyhanni/features/dungeon/DungeonLevelColor.kt | 9 ++------- .../features/inventory/HideNotClickableItems.kt | 13 ++++--------- .../skyhanni/features/inventory/RngMeterInventory.kt | 15 ++------------- .../skyhanni/features/inventory/StatsTuning.kt | 14 ++------------ .../java/at/hannibal2/skyhanni/utils/InventoryUtils.kt | 11 ++++++++--- 9 files changed, 34 insertions(+), 61 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt index 9a993cb77..437130bdd 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt @@ -2,15 +2,10 @@ package at.hannibal2.skyhanni.events import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.inventory.Container -import net.minecraft.inventory.ContainerChest import net.minecraft.inventory.Slot import net.minecraftforge.fml.common.eventhandler.Cancelable abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: Container) : LorenzEvent() { - val chestName: String by lazy { - if (container !is ContainerChest) error("Container is not a chest") - return@lazy (container as ContainerChest).lowerChestInventory.displayName.unformattedText.trim() - } data class BackgroundDrawnEvent( override val gui: GuiContainer, @@ -27,10 +22,18 @@ 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) : + data class GuiContainerDrawSlotPre( + override val gui: GuiContainer, + override val container: Container, + override val slot: Slot + ) : DrawSlotEvent(gui, container, slot) - data class GuiContainerDrawSlotPost(override val gui: GuiContainer, override val container: Container, override val slot: Slot) : + data class GuiContainerDrawSlotPost( + override val gui: GuiContainer, + override val container: Container, + override val slot: Slot + ) : DrawSlotEvent(gui, container, slot) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt index 9604cb05c..e03126fde 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.anvil import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils @@ -18,9 +19,8 @@ class AnvilCombineHelper { if (!SkyHanniMod.feature.inventory.anvilCombineHelper) return if (event.gui !is GuiChest) return - val guiChest = event.gui - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chest = event.gui.inventorySlots as ContainerChest + val chestName = chest.getInventoryName() if (chestName != "Anvil") return 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 31bc1e978..fb4c3079b 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.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor @@ -26,7 +27,7 @@ class BazaarOrderHelper { if (event.gui !is GuiChest) return val guiChest = event.gui val chest = guiChest.inventorySlots as ContainerChest - val inventoryName = chest.lowerChestInventory.displayName.unformattedText.trim() + val inventoryName = chest.getInventoryName() if (!isBazaarOrderInventory(inventoryName)) return out@ for (slot in chest.inventorySlots) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt index 024c05c86..20d7207f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt @@ -7,8 +7,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.highlight -import net.minecraft.client.gui.inventory.GuiChest -import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -19,10 +17,7 @@ class CroesusUnopenedChestTracker { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.dungeon.croesusUnopenedChestTracker) return - if (event.gui !is GuiChest) return - val guiChest = event.gui - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chestName = InventoryUtils.openInventoryName() if (chestName == "Croesus") { for (slot in InventoryUtils.getItemsInOpenChest()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt index 9b9027d83..ff334737b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt @@ -1,11 +1,9 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.inventory.GuiChest -import net.minecraft.inventory.ContainerChest import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern @@ -20,10 +18,7 @@ class DungeonLevelColor { if (!SkyHanniMod.feature.dungeon.partyFinderColoredClassLevel) return if (event.toolTip == null) return - val guiChest = Minecraft.getMinecraft().currentScreen - if (guiChest !is GuiChest) return - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chestName = InventoryUtils.openInventoryName() if (chestName != "Party Finder") return val stack = event.itemStack 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 4ec29baf2..a72466a66 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject -import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack @@ -70,7 +70,7 @@ class HideNotClickableItems { if (event.gui !is GuiChest) return val guiChest = event.gui val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chestName = chest.getInventoryName() for (slot in chest.inventorySlots) { if (slot == null) continue @@ -92,10 +92,7 @@ class HideNotClickableItems { fun onTooltip(event: ItemTooltipEvent) { if (isDisabled()) return if (event.toolTip == null) return - val guiChest = Minecraft.getMinecraft().currentScreen - if (guiChest !is GuiChest) return - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chestName = InventoryUtils.openInventoryName() val stack = event.itemStack if (InventoryUtils.getItemsInOpenChest().map { it.stack }.contains(stack)) return @@ -119,9 +116,7 @@ class HideNotClickableItems { fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (isDisabled()) return if (event.gui !is GuiChest) return - val guiChest = event.gui - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chestName = InventoryUtils.openInventoryName() val slot = event.slot ?: return 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 ec381a124..eb2ead1fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt @@ -11,9 +11,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.inventory.GuiChest -import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -21,11 +18,7 @@ class RngMeterInventory { @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { - val screen = Minecraft.getMinecraft().currentScreen - if (screen !is GuiChest) return - val chest = screen.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() - + val chestName = InventoryUtils.openInventoryName() val stack = event.stack if (SkyHanniMod.feature.inventory.rngMeterFloorName) { @@ -42,11 +35,7 @@ class RngMeterInventory { fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return - if (event.gui !is GuiChest) return - val guiChest = event.gui - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() - + val chestName = InventoryUtils.openInventoryName() if (SkyHanniMod.feature.inventory.rngMeterNoDrop) { if (chestName == "Catacombs RNG Meter") { for (slot in InventoryUtils.getItemsInOpenChest()) { 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 d33f03042..98383bd0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -9,9 +9,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.highlight -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.inventory.GuiChest -import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern @@ -22,10 +19,7 @@ class StatsTuning { @SubscribeEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { - val screen = Minecraft.getMinecraft().currentScreen - if (screen !is GuiChest) return - val chest = screen.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + val chestName = InventoryUtils.openInventoryName() val stack = event.stack @@ -107,11 +101,7 @@ class StatsTuning { fun onDrawSelectedTemplate(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return - if (event.gui !is GuiChest) return - val guiChest = event.gui - val chest = guiChest.inventorySlots as ContainerChest - val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() - + val chestName = InventoryUtils.openInventoryName() if (SkyHanniMod.feature.inventory.statsTuningSelectedTemplate) { if (chestName == "Stats Tuning") { for (slot in InventoryUtils.getItemsInOpenChest()) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index f1f107e2f..feaaaa481 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -11,9 +11,10 @@ object InventoryUtils { fun currentlyOpenInventory(): String { val screen = Minecraft.getMinecraft().currentScreen if (screen !is GuiChest) return "" - val chest = screen.inventorySlots as ContainerChest + val inventorySlots = screen.inventorySlots + val chest = inventorySlots as ContainerChest - return chest.lowerChestInventory.displayName.unformattedText.trim() + return chest.getInventoryName() } fun getItemsInOpenChest(): List { @@ -37,10 +38,14 @@ object InventoryUtils { val guiChest = Minecraft.getMinecraft().currentScreen val chestName = if (guiChest is GuiChest) { val chest = guiChest.inventorySlots as ContainerChest - chest.lowerChestInventory.displayName.unformattedText.trim() + chest.getInventoryName() } else { "" } return chestName } + + fun ContainerChest.getInventoryName(): String { + return this.lowerChestInventory.displayName.unformattedText.trim() + } } \ No newline at end of file -- cgit From 6b253a8ac2cdb03a67f111725c263dd84532f989 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 06:02:52 +0100 Subject: Fixed crash. --- .../hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 a72466a66..afdc446f9 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,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject +import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack @@ -92,7 +93,10 @@ class HideNotClickableItems { fun onTooltip(event: ItemTooltipEvent) { if (isDisabled()) return if (event.toolTip == null) return - val chestName = InventoryUtils.openInventoryName() + + val guiChest = Minecraft.getMinecraft().currentScreen + if (guiChest !is GuiChest) return + val chestName = (guiChest.inventorySlots as ContainerChest).getInventoryName() val stack = event.itemStack if (InventoryUtils.getItemsInOpenChest().map { it.stack }.contains(stack)) return -- cgit From e7f3e850c9cf5ddf0f4d93a25c92d3e45a279bf6 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 07:12:36 +0100 Subject: Add Brewing Stand Overlay. --- CHANGELOG.md | 5 +-- FEATURES.md | 3 +- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 + .../hannibal2/skyhanni/config/features/Misc.java | 5 +++ .../at/hannibal2/skyhanni/data/ItemTipHelper.kt | 7 ++-- .../skyhanni/events/RenderInventoryItemTipEvent.kt | 3 ++ .../skyhanni/features/misc/BrewingStandOverlay.kt | 39 ++++++++++++++++++++++ 7 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index e8b1e9f92..98514c811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ ### Features + Added /shtrackcollection - This tracks the number of items you collect, but it does not work with sacks. -+ Added Compact Bingo Chat Messages -+ Added Compact Potion Effect Chat Messages ++ Added Compact Bingo Chat Messages. ++ Added Compact Potion Effect Chat Messages. ++ Added Brewing Stand Overlay. ### Changes + Don't render overlays when tab list key is pressed. diff --git a/FEATURES.md b/FEATURES.md index 9687098b0..eb6d2c742 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -159,4 +159,5 @@ - Hide armor or just helmet of other player or yourself - Display the active non-god potion effects. - Option to hide blaze particles. -- Wishing compass uses amount display. \ No newline at end of file +- Wishing compass uses amount display. +- Brewing Stand Overlay. \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 298b01686..62ff318ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -170,6 +170,7 @@ public class SkyHanniMod { loadModule(new CompactSplashPotionMessage()); loadModule(new CroesusUnopenedChestTracker()); loadModule(new CompactBingoChat()); + loadModule(new BrewingStandOverlay()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index a47b7979e..58186b08e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -139,4 +139,9 @@ public class Misc { @ConfigOption(name = "Collection Counter Position", desc = "Tracking the number of items you collect. §cDoes not work with sacks.") @ConfigEditorButton(runnableId = "collectionCounter", buttonText = "Edit") public Position collectionCounterPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Brewing Stand Overlay", desc = "Display the Item names directly inside the Brewing Stand") + @ConfigEditorBoolean + public boolean brewingStandOverlay = true; } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index 30b9ad03f..7937ab2ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -5,10 +5,12 @@ import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer +import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.renderer.GlStateManager +import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -55,6 +57,8 @@ class ItemTipHelper { val gui = Minecraft.getMinecraft().currentScreen if (gui !is GuiChest) return + val chest = gui.inventorySlots as ContainerChest + var inventoryName = chest.getInventoryName() val guiLeft = (gui as AccessorGuiContainer).guiLeft val guiTop = (gui as AccessorGuiContainer).guiTop @@ -65,9 +69,8 @@ class ItemTipHelper { GlStateManager.disableBlend() for (slot in gui.inventorySlots.inventorySlots) { val stack = slot.stack ?: continue - if (stack.stackSize != 1) continue - val itemTipEvent = RenderInventoryItemTipEvent(stack) + val itemTipEvent = RenderInventoryItemTipEvent(inventoryName, slot, stack) itemTipEvent.postAndCatch() val stackTip = itemTipEvent.stackTip if (stackTip.isEmpty()) continue diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt index 4576576bd..7bb4692ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderInventoryItemTipEvent.kt @@ -1,8 +1,11 @@ package at.hannibal2.skyhanni.events +import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack class RenderInventoryItemTipEvent( + val inventoryName: String, + val slot: Slot, val stack: ItemStack, var stackTip: String = "", var offsetX: Int = 0, diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt new file mode 100644 index 000000000..6496e3d4c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt @@ -0,0 +1,39 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class BrewingStandOverlay { + + @SubscribeEvent + fun onRenderItemTip(event: RenderInventoryItemTipEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.misc.brewingStandOverlay) return + + if (event.inventoryName != "Brewing Stand") return + + val stack = event.stack + val name = stack.name ?: return + + when (event.slot.slotNumber) { + 13, // Ingredient input + 21, // Progress + 42, // Output right side + -> { + } + + else -> return + } + + // Hide the progress slot when not active + if (name.contains(" or ")) return + + event.stackTip = name + event.offsetX = 3 + event.offsetY = -5 + event.alignLeft = false + } +} \ No newline at end of file -- cgit From ffba85d9022b95cc5b44f927b6ea7399aee365e7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 07:44:30 +0100 Subject: Better Brewing Stand Overlay design. --- .../at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt index 6496e3d4c..5557309a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt @@ -18,7 +18,8 @@ class BrewingStandOverlay { val stack = event.stack val name = stack.name ?: return - when (event.slot.slotNumber) { + val slotNumber = event.slot.slotNumber + when (slotNumber) { 13, // Ingredient input 21, // Progress 42, // Output right side @@ -28,11 +29,15 @@ class BrewingStandOverlay { else -> return } + if (slotNumber == 21) { + event.offsetX = 55 + } + // Hide the progress slot when not active if (name.contains(" or ")) return event.stackTip = name - event.offsetX = 3 + event.offsetX = event.offsetX + 3 event.offsetY = -5 event.alignLeft = false } -- cgit From f9d037aff483bff61b800fffa96d0afe8a85a9ef Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 07:44:37 +0100 Subject: Code cleanup. --- .../java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 98383bd0c..dd17caf48 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -19,12 +19,12 @@ class StatsTuning { @SubscribeEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { - val chestName = InventoryUtils.openInventoryName() + val inventoryName = event.inventoryName val stack = event.stack if (SkyHanniMod.feature.inventory.statsTuningTemplateStats) { - if (chestName == "Stats Tuning") { + if (inventoryName == "Stats Tuning") { val name = stack.name ?: return if (name == "§aLoad") { var grab = false @@ -54,7 +54,7 @@ class StatsTuning { } } if (SkyHanniMod.feature.inventory.statsTuningSelectedStats) { - if (chestName == "Accessory Bag Thaumaturgy") { + if (inventoryName == "Accessory Bag Thaumaturgy") { val name = stack.name ?: return if (name == "§aStats Tuning") { var grab = false @@ -84,7 +84,7 @@ class StatsTuning { } } if (SkyHanniMod.feature.inventory.statsTuningPoints) { - if (chestName == "Stats Tuning") { + if (inventoryName == "Stats Tuning") { for (line in stack.getLore()) { val matcher = patternStatPoints.matcher(line) if (matcher.matches()) { -- cgit From de538b99d540f155d49b4694b195b89ea60f18b9 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 08:47:50 +0100 Subject: Added minion name display. --- .../hannibal2/skyhanni/config/features/Hidden.java | 5 +- .../skyhanni/config/features/Minions.java | 15 ++-- .../skyhanni/features/minion/MinionData.kt | 5 ++ .../skyhanni/features/minion/MinionFeatures.kt | 98 +++++++++++++++------- 4 files changed, 86 insertions(+), 37 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/minion/MinionData.kt diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java index eef96aa56..b3d138269 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java @@ -14,5 +14,8 @@ public class Hidden { public String currentPet = ""; @Expose - public Map minions = new HashMap<>(); + public Map minionLastClick = new HashMap<>(); + + @Expose + public Map minionName = new HashMap<>(); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java b/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java index 718c46576..d29eb45bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java @@ -6,6 +6,11 @@ import com.google.gson.annotations.Expose; public class Minions { + @Expose + @ConfigOption(name = "Name Display", desc = "Show the minion name and tier over the minion.") + @ConfigEditorBoolean + public boolean nameDisplay = true; + @ConfigOption(name = "Last Clicked", desc = "") @ConfigEditorAccordion(id = 0) public boolean lastClickedMinion = false; @@ -43,15 +48,15 @@ public class Minions { public boolean emptiedTime = false; @Expose - @ConfigOption(name = "Emptied Time Display", desc = "Show the time when the hopper in the minion was last emptied") + @ConfigOption(name = "Emptied Time Display", desc = "Show the time when the hopper in the minion was last emptied.") @ConfigEditorBoolean @ConfigAccordionId(id = 1) public boolean emptiedTimeDisplay = false; @Expose @ConfigOption( - name = "Emptied Time Distance", - desc = "At what distance is this display shown" + name = "Distance", + desc = "At what distance is the minion display shown." ) @ConfigEditorSlider( minValue = 3, @@ -59,7 +64,7 @@ public class Minions { minStep = 1 ) @ConfigAccordionId(id = 1) - public int emptiedTimeDistance = 10; + public int distance = 10; @ConfigOption(name = "Hopper Profit", desc = "") @ConfigEditorAccordion(id = 2) @@ -69,7 +74,7 @@ public class Minions { @ConfigOption(name = "Hopper Profit Display", desc = "Using the held coins and the last empty time to calculate the coins a hopper collects in a day") @ConfigEditorBoolean @ConfigAccordionId(id = 2) - public boolean hopperProfitDisplay = false; + public boolean hopperProfitDisplay = true; @Expose @ConfigOption(name = "Best Sell Method Position", desc = "") diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionData.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionData.kt new file mode 100644 index 000000000..02ee25b51 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionData.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.features.minion + +import scala.Serializable + +class MinionData(var name: String,var lastClicked: Long) : Serializable \ No newline at end of file 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 ee72ff542..5751fefd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils.formatInteger import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.Minecraft @@ -28,21 +29,24 @@ import java.awt.Color class MinionFeatures { - var lastClickedEntity: LorenzVec? = null - var lastMinion: LorenzVec? = null - var lastMinionOpened = 0L - var minionInventoryOpen = false + private var lastClickedEntity: LorenzVec? = null + private var lastMinion: LorenzVec? = null + private var lastMinionOpened = 0L + private var minionInventoryOpen = false - var lastCoinsRecived = 0L - var lastMinionPickedUp = 0L - val minions = mutableMapOf() - var coinsPerDay = "" + private var lastCoinsRecived = 0L + private var lastMinionPickedUp = 0L + private val minions = mutableMapOf() + private var coinsPerDay = "" @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - for (minion in SkyHanniMod.feature.hidden.minions) { - val vec = LorenzVec.decodeFromString(minion.key) - minions[vec] = minion.value + for (minion in SkyHanniMod.feature.hidden.minionLastClick) { + val key = minion.key + val vec = LorenzVec.decodeFromString(key) + val name = SkyHanniMod.feature.hidden.minionName[key] ?: "§cNo name saved!" + val data = MinionData(name, minion.value) + minions[vec] = data } } @@ -90,9 +94,20 @@ class MinionFeatures { fun onTick(event: TickEvent.ClientTickEvent) { if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return - if (InventoryUtils.currentlyOpenInventory().contains("Minion")) { - if (lastClickedEntity != null) { - lastMinion = lastClickedEntity + val openInventory = InventoryUtils.currentlyOpenInventory() + if (openInventory.contains("Minion")) { + lastClickedEntity?.let { + val name = getMinionName(openInventory) + if (!minions.contains(it)) { + minions[it] = MinionData(name, 0) + saveConfig() + } else { + if (minions[it]!!.name != name) { + minions[it]!!.name = name + saveConfig() + } + } + lastMinion = it lastClickedEntity = null minionInventoryOpen = true lastMinionOpened = 0 @@ -106,11 +121,11 @@ class MinionFeatures { if (location != null) { if (System.currentTimeMillis() - lastCoinsRecived < 2_000) { - minions[location] = System.currentTimeMillis() + minions[location]!!.lastClicked = System.currentTimeMillis() saveConfig() } if (location !in minions) { - minions[location] = 0 + minions[location]!!.lastClicked = 0 } if (System.currentTimeMillis() - lastMinionPickedUp < 2_000) { @@ -130,6 +145,15 @@ class MinionFeatures { } } + private fun getMinionName(inventoryName: String): String { + var list = inventoryName.split(" ").toList() + val last = list.last() + val number = last.romanToDecimal() + list = list.dropLast(1) + + return list.joinToString(" ") + " $number" + } + private fun updateCoinsPerDay(): String { val loc = lastMinion!! val slot = InventoryUtils.getItemsInOpenChest().find { it.slotNumber == 28 } ?: return "" @@ -139,8 +163,8 @@ class MinionFeatures { if (coinsPerDay != "") return coinsPerDay - val lastClicked = minions.getOrDefault(loc, -1) - if (lastClicked == -1L) { + val lastClicked = minions[loc]!!.lastClicked + if (lastClicked == 0L) { return "Can't calculate coins/day: No time data available!" } val duration = System.currentTimeMillis() - lastClicked @@ -156,13 +180,17 @@ class MinionFeatures { } private fun saveConfig() { - val minionConfig = SkyHanniMod.feature.hidden.minions + val minionConfig = SkyHanniMod.feature.hidden.minionLastClick + val minionName = SkyHanniMod.feature.hidden.minionName minionConfig.clear() + minionName.clear() for (minion in minions) { - minionConfig[minion.key.encodeToString()] = minion.value + val coordinates = minion.key.encodeToString() + val data = minion.value + minionConfig[coordinates] = data.lastClicked + minionName[coordinates] = data.name } - } @SubscribeEvent @@ -189,21 +217,29 @@ class MinionFeatures { @SubscribeEvent fun onRenderLastEmptied(event: RenderWorldLastEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.minions.emptiedTimeDisplay) return if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return val playerLocation = LocationUtils.playerLocation() val playerEyeLocation = LocationUtils.playerEyeLocation() for (minion in minions) { - val location = minion.key - if (playerLocation.distance(location) < SkyHanniMod.feature.minions.emptiedTimeDistance) { - val lastEmptied = minion.value - if (lastEmptied == 0L) continue - val duration = System.currentTimeMillis() - lastEmptied - val format = StringUtils.formatDuration(duration / 1000) + " ago" - if (LocationUtils.canSee(playerEyeLocation, location)) { - val text = "§eHopper Emptied: $format" - event.drawString(location.add(0.0, 2.0, 0.0), text, true) + val location = minion.key.add(0.0, 1.0, 0.0) + if (LocationUtils.canSee(playerEyeLocation, location)) { + val lastEmptied = minion.value.lastClicked + if (playerLocation.distance(location) < SkyHanniMod.feature.minions.distance) { + + if (SkyHanniMod.feature.minions.nameDisplay) { + val name = "§9" + minion.value.name + event.drawString(location.add(0.0, 0.65, 0.0), name, true) + } + + if (SkyHanniMod.feature.minions.emptiedTimeDisplay) { + if (lastEmptied != 0L) { + val duration = System.currentTimeMillis() - lastEmptied + val format = StringUtils.formatDuration(duration / 1000) + " ago" + val text = "§eHopper Emptied: $format" + event.drawString(location.add(0.0, 1.15, 0.0), text, true) + } + } } } } -- cgit From f9dc3d00aefe80b8d94f218fe012c9c3737b118f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 08:47:56 +0100 Subject: Added minion name display. --- CHANGELOG.md | 1 + FEATURES.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98514c811..32156cdce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ + Added Compact Bingo Chat Messages. + Added Compact Potion Effect Chat Messages. + Added Brewing Stand Overlay. ++ Added minion name display with minion tier. ### Changes + Don't render overlays when tab list key is pressed. diff --git a/FEATURES.md b/FEATURES.md index eb6d2c742..0788dd7c8 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -86,6 +86,7 @@ - A marker to the last opened minion for a couple of seconds (seen through walls) - Option to hide mob nametags close to minions. - Minion hopper coins per day display (Using the held coins in the hopper and the last time the hopper was collected to calculate the coins a hopper collects in a day) +- Minion name display with minion tier. ## Bazaar - Showing colors in the order inventory for outbid or fully bought/sold items. -- cgit From b73026ee953306fdbe4b4aa382aa83f15a12565d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 7 Jan 2023 08:48:40 +0100 Subject: 0.14 --- CHANGELOG.md | 2 +- build.gradle.kts | 2 +- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32156cdce..51270877e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # SkyHanni - Change Log -## Version 0.13.1 +## Version 0.14 ### Features + Added /shtrackcollection - This tracks the number of items you collect, but it does not work with sacks. diff --git a/build.gradle.kts b/build.gradle.kts index 398adb850..9f6014f26 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.13.1" +version = "0.14" // Toolchains: java { diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 62ff318ae..f6190fb10 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -62,7 +62,7 @@ import java.util.List; public class SkyHanniMod { public static final String MODID = "skyhanni"; - public static final String VERSION = "0.13.1"; + public static final String VERSION = "0.14"; public static Features feature; -- cgit