Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Render nametags after kami hud to prevent kotlin-graphics/imgui#114
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroeightysix committed Aug 22, 2020
1 parent 9527a98 commit b7ce73f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/kotlin/me/zeroeightsix/kami/feature/module/Nametags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ object Nametags : Module() {
val viewport = VectorMath.getViewport()
renderQueue = mc.world?.entities?.mapNotNull {
val interpolated = it.interpolatedPos
val p = VectorMath.divideVec2f(
VectorMath.divideVec2f(
VectorMath.project3Dto2D(
camera.pos.negate().add(interpolated.add(0.0, it.getEyeHeight(it.pose).toDouble() + 1, 0.0)),
viewport,
event.matrixStack.peek().model,
event.projection
), scale
)?.let {
Vec2f(it.x, mc.window.scaledHeight - it.y)
}
p?.let { p ->
it to p
)?.let { p ->
it to Vec2f(p.x, mc.window.scaledHeight - p.y)
}
}
})
Expand All @@ -55,6 +52,9 @@ object Nametags : Module() {
mc.textRenderer.draw(it.matrixStack, text, pos.x - width / 2, pos.y, 0xFFFFFF)
renderQueue = null
}
})
}, -10) // Priority to make sure this happens AFTER the kami HUD renderer.
// Doing it before causes https://github.com/kotlin-graphics/imgui/issues/114
// Looks like rendering text at specific times, just before imgui decides to initialise everything,
// causes its textures to screw up.

}

0 comments on commit b7ce73f

Please sign in to comment.