blob: 207e1b92b6a144ce824a8eeaeab404002ec4989f (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package at.hannibal2.skyhanni.features.itemabilities
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.extraAttributes
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderable
import at.hannibal2.skyhanni.utils.renderables.Renderable
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object CrownOfAvariceCounter {
private val config get() = SkyHanniMod.feature.inventory.itemAbilities.crownOfAvarice
private val internalName = "CROWN_OF_AVARICE".asInternalName()
private var render: Renderable? = null
@SubscribeEvent
fun onOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
render?.let { config.position.renderRenderable(it, posLabel = "Crown of Avarice Counter") }
}
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
render = check()
}
fun check(): Renderable? {
if (!LorenzUtils.inSkyBlock) return null
if (!config.enable) return null
val item = InventoryUtils.getHelmet()
if (item?.getInternalNameOrNull() != internalName) return null
val count = item.extraAttributes.getLong("collected_coins");
return Renderable.horizontalContainer(
listOf(
Renderable.itemStack(internalName.getItemStack()),
Renderable.string("§6" + if (config.shortFormat) count.shortFormat() else count.addSeparators()),
),
)
}
}
|