blob: 81477957e4cd4f7e41453dc7a4f1d40e258cc53a (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package at.hannibal2.skyhanni.features.itemabilities
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.itemability.FireVeilWandConfig.DisplayEntry
import at.hannibal2.skyhanni.data.ClickType
import at.hannibal2.skyhanni.events.ItemClickEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangFreezeCooldown
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import net.minecraft.client.Minecraft
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
@SkyHanniModule
object FireVeilWandParticles {
private val config get() = SkyHanniMod.feature.inventory.itemAbilities.fireVeilWands
private val item by lazy { "FIRE_VEIL_WAND".asInternalName() }
private var lastClick = SimpleTimeMark.farPast()
@SubscribeEvent
fun onReceiveParticle(event: ReceiveParticleEvent) {
if (!LorenzUtils.inSkyBlock) return
if (config.display == DisplayEntry.PARTICLES) return
if (lastClick.passedSince() > 5.5.seconds) return
if (event.type == EnumParticleTypes.FLAME && event.speed == 0.55f) {
event.cancel()
}
}
@SubscribeEvent
fun onItemClick(event: ItemClickEvent) {
if (!LorenzUtils.inSkyBlock) return
if (event.clickType != ClickType.RIGHT_CLICK) return
val internalName = event.itemInHand?.getInternalName()
if (AshfangFreezeCooldown.isCurrentlyFrozen()) return
if (internalName == item) {
lastClick = SimpleTimeMark.now()
}
}
@SubscribeEvent
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!LorenzUtils.inSkyBlock) return
if (config.display != DisplayEntry.LINE) return
if (lastClick.passedSince() > 5.5.seconds) return
val color = config.displayColor.toChromaColor()
RenderUtils.drawCircle(Minecraft.getMinecraft().thePlayer, event.partialTicks, 3.5, color)
}
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(3, "itemAbilities.fireVeilWandDisplayColor", "itemAbilities.fireVeilWands.displayColor")
event.move(3, "itemAbilities.fireVeilWandDisplay", "itemAbilities.fireVeilWands.display")
event.transform(15, "itemAbilities.fireVeilWands.display") { element ->
ConfigUtils.migrateIntToEnum(element, DisplayEntry::class.java)
}
}
}
|