aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
blob: 706bceafc2f40f12e733b9e3ebdac0b51f960a51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package dulkirmod.utils

import dulkirmod.DulkirMod.Companion.mc
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent

class ContainerNameUtil {
    @SubscribeEvent
    fun onTick(event: TickEvent.ClientTickEvent) {
        if (mc.currentScreen !is GuiChest) return
        val chest = mc.currentScreen as GuiChest
        val container = chest.inventorySlots as ContainerChest
        currentGuiChestName = container.lowerChestInventory.displayName.unformattedText
    }

    companion object {
        var currentGuiChestName = ""
    }
}