aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt18
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()