summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
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/features
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/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt50
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt8
3 files changed, 55 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt
new file mode 100644
index 000000000..1205c202b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt
@@ -0,0 +1,50 @@
+package at.hannibal2.skyhanni.features
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.ItemClickInHandEvent
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.network.play.server.S2APacketParticles
+import net.minecraft.util.EnumParticleTypes
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class FireVeilWandParticles {
+
+ var lastClick = 0L
+
+ @SubscribeEvent
+ fun onChatPacket(event: PacketEvent.ReceiveEvent) {
+ if (!isEnabled()) return
+
+ val packet = event.packet
+ if (packet !is S2APacketParticles) return
+
+ if (System.currentTimeMillis() > lastClick + 5_500) return
+
+ if (packet.particleType == EnumParticleTypes.FLAME && packet.particleCount == 1 && packet.particleSpeed == 0f &&
+ packet.xOffset == 0f &&
+ packet.yOffset == 0f &&
+ packet.zOffset == 0f
+ ) {
+ event.isCanceled = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onItemClick(event: ItemClickInHandEvent) {
+ if (!isEnabled()) return
+ if (event.clickType != ItemClickInHandEvent.ClickType.RIGHT_CLICK) return
+
+ val itemInHand = event.itemInHand ?: return
+
+ val internalName = itemInHand.getInternalName()
+ if (internalName == "FIRE_VEIL_WAND") {
+ lastClick = System.currentTimeMillis()
+ }
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.fireVeilWandHider
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt
index d98f46100..524a94259 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt
@@ -71,10 +71,7 @@ class GriffinBurrowFinder {
fun onChatPacket(event: PacketEvent.ReceiveEvent) {
val packet = event.packet
if (packet is S2APacketParticles) {
- val x = packet.xCoordinate
- val y = packet.yCoordinate
- val z = packet.zCoordinate
- val distance = LorenzVec(x, y, z).distance(LocationUtils.playerLocation())
+ val distance = packet.toLorenzVec().distance(LocationUtils.playerLocation())
if (distance < 20) {
// LorenzDebug.log("")
// LorenzDebug.log("S2APacketParticles close")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
index faf48e95c..acc0de8a0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
@@ -1,14 +1,14 @@
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.data.EntityMovementHelper
+import at.hannibal2.skyhanni.data.EntityMovementData
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.getLorenzVec
+import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.item.EntityItem
import net.minecraft.network.play.server.S2APacketParticles
@@ -121,7 +121,7 @@ class DungeonHideItems {
}
if (isSkeletonSkull(entity)) {
- EntityMovementHelper.addToTrack(entity)
+ EntityMovementData.addToTrack(entity)
if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) {
val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0)
if (lastMove + 100 > System.currentTimeMillis()) {
@@ -139,7 +139,7 @@ class DungeonHideItems {
val packet = event.packet
if (packet is S2APacketParticles) {
- val packetLocation = LorenzVec(packet.xCoordinate, packet.yCoordinate, packet.zCoordinate)
+ val packetLocation = packet.toLorenzVec()
for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) {
val distance = packetLocation.distance(armorStand.getLorenzVec())
if (distance < 2) {