diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-09-07 14:20:05 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-09-07 14:20:05 +0200 |
commit | 5fd3bcd10cd41f016acb4658bc441fb21bf14e85 (patch) | |
tree | 29e2b5c092a5b4d4db569522779088e20b7235bc /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 12899c2863ae42ef7bd912c8639ce5c1ed3e95c1 (diff) | |
download | skyhanni-5fd3bcd10cd41f016acb4658bc441fb21bf14e85.tar.gz skyhanni-5fd3bcd10cd41f016acb4658bc441fb21bf14e85.tar.bz2 skyhanni-5fd3bcd10cd41f016acb4658bc441fb21bf14e85.zip |
Changed the ashfang gravity orb highlight from square to cylinder
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 0be20057f..58de5dcff 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -447,6 +447,19 @@ object RenderUtils { // totally not modified Autumn Client's TargetStrafe fun drawCircle(entity: Entity, partialTicks: Float, rad: Double, color: Color) { + GlStateManager.pushMatrix() + GL11.glNormal3f(0.0f, 1.0f, 0.0f) + + GlStateManager.enableDepth() + GlStateManager.enableBlend() + GlStateManager.depthFunc(GL11.GL_LEQUAL) + GlStateManager.disableCull() + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.enableAlpha() + GlStateManager.disableTexture2D() + + GlStateManager.disableDepth() + var il = 0.0 val tessellator = Tessellator.getInstance() val worldRenderer = tessellator.worldRenderer @@ -472,6 +485,64 @@ object RenderUtils { GlStateManager.popMatrix() il += 0.0006 } + + GlStateManager.enableDepth() + + GlStateManager.enableCull() + GlStateManager.enableTexture2D() + GlStateManager.enableDepth() + GlStateManager.disableBlend() + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) + GlStateManager.popMatrix() + } + fun drawCylinderInWorld(color: Color,x: Double, y: Double, z: Double, radius: Float, height: Float, partialTicks: Float) { + GlStateManager.pushMatrix() + GL11.glNormal3f(0.0f, 1.0f, 0.0f) + + GlStateManager.enableDepth() + GlStateManager.enableBlend() + GlStateManager.depthFunc(GL11.GL_LEQUAL) + GlStateManager.disableCull() + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.enableAlpha() + GlStateManager.disableTexture2D() + color.bindColor() + + var x1 = x + var y1 = y + var z1 = z + val renderViewEntity = Minecraft.getMinecraft().renderViewEntity + val viewX = + renderViewEntity.prevPosX + (renderViewEntity.posX - renderViewEntity.prevPosX) * partialTicks.toDouble() + val viewY = + renderViewEntity.prevPosY + (renderViewEntity.posY - renderViewEntity.prevPosY) * partialTicks.toDouble() + val viewZ = + renderViewEntity.prevPosZ + (renderViewEntity.posZ - renderViewEntity.prevPosZ) * partialTicks.toDouble() + x1 -= viewX + y1 -= viewY + z1 -= viewZ + val tessellator = Tessellator.getInstance() + val worldrenderer = tessellator.worldRenderer + worldrenderer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION) + var currentAngle = 0f + val angleStep = 0.1f + while (currentAngle < 2 * Math.PI) { + val xOffset = radius * cos(currentAngle.toDouble()).toFloat() + val zOffset = radius * sin(currentAngle.toDouble()).toFloat() + worldrenderer.pos(x1 + xOffset, y1 + height, z1 + zOffset).endVertex() + worldrenderer.pos(x1 + xOffset, y1 + 0, z1 + zOffset).endVertex() + currentAngle += angleStep + } + worldrenderer.pos(x1 + radius, y1 + height, z1).endVertex() + worldrenderer.pos(x1 + radius, y1 + 0.0, z1).endVertex() + tessellator.draw() + + GlStateManager.enableCull() + GlStateManager.enableTexture2D() + GlStateManager.enableDepth() + GlStateManager.disableBlend() + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) + GlStateManager.popMatrix() } private fun Color.bindColor() = GlStateManager.color(this.red / 255f, this.green / 255f, this.blue / 255f, this.alpha / 255f) |