aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
diff options
context:
space:
mode:
authoringlettronald <71849533+inglettronald@users.noreply.github.com>2023-03-21 18:08:57 -0500
committerGitHub <noreply@github.com>2023-03-21 18:08:57 -0500
commit2cb6f4cffee0ab505b35938cf71518e4640a229a (patch)
tree02224acacc7e7823079a8e2cc24377eafe33700c /src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt
parent05c6b155f1de3a96ef081627ff7805238742162f (diff)
parent3968c49ccfb1fb3b0c6a8274f4d45ed0ba50ec48 (diff)
downloadDulkirMod-2cb6f4cffee0ab505b35938cf71518e4640a229a.tar.gz
DulkirMod-2cb6f4cffee0ab505b35938cf71518e4640a229a.tar.bz2
DulkirMod-2cb6f4cffee0ab505b35938cf71518e4640a229a.zip
Merge pull request #11 from IlmarsXd/master
refactor modules (class -> object), add memory leak fix
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