summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/itemabilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/itemabilities')
-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
2 files changed, 16 insertions, 29 deletions
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