aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/Croesus.kt
blob: 0ddfe9e0e9aaa944670c1e79e63222017fc32963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package dulkirmod.features

import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.Config
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
import net.minecraft.inventory.Slot

class Croesus {
    companion object {
        var currentlyOpenChestName = ""

        fun inCroesus(): Boolean {
            if (mc.currentScreen == null || !(mc.currentScreen is GuiChest)) return false
            val chest = mc.currentScreen as GuiChest
            val container = chest.inventorySlots as ContainerChest
            currentlyOpenChestName = container.lowerChestInventory.displayName.unformattedText
            if (currentlyOpenChestName == "Croesus") return true
            return false
        }

        fun isChestOpened(slotIn: Slot): Boolean {
            if (!Config.hideOpenedChests) return false
            if (slotIn.stack?.getTooltip(mc.thePlayer, false) == null) return false

            var tooltip = slotIn.stack.getTooltip(mc.thePlayer, false)
            if (tooltip.contains("§5§o§aChests have been opened!")) return true

            return false
        }
    }
}