From 06aa3dbd0a32b0f2d9d92d30adeec46289428a7e Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 23 Jun 2023 00:24:24 +1000 Subject: Shy Warning (#251) Shy Warning --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ .../skyhanni/config/features/RiftConfig.java | 13 +++++++++ .../skyhanni/features/rift/CruxWarnings.kt | 34 ++++++++++++++++++++++ .../at/hannibal2/skyhanni/utils/LocationUtils.kt | 3 ++ 4 files changed, 52 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index e4a9d682c..b61e79d1d 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -60,6 +60,7 @@ import at.hannibal2.skyhanni.features.mobs.MobHighlight import at.hannibal2.skyhanni.features.nether.ashfang.* import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper import at.hannibal2.skyhanni.features.rift.HighlightRiftGuide +import at.hannibal2.skyhanni.features.rift.CruxWarnings import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.features.rift.RiftTimer import at.hannibal2.skyhanni.features.slayer.* @@ -306,6 +307,7 @@ class SkyHanniMod { loadModule(GhostCounter) loadModule(RiftTimer()) loadModule(HighlightRiftGuide()) + loadModule(CruxWarnings()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index 0477920a2..9434305bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -32,7 +32,20 @@ public class RiftConfig { @Expose public Position timerPosition = new Position(10, 10, false, true); + } + + @ConfigOption(name = "Crux Warnings", desc = "") + @Accordion + @Expose + public CruxWarnings crux = new CruxWarnings(); + public static class CruxWarnings { + + @Expose + @ConfigOption(name = "Shy Warning", desc = "Shows a warning when a shy is going to steal your time. " + + "Useful if you play without volume") + @ConfigEditorBoolean + public boolean shyWarning = true; } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt new file mode 100644 index 000000000..509ed4979 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt @@ -0,0 +1,34 @@ +package at.hannibal2.skyhanni.features.rift + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.TitleUtils +import at.hannibal2.skyhanni.test.command.CopyErrorCommand +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer +import net.minecraft.client.Minecraft +import kotlin.concurrent.fixedRateTimer + +class CruxWarnings { + private val shyNames = arrayOf("I'm ugly! :(", "Eek!", "Don't look at me!", "Look away!") + + init { + fixedRateTimer(name = "skyhanni-shywarner-timer", period = 250) { + Minecraft.getMinecraft().thePlayer ?: return@fixedRateTimer + checkForShy() + } + } + + private fun checkForShy() { + try { + if (!(RiftAPI.inRift() || !SkyHanniMod.feature.rift.crux.shyWarning)) return + val world = Minecraft.getMinecraft().theWorld ?: return + val loadedEntityList = world.getLoadedEntityList() ?: return + for (entity in loadedEntityList) { + if (entity.name in shyNames && entity.distanceToPlayer() < 8) { + TitleUtils.sendTitle("§eLook away!", 250) + } + } + } catch (e: Throwable) { + CopyErrorCommand.logError(e, "Check for Shy failed") + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt index efcc8e493..510f631b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import net.minecraft.client.Minecraft +import net.minecraft.entity.Entity object LocationUtils { @@ -12,6 +13,8 @@ object LocationUtils { fun LorenzVec.distanceToPlayer() = distance(playerLocation()) + fun Entity.distanceToPlayer() = getLorenzVec().distance(playerLocation()) + fun playerEyeLocation(): LorenzVec { val player = Minecraft.getMinecraft().thePlayer val vec = player.getLorenzVec() -- cgit From adbaf85cf814e67508ddfdf33c787509e6f9e51b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:27:01 +0200 Subject: Added rift guide highlight to also work with Enigma Souls --- src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt index a8bf69fba..45b2daeb9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt @@ -24,7 +24,7 @@ class HighlightRiftGuide { val inGuide = event.inventoryItems[40]?.getLore()?.let { if (it.size == 1) { - it[0] == "§7To Rift Guide" + it[0].startsWith("§7To Rift Guide") } else false } ?: false if (!inGuide) return -- cgit From 481d6bafe9c4750f2bb96f333de5eabd221ac323 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:27:18 +0200 Subject: Added wizard warp as diana waypoint --- .../java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/at') 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 6682ffa81..7f6ee3670 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 @@ -100,6 +100,7 @@ class BurrowWarpHelper { // CRYPT("Crypt", LorenzVec(-190, 74, -88), 25), DA("Dark Auction", LorenzVec(91, 74, 173), 2), MUSEUM("Museum", LorenzVec(-75, 76, 81), 2), + WIZARD("Wizard", LorenzVec(42.5, 122.0, 69.0), 5), ; fun distance(other: LorenzVec): Double = other.distance(location) + extraBlocks -- cgit From 5b98edd63bb55754349508e0a6a6e6acca29b2d5 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:29:16 +0200 Subject: added credits --- CHANGELOG.md | 7 +++++++ FEATURES.md | 3 +++ .../java/at/hannibal2/skyhanni/config/features/RiftConfig.java | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/CHANGELOG.md b/CHANGELOG.md index 15dce9578..249398d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ + Show the remaining rift time, max time, percentage, and extra time changes. + **Rift Highlight Guide** + Highlight things to do in the Rift Guide. ++ Added **Shy Warning** (Contributed by CalMWolfs) + + Shows a warning when a shy is going to steal your time. + + Useful if you play without volume. + +### Changes ++ Option to show the yaw and pitch display outside garden or while not holding a farming tool (Contributed by CalMWolfs) ++ Added wizard warp as diana waypoint ## Version 0.18 (2023-06-19) diff --git a/FEATURES.md b/FEATURES.md index c21599543..0d3044ac5 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -275,6 +275,9 @@ + Show the remaining rift time, max time, percentage, and extra time changes. + **Highlight Guide** + Highlight things to do in the Rift Guide. ++ Added **Shy Warning** (Contributed by CalMWolfs) + + Shows a warning when a shy is going to steal your time. + + Useful if you play without volume. ## Commands + **/wiki ** - using hypixel-skyblock.fandom.com instead of Hypixel wiki. diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index 9434305bd..bd1f73800 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -43,7 +43,7 @@ public class RiftConfig { @Expose @ConfigOption(name = "Shy Warning", desc = "Shows a warning when a shy is going to steal your time. " + - "Useful if you play without volume") + "Useful if you play without volume.") @ConfigEditorBoolean public boolean shyWarning = true; } -- cgit From 1ff9c6ead7343eebc1f0efc980d5f29faa8f68ec Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:43:20 +0200 Subject: Fixed the error message with HEMOVIBE not found in NEU Repo --- src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt | 1 - .../hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt | 9 +++++++-- src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 14 +++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index 08234bdf1..0b6178399 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -18,7 +18,6 @@ abstract class LorenzEvent : Event() { if (it is NoSuchMethodError) { LorenzUtils.chat("§c[SkyHanni] You need to use a newer version of NotEnoughUpdates (alpha-11 or newer)! If you need help downloading it, go to the skyhanni discord.") } else { - it.printStackTrace() CopyErrorCommand.logError(it, "Caught an ${it::class.simpleName ?: "error"} at ${eventName}: '${it.message}'") } }.getOrDefault(isCanceled) diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt index 5e2321e24..e6f646ef1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt @@ -48,8 +48,13 @@ class BazaarDataHolder { fun getData(internalName: String) = bazaarData[internalName] ?: createNewData(internalName) - private fun createNewData(internalName: String): BazaarData { - val displayName = NEUItems.getItemStack(internalName).name!!.removeColor() + private fun createNewData(internalName: String): BazaarData? { + val stack = NEUItems.getItemStackOrNull(internalName) + if (stack == null) { + LorenzUtils.debug("Bazaar data is null: '$internalName'") + return null + } + val displayName = stack.name!!.removeColor() val sellPrice = NEUItems.getPrice(internalName, true) val buyPrice = NEUItems.getPrice(internalName, false) val npcPrice = npcPrices[internalName].let { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 07e1c9318..dc98f3a0a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -134,15 +134,11 @@ object NEUItems { .withKnownInternalName(internalName) .resolveToItemStack()?.copy() - fun getItemStack(internalName: String): ItemStack { - val stack = getItemStackOrNull(internalName) - if (stack == null) { - val error = "ItemResolutionQuery returns null for internalName '$internalName'" - LorenzUtils.error(error) - throw RuntimeException(error) - } - return stack - } + fun getItemStack(internalName: String): ItemStack = getItemStackOrNull(internalName) + ?: throw IllegalStateException( + "Could not find the Item '$internalName' in NEU Repo", + Error("ItemResolutionQuery returns null for internalName '$internalName'") + ) fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName()) -- cgit From e81c69a7455e5dd30cb12abcd3ba0abc3ad53594 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:48:54 +0200 Subject: beta 1 --- build.gradle.kts | 2 +- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/at') diff --git a/build.gradle.kts b/build.gradle.kts index 19b85e44d..462480f25 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.18" +version = "0.19.Beta.1" // Toolchains: java { diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index b61e79d1d..5e17be293 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -59,8 +59,8 @@ import at.hannibal2.skyhanni.features.mobs.AshfangMinisNametagHider import at.hannibal2.skyhanni.features.mobs.MobHighlight import at.hannibal2.skyhanni.features.nether.ashfang.* import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper -import at.hannibal2.skyhanni.features.rift.HighlightRiftGuide import at.hannibal2.skyhanni.features.rift.CruxWarnings +import at.hannibal2.skyhanni.features.rift.HighlightRiftGuide import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.features.rift.RiftTimer import at.hannibal2.skyhanni.features.slayer.* @@ -98,7 +98,7 @@ import org.apache.logging.log4j.Logger clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop", - version = "0.18", + version = "0.19.Beta.1", ) class SkyHanniMod { @Mod.EventHandler -- cgit From d9ccf2acda2812906286f6a338398a2f92b273dc Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:58:25 +0200 Subject: Fixed Pocket Sack-In-A-Sack Replace In Lore --- .../at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt index 721248658..17f248753 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAppliedPocketSackInASack import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -53,7 +54,7 @@ class PocketSackInASackDisplay { val it = event.toolTip.listIterator() for (line in it) { valPattern.matchMatcher(line) { - val replace = when (group("number")) { + val replace = when (group("number").removeColor()) { "a" -> "§c1" "two" -> "§62" "three" -> "§a3" -- cgit From 0f5055bd42614db2dd28e1c9f80494f872a884ed Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:08:58 +0200 Subject: reset rift time on world switch --- src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt index 6fe16c981..ffe8097c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt @@ -21,6 +21,8 @@ class RiftTimer { @SubscribeEvent fun onJoinWorld(ignored: WorldEvent.Load) { display = emptyList() + maxTime = 0 + latestTime = 0 } @SubscribeEvent -- cgit From c4acb66a4b6ab9498659613b5193a06044d3fd47 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:26:56 +0200 Subject: Fixed Pocket Sack-In-A-Sack Replace In Lore v2 --- .../at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt index 17f248753..8507deb6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt @@ -7,14 +7,13 @@ import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAppliedPocketSackInASack import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PocketSackInASackDisplay { private val config get() = SkyHanniMod.feature.misc.pocketSackInASack - private val valPattern = "§5§o§7This sack is stitched with (?.*)".toPattern() + private val valPattern = "§5§o§7This sack is stitched with (?.*)§7.".toPattern() @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { @@ -54,7 +53,7 @@ class PocketSackInASackDisplay { val it = event.toolTip.listIterator() for (line in it) { valPattern.matchMatcher(line) { - val replace = when (group("number").removeColor()) { + val replace = when (group("number")) { "a" -> "§c1" "two" -> "§62" "three" -> "§a3" -- cgit From 25962a047b310662f923917d96cd96a1d3a16965 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:54:43 +0200 Subject: sending the normal stack trace in the console as normal --- .../at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt index ccaeee6ef..112768637 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt @@ -36,15 +36,17 @@ object CopyErrorCommand { } ?: "§c[SkyHanni] Error id not found!") } - fun logError(error: Throwable, message: String) { - Minecraft.getMinecraft().thePlayer ?: throw Error(message, error) + fun logError(throwable: Throwable, message: String) { + val error = Error(message, throwable) + Minecraft.getMinecraft().thePlayer ?: throw error + error.printStackTrace() - val pair = error.stackTrace[0].let { it.fileName to it.lineNumber } + val pair = throwable.stackTrace[0].let { it.fileName to it.lineNumber } if (cache.getIfPresent(pair) != null) return cache.put(pair, Unit) - val fullStackTrace = error.getExactStackTrace(true).joinToString("\n") - val stackTrace = error.getExactStackTrace(false).joinToString("\n").removeSpam() + val fullStackTrace = throwable.getExactStackTrace(true).joinToString("\n") + val stackTrace = throwable.getExactStackTrace(false).joinToString("\n").removeSpam() val randomId = UUID.randomUUID().toString() errorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $message\n \n$stackTrace\n```" -- cgit From d7deab0722473761b6e8d4c66a03d889f350a685 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:12:22 +0200 Subject: Fixed Shy warning problem with not using main thread --- src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 15 +++------------ src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt | 11 +++++++++++ .../java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt | 5 +++++ .../at/hannibal2/skyhanni/features/rift/CruxWarnings.kt | 9 +++++---- 4 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index b3e27f011..2877c843c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -1,9 +1,6 @@ package at.hannibal2.skyhanni.data -import at.hannibal2.skyhanni.events.HypixelJoinEvent -import at.hannibal2.skyhanni.events.IslandChangeEvent -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -11,7 +8,6 @@ import at.hannibal2.skyhanni.utils.TabListData 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 { @@ -73,14 +69,9 @@ class HypixelData { } } - var tick = 0 - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (event.phase != TickEvent.Phase.START) return - - tick++ - if (tick % 5 != 0) return + fun onTick(event: LorenzTickEvent) { + if (!event.isMod(5)) return if (!LorenzUtils.onHypixel) { checkHypixel() diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index f463391e3..334a99bf7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -8,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.network.play.server.S29PacketSoundEffect import net.minecraft.network.play.server.S2APacketParticles import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent class MinecraftData { @@ -49,4 +51,13 @@ class MinecraftData { event.isCanceled = true } } + + private var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (event.phase != TickEvent.Phase.START) return + tick++ + LorenzTickEvent(tick).postAndCatch() + } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt new file mode 100644 index 000000000..ce9c57e97 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events + +class LorenzTickEvent(private val tick: Int) : LorenzEvent() { + fun isMod(i: Int) = tick % i == 0 +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt index 509ed4979..295104caa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt @@ -2,17 +2,18 @@ package at.hannibal2.skyhanni.features.rift import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.TitleUtils +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import net.minecraft.client.Minecraft -import kotlin.concurrent.fixedRateTimer +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CruxWarnings { private val shyNames = arrayOf("I'm ugly! :(", "Eek!", "Don't look at me!", "Look away!") - init { - fixedRateTimer(name = "skyhanni-shywarner-timer", period = 250) { - Minecraft.getMinecraft().thePlayer ?: return@fixedRateTimer + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (event.isMod(2)) { checkForShy() } } -- cgit From 84d060a961e892c713eed16dd898c9f7f10fdd40 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:21:02 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt index 295104caa..39834a6bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt @@ -21,12 +21,9 @@ class CruxWarnings { private fun checkForShy() { try { if (!(RiftAPI.inRift() || !SkyHanniMod.feature.rift.crux.shyWarning)) return - val world = Minecraft.getMinecraft().theWorld ?: return - val loadedEntityList = world.getLoadedEntityList() ?: return - for (entity in loadedEntityList) { - if (entity.name in shyNames && entity.distanceToPlayer() < 8) { - TitleUtils.sendTitle("§eLook away!", 250) - } + val list = Minecraft.getMinecraft().theWorld?.getLoadedEntityList() ?: return + if (list.any { it.name in shyNames && it.distanceToPlayer() < 8 }) { + TitleUtils.sendTitle("§eLook away!", 250) } } catch (e: Throwable) { CopyErrorCommand.logError(e, "Check for Shy failed") -- cgit From de3fe21430a47bab500d71bfbbd0e22ae69a4285 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:14:04 +0200 Subject: Added Larvas Highlight --- CHANGELOG.md | 5 +++ FEATURES.md | 2 + src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 6 +-- .../skyhanni/config/features/RiftConfig.java | 20 +++++++++ .../itemabilities/FireVeilWandParticles.kt | 6 +-- .../hannibal2/skyhanni/features/rift/RiftLarva.kt | 51 ++++++++++++++++++++++ .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 4 ++ 7 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt (limited to 'src/main/java/at') diff --git a/CHANGELOG.md b/CHANGELOG.md index 249398d90..4fe01e062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,16 @@ + Added **Shy Warning** (Contributed by CalMWolfs) + Shows a warning when a shy is going to steal your time. + Useful if you play without volume. ++ Added **Larvas Highlighter** + + Highlight larvas on trees while holding a Larva Hook in the hand ### Changes + Option to show the yaw and pitch display outside garden or while not holding a farming tool (Contributed by CalMWolfs) + Added wizard warp as diana waypoint +### Fixes ++ Fixed Pocket Sack-In-A-Sack Replace in lore + ## Version 0.18 (2023-06-19) ### New Features diff --git a/FEATURES.md b/FEATURES.md index 0d3044ac5..27003e74c 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -278,6 +278,8 @@ + Added **Shy Warning** (Contributed by CalMWolfs) + Shows a warning when a shy is going to steal your time. + Useful if you play without volume. ++ Added **Larvas Highlighter** + + Highlight larvas on trees in Wyld Woods while holding a Larva Hook in the hand ## Commands + **/wiki ** - using hypixel-skyblock.fandom.com instead of Hypixel wiki. diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 5e17be293..4dee361aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -59,10 +59,7 @@ import at.hannibal2.skyhanni.features.mobs.AshfangMinisNametagHider import at.hannibal2.skyhanni.features.mobs.MobHighlight import at.hannibal2.skyhanni.features.nether.ashfang.* import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper -import at.hannibal2.skyhanni.features.rift.CruxWarnings -import at.hannibal2.skyhanni.features.rift.HighlightRiftGuide -import at.hannibal2.skyhanni.features.rift.RiftAPI -import at.hannibal2.skyhanni.features.rift.RiftTimer +import at.hannibal2.skyhanni.features.rift.* import at.hannibal2.skyhanni.features.slayer.* import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerClearView import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper @@ -308,6 +305,7 @@ class SkyHanniMod { loadModule(RiftTimer()) loadModule(HighlightRiftGuide()) loadModule(CruxWarnings()) + loadModule(RiftLarva()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index bd1f73800..3928da174 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigOption; public class RiftConfig { @@ -52,4 +53,23 @@ public class RiftConfig { @ConfigOption(name = "Highlight Guide", desc = "Highlight things to do in the Rift Guide.") @ConfigEditorBoolean public boolean highlightGuide = true; + + @ConfigOption(name = "Larvas", desc = "") + @Accordion + @Expose + public LarvasConfig larvas = new LarvasConfig(); + + public static class LarvasConfig { + + @Expose + @ConfigOption(name = "Highlight", desc = "Highlight larvas on trees while holding a Larva Hook in the hand.") + @ConfigEditorBoolean + public boolean highlight = true; + + @Expose + @ConfigOption(name = "Color", desc = "Color of the Ashfang Gravity Orbs.") + @ConfigEditorColour + public String highlightColor = "0:120:255:85:85"; + + } } 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 96d1bb74f..e64a56ed5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -6,13 +6,12 @@ import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.RenderUtils -import at.hannibal2.skyhanni.utils.SpecialColour import net.minecraft.client.Minecraft import net.minecraft.util.EnumParticleTypes import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color class FireVeilWandParticles { @@ -48,8 +47,7 @@ class FireVeilWandParticles { if (SkyHanniMod.feature.itemAbilities.fireVeilWandDisplay != 1) return if (System.currentTimeMillis() > lastClick + 5_500) return - val color = - Color(SpecialColour.specialToChromaRGB(SkyHanniMod.feature.itemAbilities.fireVeilWandDisplayColor), true) + val color = SkyHanniMod.feature.itemAbilities.fireVeilWandDisplayColor.toChromaColor() RenderUtils.drawCircle(Minecraft.getMinecraft().thePlayer, event.partialTicks, 3.5, color) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt new file mode 100644 index 000000000..efaed60d6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt @@ -0,0 +1,51 @@ +package at.hannibal2.skyhanni.features.rift + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor +import net.minecraft.client.Minecraft +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RiftLarva { + private val config get() = SkyHanniMod.feature.rift.larvas + private var hasLarvaHookInHand = false + val larvaSkullTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTgzYjMwZTlkMTM1YjA1MTkwZWVhMmMzYWM2MWUyYWI1NWEyZDgxZTFhNThkYmIyNjk4M2ExNDA4MjY2NCJ9fX0=" + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + + checkHand() + if (!hasLarvaHookInHand) return + + if (event.isMod(20)) { + findLarvas() + } + } + + private fun checkHand() { + hasLarvaHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK" + } + + private fun findLarvas() { + + val list = Minecraft.getMinecraft().theWorld?.loadedEntityList ?: return + for (stand in list.filterIsInstance()) { + if (stand.hasSkullTexture(larvaSkullTexture)) { + RenderLivingEntityHelper.setEntityColor( + stand, + config.highlightColor.toChromaColor().withAlpha(1) + ) { isEnabled() && hasLarvaHookInHand } + } + } + } + + fun isEnabled() = RiftAPI.inRift() && config.highlight +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index bc50ea0e6..c1309d573 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -20,6 +20,7 @@ import net.minecraft.event.ClickEvent import net.minecraft.event.HoverEvent import net.minecraft.util.ChatComponentText import org.lwjgl.input.Keyboard +import java.awt.Color import java.text.DecimalFormat import java.text.NumberFormat import java.text.SimpleDateFormat @@ -381,4 +382,7 @@ object LorenzUtils { @Suppress("UNCHECKED_CAST") this[item] = d as N } + + /** transfer string colors from the config to java.awt.Color */ + fun String.toChromaColor() = Color(SpecialColour.specialToChromaRGB(this), true) } \ No newline at end of file -- cgit From d4d16cbc7614452757e081e1498f0b9243f28318 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:14:46 +0200 Subject: Added larva Hook uses display to item number feature --- .../at/hannibal2/skyhanni/config/features/Inventory.java | 3 ++- .../features/inventory/ItemDisplayOverlayFeatures.kt | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java index d61db3cfd..0058bc2a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -210,7 +210,8 @@ public class Inventory { "§bKuudra Key", "§bSkill Level", "§bCollection Level", - "§bRancher's Boots speed" + "§bRancher's Boots speed", + "§bLarva Hook" } ) public List itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 9, 11)); 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 4ddfb0cf0..60680897b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -6,6 +6,7 @@ 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.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils.between @@ -159,6 +160,17 @@ class ItemDisplayOverlayFeatures { } } } + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(12)) { + if (item.getInternalName() == "LARVA_HOOK") { + for (line in item.getLore()) { + "§7§7You may harvest §6(?.)/.*".toPattern().matchMatcher(line) { + return group("amount") + } + } + } + } + return "" } -- cgit From 6c178398c8f24b0fe2e95f47eb9bea5c83af4b4b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:15:27 +0200 Subject: potential fix for the future --- src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index 334a99bf7..20d6f4d5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec +import net.minecraft.client.Minecraft import net.minecraft.network.play.server.S29PacketSoundEffect import net.minecraft.network.play.server.S2APacketParticles import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -57,6 +58,7 @@ class MinecraftData { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return + Minecraft.getMinecraft().thePlayer ?: return tick++ LorenzTickEvent(tick).postAndCatch() } -- cgit From cc5e3b78f881e034f2bd4806ff4264fd2514be1d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 21:09:52 +0200 Subject: Added Odonatas Highlighter --- CHANGELOG.md | 3 ++ FEATURES.md | 3 ++ src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 1 + .../skyhanni/config/features/RiftConfig.java | 35 +++++++++++---- .../hannibal2/skyhanni/features/rift/RiftLarva.kt | 8 ++-- .../skyhanni/features/rift/RiftOdonata.kt | 51 ++++++++++++++++++++++ 6 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt (limited to 'src/main/java/at') diff --git a/CHANGELOG.md b/CHANGELOG.md index ca2d75c14..99a8c50d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ + Added **Larvas Highlighter** + Highlight larvas on trees in Wyld Woods while holding a Larva Hook in the hand + Customize the color ++ Added **Odonatas Highlighter** + + Highlight the small Odonatas flying around the trees while holding a Empty Odonata Bottle in the hand. + + Customize the color ### Changes + Option to show the yaw and pitch display outside garden or while not holding a farming tool (Contributed by CalMWolfs) diff --git a/FEATURES.md b/FEATURES.md index b7f36a31b..e38d8da5e 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -281,6 +281,9 @@ + Added **Larvas Highlighter** + Highlight larvas on trees in Wyld Woods while holding a Larva Hook in the hand + Customize the color ++ Added **Odonatas Highlighter** + + Highlight the small Odonatas flying around the trees while holding a Empty Odonata Bottle in the hand. + + Customize the color ## Commands + **/wiki ** - using hypixel-skyblock.fandom.com instead of Hypixel wiki. diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 4dee361aa..047f20060 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -306,6 +306,7 @@ class SkyHanniMod { loadModule(HighlightRiftGuide()) loadModule(CruxWarnings()) loadModule(RiftLarva()) + loadModule(RiftOdonata()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index 3928da174..3a634639f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -49,11 +49,6 @@ public class RiftConfig { public boolean shyWarning = true; } - @Expose - @ConfigOption(name = "Highlight Guide", desc = "Highlight things to do in the Rift Guide.") - @ConfigEditorBoolean - public boolean highlightGuide = true; - @ConfigOption(name = "Larvas", desc = "") @Accordion @Expose @@ -62,14 +57,38 @@ public class RiftConfig { public static class LarvasConfig { @Expose - @ConfigOption(name = "Highlight", desc = "Highlight larvas on trees while holding a Larva Hook in the hand.") + @ConfigOption(name = "Highlight", desc = "Highlight §cLarvas on trees §7while holding a §eLarva Hook §7in the hand.") @ConfigEditorBoolean public boolean highlight = true; @Expose - @ConfigOption(name = "Color", desc = "Color of the Ashfang Gravity Orbs.") + @ConfigOption(name = "Color", desc = "Color of the Larvas.") @ConfigEditorColour - public String highlightColor = "0:120:255:85:85"; + public String highlightColor = "0:120:13:49:255"; } + + @ConfigOption(name = "Odonatas", desc = "") + @Accordion + @Expose + public OdonataConfig odonata = new OdonataConfig(); + + public static class OdonataConfig { + + @Expose + @ConfigOption(name = "Highlight", desc = "Highlight the small §cOdonatas §7flying around the trees while holding a §eEmpty Odonata Bottle §7in the hand.") + @ConfigEditorBoolean + public boolean highlight = true; + + @Expose + @ConfigOption(name = "Color", desc = "Color of the Odonatas.") + @ConfigEditorColour + public String highlightColor = "0:120:13:49:255"; + + } + + @Expose + @ConfigOption(name = "Highlight Guide", desc = "Highlight things to do in the Rift Guide.") + @ConfigEditorBoolean + public boolean highlightGuide = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt index efaed60d6..93df913c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RiftLarva { private val config get() = SkyHanniMod.feature.rift.larvas - private var hasLarvaHookInHand = false + private var hasHookInHand = false val larvaSkullTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTgzYjMwZTlkMTM1YjA1MTkwZWVhMmMzYWM2MWUyYWI1NWEyZDgxZTFhNThkYmIyNjk4M2ExNDA4MjY2NCJ9fX0=" @@ -23,7 +23,7 @@ class RiftLarva { if (!isEnabled()) return checkHand() - if (!hasLarvaHookInHand) return + if (!hasHookInHand) return if (event.isMod(20)) { findLarvas() @@ -31,7 +31,7 @@ class RiftLarva { } private fun checkHand() { - hasLarvaHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK" + hasHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK" } private fun findLarvas() { @@ -42,7 +42,7 @@ class RiftLarva { RenderLivingEntityHelper.setEntityColor( stand, config.highlightColor.toChromaColor().withAlpha(1) - ) { isEnabled() && hasLarvaHookInHand } + ) { isEnabled() && hasHookInHand } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt new file mode 100644 index 000000000..7c3fae78b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt @@ -0,0 +1,51 @@ +package at.hannibal2.skyhanni.features.rift + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor +import net.minecraft.client.Minecraft +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RiftOdonata { + private val config get() = SkyHanniMod.feature.rift.odonata + private var hasBottleInHand = false + val odonataSkullTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkODA2ZGVmZGZkZjU5YjFmMjYwOWM4ZWUzNjQ2NjZkZTY2MTI3YTYyMzQxNWI1NDMwYzkzNThjNjAxZWY3YyJ9fX0=" + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + + checkHand() + if (!hasBottleInHand) return + + if (event.isMod(20)) { + findOdonatas() + } + } + + private fun checkHand() { + hasBottleInHand = InventoryUtils.getItemInHand()?.getInternalName() == "EMPTY_ODONATA_BOTTLE" + } + + private fun findOdonatas() { + + val list = Minecraft.getMinecraft().theWorld?.loadedEntityList ?: return + for (stand in list.filterIsInstance()) { + if (stand.hasSkullTexture(odonataSkullTexture)) { + RenderLivingEntityHelper.setEntityColor( + stand, + config.highlightColor.toChromaColor().withAlpha(1) + ) { isEnabled() && hasBottleInHand } + } + } + } + + fun isEnabled() = RiftAPI.inRift() && config.highlight +} -- cgit From 11443e506b17bc60c86fec5297b86d5a2fd0a4da Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 23:56:13 +0200 Subject: Added Agaricus Cap countdown --- CHANGELOG.md | 2 + FEATURES.md | 2 + src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 1 + .../skyhanni/config/features/RiftConfig.java | 5 ++ .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 2 +- .../skyhanni/features/rift/RiftAgaricusCap.kt | 76 ++++++++++++++++++++++ .../java/at/hannibal2/skyhanni/utils/BlockUtils.kt | 14 ++++ .../java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 4 ++ 8 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt (limited to 'src/main/java/at') diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a8c50d6..7166899d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ + Added **Odonatas Highlighter** + Highlight the small Odonatas flying around the trees while holding a Empty Odonata Bottle in the hand. + Customize the color ++ Added **Agaricus Cap** countdown + + Counts down the time until Agaricus Cap (Mushroom) changes color from brown to red and is breakable. ### Changes + Option to show the yaw and pitch display outside garden or while not holding a farming tool (Contributed by CalMWolfs) diff --git a/FEATURES.md b/FEATURES.md index e38d8da5e..b9c199e3f 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -284,6 +284,8 @@ + Added **Odonatas Highlighter** + Highlight the small Odonatas flying around the trees while holding a Empty Odonata Bottle in the hand. + Customize the color ++ Added **Agaricus Cap** countdown + + Counts down the time until Agaricus Cap (Mushroom) changes color from brown to red and is breakable. ## Commands + **/wiki ** - using hypixel-skyblock.fandom.com instead of Hypixel wiki. diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 047f20060..76b0b88ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -307,6 +307,7 @@ class SkyHanniMod { loadModule(CruxWarnings()) loadModule(RiftLarva()) loadModule(RiftOdonata()) + loadModule(RiftAgaricusCap()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index 3a634639f..8cff848fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -91,4 +91,9 @@ public class RiftConfig { @ConfigOption(name = "Highlight Guide", desc = "Highlight things to do in the Rift Guide.") @ConfigEditorBoolean public boolean highlightGuide = true; + + @Expose + @ConfigOption(name = "Agaricus Cap", desc = "Counts down the time until §eAgaricus Cap (Mushroom) §7changes color from brown to red and is breakable.") + @ConfigEditorBoolean + public boolean agaricusCap = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 2877c843c..4d0cce395 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -30,7 +30,7 @@ class HypixelData { fun readSkyBlockArea(): String { return ScoreboardData.sidebarLinesFormatted - .firstOrNull { it.startsWith(" §7⏣ ") } + .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } ?.substring(5)?.removeColor() ?: "invalid" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt new file mode 100644 index 000000000..02eff13f6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt @@ -0,0 +1,76 @@ +package at.hannibal2.skyhanni.features.rift + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RiftAgaricusCap { + private val config get() = SkyHanniMod.feature.rift + private var startTime = 0L + private var location: LorenzVec? = null + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + val area = LorenzUtils.skyBlockArea + if (area != "West Village" && area != "Dreadfarm") return + + location = updateLocation() + } + + private fun updateLocation(): LorenzVec? { + if (InventoryUtils.getItemInHand()?.getInternalName() != "FARMING_WAND") return null + val currentLocation = BlockUtils.getBlockLookingAt() ?: return null + + when (currentLocation.getBlockStateAt().toString()) { + "minecraft:brown_mushroom" -> { + return if (location != currentLocation) { + startTime = System.currentTimeMillis() + currentLocation + } else { + if (startTime == -1L) { + startTime = System.currentTimeMillis() + } + location + } + } + + "minecraft:red_mushroom" -> { + if (startTime != 0L && startTime != -1L) { + val s = System.currentTimeMillis() - startTime + LorenzUtils.debug("red mushroom after ${s}ms!") + } + + if (location == currentLocation) { + startTime = -1L + return location + } + } + } + return null + } + + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!isEnabled()) return + + val location = location?.add(0.0, 0.6, 0.0) ?: return + + if (startTime == -1L) { + event.drawDynamicText(location, "§cClick!", 1.5) + return + } + + val countDown = System.currentTimeMillis() - startTime + val format = TimeUtils.formatDuration(countDown - 1000, showMilliSeconds = true) + + event.drawDynamicText(location, "§b$format", 1.5) + } + + fun isEnabled() = RiftAPI.inRift() && config.agaricusCap +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt index e16df26e9..a35d0de06 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt @@ -39,4 +39,18 @@ object BlockUtils { return false } + + fun rayTrace(start: LorenzVec, direction: LorenzVec, distance: Double = 50.0): LorenzVec? { + val help = direction.normalize().multiply(distance) + val target = start.add(help) + val result = Minecraft.getMinecraft().theWorld.rayTraceBlocks(start.toVec3(), target.toVec3()) + + return result?.blockPos?.toLorenzVec() + } + + fun getBlockLookingAt(duration: Double = 10.0) = rayTrace( + LocationUtils.playerEyeLocation(), + Minecraft.getMinecraft().thePlayer.lookVec.toLorenzVec(), + duration + ) } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index 5bce2d762..4b716964f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -64,6 +64,8 @@ data class LorenzVec( fun subtract(other: LorenzVec) = LorenzVec(x - other.x, y - other.y, z - other.z) + fun normalize() = length().let { LorenzVec(x / it, y / it, z / it) } + fun printWithAccuracy(accuracy: Int): String { val x = (round(x * accuracy) / accuracy) val y = (round(y * accuracy) / accuracy) @@ -89,6 +91,8 @@ data class LorenzVec( fun equalsIgnoreY(other: LorenzVec) = x == other.x && z == other.z + fun equals(other: LorenzVec) = x == other.x && y == other.y && z == other.z + fun round(decimals: Int) = LorenzVec(x.round(decimals), y.round(decimals), z.round(decimals)) companion object { -- cgit From d2789b6938fa5db55b7d4fe258c48cacfab1f35d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 23:56:49 +0200 Subject: removed debug --- src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt index 02eff13f6..0b9bc9fbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt @@ -41,11 +41,6 @@ class RiftAgaricusCap { } "minecraft:red_mushroom" -> { - if (startTime != 0L && startTime != -1L) { - val s = System.currentTimeMillis() - startTime - LorenzUtils.debug("red mushroom after ${s}ms!") - } - if (location == currentLocation) { startTime = -1L return location -- cgit From 86fe9ce47707cc59f25b78082aff7962d107d95a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 23 Jun 2023 00:08:22 +0200 Subject: Fixed maxed rift time being off after teleporting out of wizard portal using Intruder/Porhtal --- .../skyhanni/features/rift/RiftAgaricusCap.kt | 1 - .../at/hannibal2/skyhanni/features/rift/RiftTimer.kt | 18 +++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt index 0b9bc9fbc..c4b452396 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt @@ -63,7 +63,6 @@ class RiftAgaricusCap { val countDown = System.currentTimeMillis() - startTime val format = TimeUtils.formatDuration(countDown - 1000, showMilliSeconds = true) - event.drawDynamicText(location, "§b$format", 1.5) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt index ffe8097c1..3901d8370 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt @@ -32,7 +32,7 @@ class RiftTimer { val message = event.message " §r§7You have §r§a(?