aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-07 11:42:48 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-07 11:42:48 +0200
commit163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2 (patch)
tree27a128342125bade370c1fdf8b5ef0166d86a881 /src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt
parent2d0f63b156f936e9f056537a67eaa13bffa54c27 (diff)
downloadskyhanni-163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2.tar.gz
skyhanni-163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2.tar.bz2
skyhanni-163cc857b0b1e6f52d56e663b8cb1c55f5e1bff2.zip
Hiding the flame particles when using the Fire Veil Wand ability.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt47
1 files changed, 47 insertions, 0 deletions
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<Entity, LorenzVec>()
+
+ 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