From 163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Wed, 7 Sep 2022 11:42:48 +0200 Subject: Hiding the flame particles when using the Fire Veil Wand ability. --- .../hannibal2/skyhanni/data/EntityMovementData.kt | 47 ++++++++++++++++++++++ .../skyhanni/data/EntityMovementHelper.kt | 47 ---------------------- .../at/hannibal2/skyhanni/data/ItemClickData.kt | 32 +++++++++++++++ 3 files changed, 79 insertions(+), 47 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt new file mode 100644 index 000000000..1e07a6eaa --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -0,0 +1,47 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.EntityMoveEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.Entity +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class EntityMovementData { + + companion object { + private val entityLocation = mutableMapOf() + + fun addToTrack(entity: Entity) { + if (entity !in entityLocation) { + entityLocation[entity] = entity.getLorenzVec() + } + } + } + + var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!LorenzUtils.inSkyblock) return + + for (entity in entityLocation.keys) { + if (entity.isDead) continue + + val newLocation = entity.getLorenzVec() + val oldLocation = entityLocation[entity]!! + val distance = newLocation.distance(oldLocation) + if (distance > 0.01) { + entityLocation[entity] = newLocation + EntityMoveEvent(entity).postAndCatch() + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + entityLocation.clear() + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt deleted file mode 100644 index 908aae388..000000000 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt +++ /dev/null @@ -1,47 +0,0 @@ -package at.hannibal2.skyhanni.data - -import at.hannibal2.skyhanni.events.EntityMoveEvent -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.entity.Entity -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class EntityMovementHelper { - - companion object { - private val entityLocation = mutableMapOf() - - fun addToTrack(entity: Entity) { - if (entity !in entityLocation) { - entityLocation[entity] = entity.getLorenzVec() - } - } - } - - var tick = 0 - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!LorenzUtils.inSkyblock) return - - for (entity in entityLocation.keys) { - if (entity.isDead) continue - - val newLocation = entity.getLorenzVec() - val oldLocation = entityLocation[entity]!! - val distance = newLocation.distance(oldLocation) - if (distance > 0.01) { - entityLocation[entity] = newLocation - EntityMoveEvent(entity).postAndCatch() - } - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - entityLocation.clear() - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt new file mode 100644 index 000000000..e359c619e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -0,0 +1,32 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.ItemClickInHandEvent +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.InputEvent +import org.lwjgl.input.Mouse + +class ItemClickData { + + @SubscribeEvent + fun onClick(event: InputEvent.MouseInputEvent) { + if (!Mouse.getEventButtonState()) return + + val clickType = when (Mouse.getEventButton()) { + 0 -> { + ItemClickInHandEvent.ClickType.LEFT_CLICK + } + + 1 -> { + ItemClickInHandEvent.ClickType.RIGHT_CLICK + } + + else -> { + return + } + } + + val itemStack = Minecraft.getMinecraft().thePlayer.heldItem + ItemClickInHandEvent(clickType, itemStack).postAndCatch() + } +} \ No newline at end of file -- cgit