aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorBrandon <brandon.wamboldt@gmail.com>2023-09-09 08:00:58 -0300
committerGitHub <noreply@github.com>2023-09-09 13:00:58 +0200
commit09de6da456996cbf35668cc06a58d322e9fbc280 (patch)
tree379e87a91df37a04ef438f09065843542a10f9a6 /src/main/java/at/hannibal2/skyhanni/features
parent83952890dae702fa2ae50cc7c86c05a0982bbaba (diff)
downloadskyhanni-09de6da456996cbf35668cc06a58d322e9fbc280.tar.gz
skyhanni-09de6da456996cbf35668cc06a58d322e9fbc280.tar.bz2
skyhanni-09de6da456996cbf35668cc06a58d322e9fbc280.zip
Add feature to outline dungeon teammates (#455)
Add outline dungeon teammates #455
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt39
1 files changed, 39 insertions, 0 deletions
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