aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-18 17:59:48 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-18 17:59:48 +0100
commit3d3f1f8cc911d02cfdc89074a8b49866f1db5085 (patch)
tree2ad18c0cbcefc3189239e9dfc5a479f146d88ac6
parent0ea3a11fcb7a76fdfc539d049e3e323306500d60 (diff)
downloadskyhanni-3d3f1f8cc911d02cfdc89074a8b49866f1db5085.tar.gz
skyhanni-3d3f1f8cc911d02cfdc89074a8b49866f1db5085.tar.bz2
skyhanni-3d3f1f8cc911d02cfdc89074a8b49866f1db5085.zip
Fixed Fire Veil Wand circle shows on left clicking.
-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)
}