aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt')
-rw-r--r--src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
new file mode 100644
index 0000000..706bcea
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
@@ -0,0 +1,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 = ""
+ }
+} \ No newline at end of file