summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/dungeon
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-15 22:49:58 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-15 22:49:58 +0200
commit01d4aef89b7fdad58a320cf1eb4e478ac12aaba4 (patch)
tree3b933dd02f0f976760c0adba9342ea727bcda61a /src/main/java/at/hannibal2/skyhanni/features/dungeon
parentf02297bfffcdaaef5da4e04725b0658c00889cb7 (diff)
downloadskyhanni-01d4aef89b7fdad58a320cf1eb4e478ac12aaba4.tar.gz
skyhanni-01d4aef89b7fdad58a320cf1eb4e478ac12aaba4.tar.bz2
skyhanni-01d4aef89b7fdad58a320cf1eb4e478ac12aaba4.zip
added and used events for particle and sound
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt11
2 files changed, 5 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
index 7222d080d..a78f4a64c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
@@ -8,7 +8,6 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.monster.EntityGuardian
-import net.minecraft.network.play.server.S2APacketParticles
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -106,10 +105,8 @@ class DungeonCleanEnd {
}
@SubscribeEvent
- fun onReceivePacket(event: PacketEvent.ReceiveEvent) {
- if (!shouldBlock()) return
-
- if (event.packet is S2APacketParticles) {
+ fun onReceivePacket(event: PlayParticleEvent) {
+ if (shouldBlock()) {
event.isCanceled = true
}
}
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 acc0de8a0..2f36f01e5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
@@ -8,10 +8,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
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
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -133,22 +131,19 @@ class DungeonHideItems {
}
@SubscribeEvent
- fun onReceivePacket(event: PacketEvent.ReceiveEvent) {
+ fun onReceivePacket(event: PlayParticleEvent) {
if (!LorenzUtils.inDungeons) return
if (!SkyHanniMod.feature.dungeon.hideSuperboomTNT && !SkyHanniMod.feature.dungeon.hideReviveStone) return
- val packet = event.packet
- if (packet is S2APacketParticles) {
- val packetLocation = packet.toLorenzVec()
+ val packetLocation = event.location
for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) {
val distance = packetLocation.distance(armorStand.getLorenzVec())
if (distance < 2) {
//only hiding white "sparkling" particles
- if (packet.particleType.particleID == 3) {
+ if (event.type.particleID == 3) {
event.isCanceled = true
}
}
- }
}
}