Add spell quick access keys

This commit is contained in:
Electroblob77
2020-04-18 21:45:01 +01:00
parent ed63704184
commit f0752317e6
9 changed files with 175 additions and 18 deletions
@@ -65,6 +65,16 @@ public interface ISpellCastingItem {
// Nothing here either
}
/**
* Selects the spell at the given index bound to the given itemstack. The given itemstack will be of this item.
* @param stack The itemstack to query.
* @param index The index to set.
* @return True if the operation succeeded, false if not.
*/
default boolean selectSpell(ItemStack stack, int index){
return false;
}
/**
* Returns whether the spell HUD should be shown when a player is holding this item. Only called client-side.
* @param player The player holding the item.
@@ -113,6 +113,11 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem,
WandHelper.selectPreviousSpell(stack);
}
@Override
public boolean selectSpell(ItemStack stack, int index){
return WandHelper.selectSpell(stack, index);
}
@Override
public boolean showSpellHUD(EntityPlayer player, ItemStack stack){
return true;