From b194f720efacb9a3e3881f7819f18b909c37f3bd Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 1 Feb 2024 12:18:15 +0000 Subject: [PATCH] Fixed spell equip sound playing when opening the spellbook --- .../unicopia/entity/player/PlayerCharmTracker.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java index 20e91f27..aeaf4d73 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerCharmTracker.java @@ -1,5 +1,7 @@ package com.minelittlepony.unicopia.entity.player; +import java.util.Objects; + import com.google.common.collect.Streams; import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType; @@ -53,7 +55,9 @@ public class PlayerCharmTracker implements NbtSerialisable { public CustomisedSpellType equipSpell(Hand hand, CustomisedSpellType spell) { CustomisedSpellType previous = handSpells[hand.ordinal()]; handSpells[hand.ordinal()] = spell; - pony.asEntity().playSound(USounds.GUI_SPELL_EQUIP.value(), 0.25F, 1.75F); + if (!Objects.equals(previous, spell)) { + pony.asEntity().playSound(USounds.GUI_SPELL_EQUIP.value(), 0.25F, 1.75F); + } pony.setDirty(); return previous; }