blob: 7501f8d70c38df7673f6a4e7cee84cebe71b9404 (
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
|
package at.hannibal2.skyhanni.features.itemabilities
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.ClickType
import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
import at.hannibal2.skyhanni.utils.RenderUtils
import net.minecraft.client.Minecraft
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class FireVeilWandParticles {
private val config get() = SkyHanniMod.feature.itemAbilities.fireVeilWands
var lastClick = 0L
@SubscribeEvent
fun onChatPacket(event: ReceiveParticleEvent) {
if (!LorenzUtils.inSkyBlock) return
if (config.display == 0) return
if (System.currentTimeMillis() > lastClick + 5_500) return
if (event.type == EnumParticleTypes.FLAME && event.count == 1 && event.speed == 0f && event.offset.isZero()) {
event.isCanceled = true
}
}
@SubscribeEvent
fun onBlockClick(event: BlockClickEvent) {
if (!LorenzUtils.inSkyBlock) return
if (event.clickType == ClickType.RIGHT_CLICK) {
val internalName = event.itemInHand?.getInternalName_old() ?: return
if (internalName == "FIRE_VEIL_WAND") {
lastClick = System.currentTimeMillis()
}
}
}
@SubscribeEvent
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!LorenzUtils.inSkyBlock) return
if (config.display != 1) return
if (System.currentTimeMillis() > lastClick + 5_500) 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")
}
}
|