diff --git a/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java b/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java index 9380cba5..6c59f578 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/GemstoneItem.java @@ -44,10 +44,19 @@ public class GemstoneItem extends Item { PlayerCharmTracker charms = Pony.of(user).getCharms(); TypedActionResult> spell = consumeSpell(stack, user, ((Predicate>)charms.getEquippedSpell(hand)::equals).negate()); + + CustomisedSpellType existing = charms.getEquippedSpell(hand); + + if (existing != null) { + stack = existing.traits().applyTo(enchant(stack, existing.type())); + } + if (spell.getResult().isAccepted()) { charms.equipSpell(hand, spell.getValue()); - return TypedActionResult.success(stack, true); + } else { + charms.equipSpell(hand, SpellType.EMPTY_KEY.withTraits()); } + return TypedActionResult.success(stack, true); } return result;