diff options
Diffstat (limited to 'src/main/java')
4 files changed, 83 insertions, 12 deletions
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<EntityArmorStand>()) { + if (stand.hasSkullTexture(odonataSkullTexture)) { + RenderLivingEntityHelper.setEntityColor( + stand, + config.highlightColor.toChromaColor().withAlpha(1) + ) { isEnabled() && hasBottleInHand } + } + } + } + + fun isEnabled() = RiftAPI.inRift() && config.highlight +} |