diff options
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt')
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/ContainerNameUtil.kt | 20 |
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 |