diff options
Diffstat (limited to 'src')
5 files changed, 79 insertions, 8 deletions
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<EntityArmorStand>()) { + 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 |