From c896c6872d5ccb2b0d28eb666f944c4c63f107a7 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 11 Oct 2023 05:57:05 -0300 Subject: Feature: Highlight party members (#463) Added Highlight Party Members. #463 --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ .../skyhanni/config/features/MiscConfig.java | 25 +++++++++++++++++++ .../skyhanni/features/misc/PartyMemberOutlines.kt | 29 ++++++++++++++++++++++ .../skyhanni/utils/EntityOutlineRenderer.kt | 1 + 4 files changed, 57 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 7a0b79cbe..c7bb40f39 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -183,6 +183,7 @@ import at.hannibal2.skyhanni.features.misc.MiscFeatures import at.hannibal2.skyhanni.features.misc.MovementSpeedDisplay import at.hannibal2.skyhanni.features.misc.NonGodPotEffectDisplay import at.hannibal2.skyhanni.features.misc.ParticleHider +import at.hannibal2.skyhanni.features.misc.PartyMemberOutlines import at.hannibal2.skyhanni.features.misc.PasteIntoSigns import at.hannibal2.skyhanni.features.misc.PatcherSendCoordinates import at.hannibal2.skyhanni.features.misc.PetCandyUsedDisplay @@ -587,6 +588,7 @@ class SkyHanniMod { loadModule(QuickCraftFeatures()) loadModule(SkyBlockKickDuration()) loadModule(LimboTimeTracker()) + loadModule(PartyMemberOutlines()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index e58648c4d..13c559f88 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -535,6 +535,31 @@ public class MiscConfig { } + + @Expose + @ConfigOption(name = "Highlight Party Members", desc = "") + @Accordion + public HighlightPartyMembers highlightPartyMembers = new HighlightPartyMembers(); + + public static class HighlightPartyMembers { + + @Expose + @ConfigOption(name = "Enabled", desc = "Draws a glowing outline around your party members") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigOption( + name = "Outline Color", + desc = "The color to outline party members in." + ) + @ConfigEditorColour + public String outlineColor = "0:245:85:255:85"; + + } + + @Expose @ConfigOption(name = "Compact Tab List", desc = "") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt new file mode 100644 index 000000000..c2ac7490b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt @@ -0,0 +1,29 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SpecialColour +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraft.entity.Entity +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class PartyMemberOutlines { + private val config get() = SkyHanniMod.feature.misc.highlightPartyMembers + + @SubscribeEvent + fun onRenderEntityOutlines(event: RenderEntityOutlineEvent) { + if (isEnabled() && event.type === RenderEntityOutlineEvent.Type.NO_XRAY) { + event.queueEntitiesToOutline { entity -> getEntityOutlineColor(entity) } + } + } + + private fun isEnabled() = LorenzUtils.inSkyBlock && !LorenzUtils.inDungeons && config.enabled + + private fun getEntityOutlineColor(entity: Entity): Int? { + if (entity !is EntityOtherPlayerMP || !PartyAPI.partyMembers.contains(entity.name)) return null + + return SpecialColour.specialToChromaRGB(config.outlineColor) + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt index d290d540b..30853c9ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt @@ -274,6 +274,7 @@ object EntityOutlineRenderer { if (SkyHanniMod.feature.fishing.rareSeaCreatureHighlight) return true if (SkyHanniMod.feature.misc.glowingDroppedItems.enabled) return true if (SkyHanniMod.feature.dungeon.highlightTeammates) return true + if (SkyHanniMod.feature.misc.highlightPartyMembers.enabled) return true return false } -- cgit