aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/rift/SteakDisplay.kt
blob: 2489bba7ee8736a3c5094533546e2bf5c321d16b (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
package dulkirmod.features.rift

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 SteakDisplay {
    private const val char = "҉"

    @SubscribeEvent
    fun onRenderLiving(event: RenderLivingEvent.Post<*>) {
        if (!DulkirConfig.steakDisplay) return
        if (TabListUtils.area != "The Rift") return

        if (event.entity is EntityArmorStand && event.entity.hasCustomName()) {
            val name = Utils.stripColorCodes(event.entity.customNameTag)
            val x =
                event.entity.lastTickPosX + (event.entity.posX - event.entity.lastTickPosX) * WorldRenderUtils.partialTicks
            val y =
                event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * WorldRenderUtils.partialTicks
            val z =
                event.entity.lastTickPosZ + (event.entity.posZ - event.entity.lastTickPosZ) * WorldRenderUtils.partialTicks
            if (name.contains(char)) {
                WorldRenderUtils.drawCustomBox(
                    x - .5,
                    1.0,
                    y - 2,
                    1.5,
                    z - .5,
                    1.0,
                    Color(15, 247, 236, 255),
                    3f,
                    phase = false
                )
            }
        }
    }
}