diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-23 13:16:57 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-23 13:16:57 +0200 |
commit | d060394ccd00fbe3a86481db939032e13ca458b2 (patch) | |
tree | 94f7e35ad3723d4a52c7e077caca4b61f05aa1f5 /src/main/java/at/hannibal2 | |
parent | 51616771a0ebb98b7b63703562ad334ac418d1a6 (diff) | |
download | skyhanni-d060394ccd00fbe3a86481db939032e13ca458b2.tar.gz skyhanni-d060394ccd00fbe3a86481db939032e13ca458b2.tar.bz2 skyhanni-d060394ccd00fbe3a86481db939032e13ca458b2.zip |
showing the name of ashfang gravity orbs tag above
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 21 insertions, 16 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt index 13900555e..1f0144620 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt @@ -2,9 +2,12 @@ package at.hannibal2.skyhanni.features import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.GriffinJavaUtils -import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawString +import at.hannibal2.skyhanni.utils.getLorenzVec +import at.hannibal2.skyhanni.utils.getNameTagWith import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLiving import net.minecraft.entity.item.EntityArmorStand @@ -94,12 +97,9 @@ class SummoningSoulsName { fun onWorldRender(event: RenderWorldLastEvent) { if (!isEnabled()) return - val playerLocation = LocationUtils.playerEyeLocation() for ((entity, name) in souls) { val vec = entity.getLorenzVec() - if (LocationUtils.canSee(playerLocation, vec.add(0.0, 2.0, 0.0))) { - event.drawString(vec.add(0.0, 2.5, 0.0), name, true) - } + event.drawString(vec.add(0.0, 2.5, 0.0), name) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt index 11a6f5f2a..ed1abeacb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.SpecialColour import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.client.Minecraft @@ -40,13 +41,15 @@ class AshfangGravityOrbs { val color = Color(SpecialColour.specialToChromaRGB(special), true) - val playerEyeLocation = LocationUtils.playerEyeLocation() + val playerLocation = LocationUtils.playerLocation() for (orb in orbs) { if (orb.isDead) continue val orbLocation = orb.getLorenzVec() - if (!LocationUtils.canSee(playerEyeLocation, orbLocation.add(0.0, 2.0, 0.0))) continue - event.drawWaypointFilled(orbLocation.add(-0.5, 1.25, -0.5), color) + if (orbLocation.distance(playerLocation) < 15) { + //TODO find way to dynamically change color + event.drawString(orbLocation.add(0.0, 2.5, 0.0), "§cGravity Orb") + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index d27391a6b..453b220e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -240,7 +240,12 @@ object RenderUtils { tessellator.draw() } - fun RenderWorldLastEvent.drawString(location: LorenzVec, text: String, seeThroughBlocks: Boolean = false, color: Color? = null) { + fun RenderWorldLastEvent.drawString( + location: LorenzVec, + text: String, + seeThroughBlocks: Boolean = false, + color: Color? = null, + ) { GlStateManager.alphaFunc(516, 0.1f) GlStateManager.pushMatrix() val viewer = Minecraft.getMinecraft().renderViewEntity @@ -263,11 +268,7 @@ object RenderUtils { GlStateManager.translate(x, y, z) GlStateManager.translate(0f, viewer.eyeHeight, 0f) - val c = color - if (c != null) { - GlStateManager.color(c.red.toFloat(), c.green.toFloat(), c.blue.toFloat()) - } - drawNametag(text) + drawNametag(text, color) GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f) GlStateManager.rotate(renderManager.playerViewX, 1.0f, 0.0f, 0.0f) GlStateManager.translate(0f, -0.25f, 0f) @@ -287,7 +288,7 @@ object RenderUtils { /** * @author Mojang */ - fun drawNametag(str: String?) { + fun drawNametag(str: String, color: Color?) { val fontRenderer = Minecraft.getMinecraft().fontRendererObj val f1 = 0.02666667f GlStateManager.pushMatrix() @@ -316,7 +317,8 @@ object RenderUtils { worldrenderer.pos((j + 1).toDouble(), (-1 + i).toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() tessellator.draw() GlStateManager.enableTexture2D() - fontRenderer.drawString(str, -j, i, 553648127) + val colorCode = color?.rgb ?: 553648127 + fontRenderer.drawString(str, -j, i, colorCode) GlStateManager.depthMask(true) fontRenderer.drawString(str, -j, i, -1) GlStateManager.enableBlend() |