aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt39
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt1
4 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 719414e69..bc391ff91 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -398,6 +398,7 @@ class SkyHanniMod {
loadModule(SuperpairsClicksAlert())
loadModule(PowderTracker())
loadModule(GlowingDroppedItems())
+ loadModule(DungeonTeammateOutlines())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java
index b0677f462..cc0eb080d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java
@@ -65,6 +65,13 @@ public class DungeonConfig {
@FeatureToggle
public boolean highlightDeathmites = true;
+ @Expose
+ @ConfigOption(name = "Highlight Teammates", desc = "Highlight teammates with a glowing outline")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean highlightTeammates = true;
+
+
@ConfigOption(name = "Object Hider", desc = "Hide various things in dungeons.")
@ConfigEditorAccordion(id = 3)
public boolean objectHider = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt
new file mode 100644
index 000000000..de2ca07e2
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt
@@ -0,0 +1,39 @@
+package at.hannibal2.skyhanni.features.dungeon
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.entity.EntityOtherPlayerMP
+import net.minecraft.client.gui.FontRenderer
+import net.minecraft.entity.Entity
+import net.minecraft.scoreboard.ScorePlayerTeam
+import net.minecraft.scoreboard.Team
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class DungeonTeammateOutlines {
+ private val config get() = SkyHanniMod.feature.dungeon
+
+ @SubscribeEvent
+ fun onRenderEntityOutlines(event: RenderEntityOutlineEvent) {
+ if (isEnabled() && event.type === RenderEntityOutlineEvent.Type.XRAY) {
+ event.queueEntitiesToOutline { entity -> getEntityOutlineColor(entity) }
+ }
+ }
+
+ private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.inDungeons && config.highlightTeammates
+
+ private fun getEntityOutlineColor(entity: Entity): Int? {
+ if (entity !is EntityOtherPlayerMP || entity.team == null) return null
+
+ // Must be visible on the scoreboard
+ val team = entity.team as ScorePlayerTeam
+ if (team.nameTagVisibility == Team.EnumVisible.NEVER) return null
+
+ val colorFormat = FontRenderer.getFormatFromString(team.colorPrefix)
+ return if (colorFormat.length >= 2)
+ Minecraft.getMinecraft().fontRendererObj.getColorCode(colorFormat[1]);
+ else null
+ }
+
+} \ 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 fb120a945..6ce9e4b38 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
@@ -273,6 +273,7 @@ object EntityOutlineRenderer {
if (isMissingMixin) return false
if (SkyHanniMod.feature.fishing.rareSeaCreatureHighlight) return true
if (SkyHanniMod.feature.misc.glowingDroppedItems.enabled) return true
+ if (SkyHanniMod.feature.dungeon.highlightTeammates) return true
return false
}