aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/DungeonLeap.kt
blob: 54a304ce071a6bda83823e7395b3d56896d84464 (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
import dulkirmod.config.Config
import dulkirmod.utils.Utils
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
import net.minecraft.inventory.Slot

class DungeonLeap {
    companion object {
        fun inLeapMenu(): Boolean {
            if (DulkirMod.mc.currentScreen == null || !(DulkirMod.mc.currentScreen is GuiChest)) return false
            val chest = DulkirMod.mc.currentScreen as GuiChest
            val container = chest.inventorySlots as ContainerChest
            Croesus.currentlyOpenChestName = container.lowerChestInventory.displayName.unformattedText
            if (Croesus.currentlyOpenChestName == "Spirit Leap") return true
            return false
        }

        fun isHighlightedLeapPlayer(slotIn: Slot): Boolean {
            if (slotIn.stack?.getTooltip(DulkirMod.mc.thePlayer, false) == null) return false

            val tooltip = slotIn.stack.getTooltip(DulkirMod.mc.thePlayer, false)
            for (s in tooltip) {
                var t = Utils.stripColorCodes(s)
                if (t == Config.highlightLeapName) return true
            }
            return false
        }
    }
}