aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt17
2 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
index 0219634b4..f4621877a 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
@@ -31,7 +31,7 @@ class ItemClickData {
if (packet is C07PacketPlayerDigging && packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) {
val position = packet.position.toLorenzVec()
BlockClickEvent(ClickType.LEFT_CLICK, position, InventoryUtils.getItemInHand()).postAndCatch()
- ItemClickEvent(InventoryUtils.getItemInHand(), ClickType.RIGHT_CLICK).postAndCatch()
+ ItemClickEvent(InventoryUtils.getItemInHand(), ClickType.LEFT_CLICK).postAndCatch()
}
if (packet is C0APacketAnimation) {
ItemClickEvent(InventoryUtils.getItemInHand(), ClickType.LEFT_CLICK).postAndCatch()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
index 2bbf80502..3841df899 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
@@ -13,22 +13,23 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
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
class FireVeilWandParticles {
private val config get() = SkyHanniMod.feature.itemAbilities.fireVeilWands
+ private val item by lazy { "FIRE_VEIL_WAND".asInternalName() }
- private var lastClick = 0L
-
- val item by lazy { "FIRE_VEIL_WAND".asInternalName() }
+ private var lastClick = SimpleTimeMark.farPast()
@SubscribeEvent
fun onChatPacket(event: ReceiveParticleEvent) {
if (!LorenzUtils.inSkyBlock) return
if (config.display == DisplayEntry.PARTICLES) return
- if (System.currentTimeMillis() > lastClick + 5_500) return
+ if (lastClick.passedSince() > 5.5.seconds) return
if (event.type == EnumParticleTypes.FLAME && event.speed == 0.55f) {
event.isCanceled = true
}
@@ -38,11 +39,10 @@ class FireVeilWandParticles {
fun onItemClick(event: ItemClickEvent) {
if (!LorenzUtils.inSkyBlock) return
if (event.clickType != ClickType.RIGHT_CLICK) return
-
- val internalName = event.itemInHand?.getInternalName() ?: return
+ val internalName = event.itemInHand?.getInternalName()
if (internalName == item) {
- lastClick = System.currentTimeMillis()
+ lastClick = SimpleTimeMark.now()
}
}
@@ -50,10 +50,9 @@ class FireVeilWandParticles {
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!LorenzUtils.inSkyBlock) return
if (config.display != DisplayEntry.LINE) return
- if (System.currentTimeMillis() > lastClick + 5_500) return
+ if (lastClick.passedSince() > 5.5.seconds) return
val color = config.displayColor.toChromaColor()
-
RenderUtils.drawCircle(Minecraft.getMinecraft().thePlayer, event.partialTicks, 3.5, color)
}