aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
blob: d0676754fb8131e91d713931e4f148848e111ed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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

object ContainerNameUtil {
    var currentGuiChestName = ""

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