aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
diff options
context:
space:
mode:
authorIlmarsXd <ilmars500@gmail.com>2023-03-21 17:37:12 +0200
committerIlmarsXd <ilmars500@gmail.com>2023-03-21 17:37:12 +0200
commit623f260e2f1d586336fca13dc86bf2ffb0c6565c (patch)
treed54f367541619b80ae1863f5acb3d9f09de7bada /src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
parente7723d5ff52da94eb65992b5bdd9c5bb316d5959 (diff)
downloadDulkirMod-623f260e2f1d586336fca13dc86bf2ffb0c6565c.tar.gz
DulkirMod-623f260e2f1d586336fca13dc86bf2ffb0c6565c.tar.bz2
DulkirMod-623f260e2f1d586336fca13dc86bf2ffb0c6565c.zip
refactor modules
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt')
-rw-r--r--src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
index 706bcea..d067675 100644
--- a/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
+++ b/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
@@ -6,16 +6,14 @@ 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
- }
+object ContainerNameUtil {
+ var currentGuiChestName = ""
- companion object {
- 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
+ }
} \ No newline at end of file