1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.util.AxisAlignedBB
import java.awt.Color
object GriffinUtils {
fun LorenzRenderWorldEvent.drawWaypointFilled(
location: LorenzVec,
color: Color,
seeThroughBlocks: Boolean = false,
beacon: Boolean = false,
extraSize: Double = 0.0,
extraSizeTopY: Double = extraSize,
extraSizeBottomY: Double = extraSize,
minimumAlpha: Float = 0.2f,
inverseAlphaScale: Boolean = false,
) {
val (viewerX, viewerY, viewerZ) = RenderUtils.getViewerPos(partialTicks)
val x = location.x - viewerX
val y = location.y - viewerY
val z = location.z - viewerZ
val distSq = x * x + y * y + z * z
if (seeThroughBlocks) {
GlStateManager.disableDepth()
}
GlStateManager.disableCull()
RenderUtils.drawFilledBoundingBox(
@Suppress("ktlint:standard:argument-list-wrapping")
AxisAlignedBB(
x - extraSize, y - extraSizeBottomY, z - extraSize,
x + 1 + extraSize, y + 1 + extraSizeTopY, z + 1 + extraSize,
).expandBlock(),
color,
if (inverseAlphaScale) (1.0f - 0.005f * distSq.toFloat()).coerceAtLeast(minimumAlpha)
else (0.1f + 0.005f * distSq.toFloat()).coerceAtLeast(minimumAlpha),
)
GlStateManager.disableTexture2D()
if (distSq > 5 * 5 && beacon) RenderUtils.renderBeaconBeam(x, y + 1, z, color.rgb, 1.0f, partialTicks)
GlStateManager.disableLighting()
GlStateManager.enableTexture2D()
GlStateManager.enableCull()
if (seeThroughBlocks) {
GlStateManager.enableDepth()
}
}
}
|