aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt
blob: 21630e7c36f24d3a2e813cda2cc6d7458d2cd9ce (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package dulkirmod.features

import dulkirmod.config.DulkirConfig
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.Utils
import dulkirmod.utils.WorldRenderUtils
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.client.event.RenderLivingEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color

object BlazeSlayerFeatures {

    private val minibosses = "(Flare Demon)|(Kindleheart Demon)|(Burningsoul Demon)".toRegex()

    @SubscribeEvent
    fun onRenderLiving(event: RenderLivingEvent.Post<*>) {
        if (!(DulkirConfig.attunementDisplay || DulkirConfig.minibossHitbox)) return
        if (TabListUtils.area != "Crimson Isle") return

        if (DulkirConfig.attunementDisplay) {
            if (event.entity is EntityArmorStand && event.entity.hasCustomName()) {
                val name = Utils.stripColorCodes(event.entity.customNameTag)
                val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
                val x = newPos[0]
                val y = newPos[1]
                val z = newPos[2]
                when {
                    name.contains("CRYSTAL ♨") -> {
                        WorldRenderUtils.drawCustomBox(
                            x - .5,
                            1.0,
                            y - 2,
                            1.5,
                            z - .5,
                            1.0,
                            Color(15, 247, 236, 255),
                            3f,
                            phase = false
                        )
                    }

                    name.contains("ASHEN ♨") -> {
                        WorldRenderUtils.drawCustomBox(
                            x - .5,
                            1.0,
                            y - 2,
                            1.5,
                            z - .5,
                            1.0,
                            Color(0, 0, 0, 255),
                            3f,
                            phase = false
                        )
                    }

                    name.contains("AURIC ♨") -> {
                        WorldRenderUtils.drawCustomBox(
                            x - .5,
                            1.0,
                            y - 2,
                            1.5,
                            z - .5,
                            1.0,
                            Color(206, 219, 57, 255),
                            3f,
                            phase = false
                        )
                    }

                    name.contains("SPIRIT ♨") -> {
                        WorldRenderUtils.drawCustomBox(
                            x - .5,
                            1.0,
                            y - 2,
                            1.5,
                            z - .5,
                            1.0,
                            Color(255, 255, 255, 255),
                            3f,
                            phase = false
                        )
                    }
                }
            }
        }

        if (DulkirConfig.minibossHitbox) {
            if (event.entity is EntityArmorStand && event.entity.hasCustomName()) {
                val name = Utils.stripColorCodes(event.entity.customNameTag)

                val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
                val x = newPos[0]
                val y = newPos[1]
                val z = newPos[2]

                if (name.contains(minibosses)) {
                    WorldRenderUtils.drawCustomBox(
                        x - .5,
                        1.0,
                        y - 1.5,
                        1.5,
                        z - .5,
                        1.0,
                        Color(7, 227, 21, 255),
                        3f,
                        phase = false
                    )
                }
            }
        }
    }
}