summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-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
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt30
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt16
5 files changed, 26 insertions, 53 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
}
}
- }
}
}
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 c2b9ced29..28d605946 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
@@ -2,13 +2,12 @@ package at.hannibal2.skyhanni.features.itemabilities
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ItemClickInHandEvent
-import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.PlayParticleEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.SpecialColour
import net.minecraft.client.Minecraft
-import net.minecraft.network.play.server.S2APacketParticles
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -19,20 +18,12 @@ class FireVeilWandParticles {
var lastClick = 0L
@SubscribeEvent
- fun onChatPacket(event: PacketEvent.ReceiveEvent) {
+ fun onChatPacket(event: PlayParticleEvent) {
if (!LorenzUtils.inSkyblock) return
if (SkyHanniMod.feature.itemAbilities.fireVeilWandDisplay == 0) return
if (System.currentTimeMillis() > lastClick + 5_500) return
- val packet = event.packet
- if (packet !is S2APacketParticles) return
-
-
- if (packet.particleType == EnumParticleTypes.FLAME && packet.particleCount == 1 && packet.particleSpeed == 0f &&
- packet.xOffset == 0f &&
- packet.yOffset == 0f &&
- packet.zOffset == 0f
- ) {
+ if (event.type == EnumParticleTypes.FLAME && event.count == 1 && event.speed == 0f && event.offset.isZero()) {
event.isCanceled = true
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
index cb82e1a90..92aad363f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
import at.hannibal2.skyhanni.events.GuiRenderItemEvent
import at.hannibal2.skyhanni.events.LorenzActionBarEvent
import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.PlaySoundEvent
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
@@ -16,8 +17,6 @@ import net.minecraft.client.renderer.GlStateManager
import net.minecraft.item.ItemStack
import net.minecraft.network.play.client.C07PacketPlayerDigging
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
-import net.minecraft.network.play.server.S29PacketSoundEffect
-import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -27,36 +26,33 @@ class ItemAbilityCooldown {
var tick = 0
val items = mutableMapOf<ItemStack, ItemText>()
- @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
- fun onChatPacket(event: PacketEvent.ReceiveEvent) {
- val packet = event.packet
- if (packet is S29PacketSoundEffect) {
- if (packet.soundName == "mob.zombie.remedy") {
- if (packet.pitch == 0.6984127f && packet.volume == 1f) {
+ @SubscribeEvent
+ fun onSoundEvent(event: PlaySoundEvent) {
+ if (event.soundName == "mob.zombie.remedy") {
+ if (event.pitch == 0.6984127f && event.volume == 1f) {
ItemAbility.HYPERION.sound()
}
}
- if (packet.soundName == "mob.enderdragon.growl") {
- if (packet.pitch == 1f && packet.volume == 1f) {
+ if (event.soundName == "mob.enderdragon.growl") {
+ if (event.pitch == 1f && event.volume == 1f) {
ItemAbility.ICE_SPRAY_WAND.sound()
}
}
- if (packet.soundName == "mob.endermen.portal") {
- if (packet.pitch == 0.61904764f && packet.volume == 1f) {
+ if (event.soundName == "mob.endermen.portal") {
+ if (event.pitch == 0.61904764f && event.volume == 1f) {
ItemAbility.GYROKINETIC_WAND.sound()
}
}
- if (packet.soundName == "random.anvil_land") {
- if (packet.pitch == 0.4920635f && packet.volume == 1f) {
+ if (event.soundName == "random.anvil_land") {
+ if (event.pitch == 0.4920635f && event.volume == 1f) {
ItemAbility.GIANTS_SWORD.sound()
}
}
- if (packet.soundName == "mob.ghast.affectionate_scream") {
- if (packet.pitch == 0.4920635f && packet.volume == 0.15f) {
+ if (event.soundName == "mob.ghast.affectionate_scream") {
+ if (event.pitch == 0.4920635f && event.volume == 0.15f) {
ItemAbility.ATOMSPLIT_KATANA.sound()
}
}
- }
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
index 07dc6d305..419f82486 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
@@ -1,26 +1,20 @@
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.PlayParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.network.play.server.S2APacketParticles
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class AshfangHideParticles {
@SubscribeEvent
- fun onReceivePacket(event: PacketEvent.ReceiveEvent) {
- if (event.packet !is S2APacketParticles) return
-
- if (isEnabled()) {
+ fun onReceivePacket(event: PlayParticleEvent) {
+ if (LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
+ ) {
event.isCanceled = true
}
}
-
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles &&
- DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
- }
} \ No newline at end of file