Fixed spell equip sound playing when opening the spellbook

This commit is contained in:
Sollace 2024-02-01 12:18:15 +00:00
parent 72b5b3d50c
commit b194f720ef
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -1,5 +1,7 @@
package com.minelittlepony.unicopia.entity.player; package com.minelittlepony.unicopia.entity.player;
import java.util.Objects;
import com.google.common.collect.Streams; import com.google.common.collect.Streams;
import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.USounds;
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType; 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) { public CustomisedSpellType<?> equipSpell(Hand hand, CustomisedSpellType<?> spell) {
CustomisedSpellType<?> previous = handSpells[hand.ordinal()]; CustomisedSpellType<?> previous = handSpells[hand.ordinal()];
handSpells[hand.ordinal()] = spell; handSpells[hand.ordinal()] = spell;
if (!Objects.equals(previous, spell)) {
pony.asEntity().playSound(USounds.GUI_SPELL_EQUIP.value(), 0.25F, 1.75F); pony.asEntity().playSound(USounds.GUI_SPELL_EQUIP.value(), 0.25F, 1.75F);
}
pony.setDirty(); pony.setDirty();
return previous; return previous;
} }