mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
When stealing a player's equipped spell, actually remove it from the slot
This commit is contained in:
parent
514ce8f984
commit
77c993bfa7
2 changed files with 4 additions and 2 deletions
|
@ -50,10 +50,12 @@ public class PlayerCharmTracker implements NbtSerialisable {
|
||||||
.orElse(getEquippedSpell(hand).toAction());
|
.orElse(getEquippedSpell(hand).toAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void equipSpell(Hand hand, CustomisedSpellType<?> spell) {
|
public CustomisedSpellType<?> equipSpell(Hand hand, CustomisedSpellType<?> spell) {
|
||||||
|
CustomisedSpellType<?> previous = handSpells[hand.ordinal()];
|
||||||
handSpells[hand.ordinal()] = spell;
|
handSpells[hand.ordinal()] = 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class EnchantedStaffItem extends StaffItem implements EnchantableItem, Ch
|
||||||
return cast.getSpellSlot().get(c -> !SpellPredicate.IS_PLACED.test(c), true).map(Spell::getType).orElse(SpellType.empty());
|
return cast.getSpellSlot().get(c -> !SpellPredicate.IS_PLACED.test(c), true).map(Spell::getType).orElse(SpellType.empty());
|
||||||
}
|
}
|
||||||
if (entity instanceof PlayerEntity player) {
|
if (entity instanceof PlayerEntity player) {
|
||||||
return Pony.of(player).getCharms().getEquippedSpell(Hand.MAIN_HAND).type();
|
return Pony.of(player).getCharms().equipSpell(Hand.MAIN_HAND, SpellType.EMPTY_KEY.withTraits()).type();
|
||||||
}
|
}
|
||||||
return ENTITY_TYPE_TO_SPELL.getOrDefault(entity.getType(), SpellType.empty());
|
return ENTITY_TYPE_TO_SPELL.getOrDefault(entity.getType(), SpellType.empty());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue