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 --- .../skyhanni/features/rift/CruxWarnings.kt | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 -- 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/hannibal2/skyhanni/features') 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/hannibal2/skyhanni/features') 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 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 --- .../at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 { -- 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/hannibal2/skyhanni/features') 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/hannibal2/skyhanni/features') 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/hannibal2/skyhanni/features') 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 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 --- .../java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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/hannibal2/skyhanni/features') 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 --- .../itemabilities/FireVeilWandParticles.kt | 6 +-- .../hannibal2/skyhanni/features/rift/RiftLarva.kt | 51 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/RiftLarva.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 +} -- 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 --- .../features/inventory/ItemDisplayOverlayFeatures.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 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 --- .../hannibal2/skyhanni/features/rift/RiftLarva.kt | 8 ++-- .../skyhanni/features/rift/RiftOdonata.kt | 51 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/RiftOdonata.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 --- .../skyhanni/features/rift/RiftAgaricusCap.kt | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 +} -- 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/hannibal2/skyhanni/features') 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/hannibal2/skyhanni/features') 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(?