Class WandItem

java.lang.Object
net.minecraft.world.item.Item
com.binaris.wizardry.content.item.WandItem
All Implemented Interfaces:
ICastItem, ICustomDamageItem, IElementValue, IManaItem, ITierValue, IWorkbenchItem, net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.minecraftforge.common.extensions.IForgeItem

public class WandItem extends net.minecraft.world.item.Item implements ICastItem, IManaItem, IWorkbenchItem, ICustomDamageItem, ITierValue, IElementValue
Where the magic (normally) happens!! Most of the functions and logic for this item are handled on various utils classes (e.g. CastItemDataHelper and CastItemUtils), so refer to those for more details on specific aspects of wand functionality.

A wand is a spell-casting item that can store mana, hold multiple spells, and be upgraded in various ways. Wands can cast both instant and continuous spells, with mechanics for charging, cooldowns, and mana consumption. They can be upgraded using special items to enhance their capabilities, such as increasing mana capacity or adding spell slots.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.item.Item

    net.minecraft.world.item.Item.Properties
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
    Cooldown applied when a spell cast is canceled by forfeit (or any listener from SpellPreCast/SpellTickCast)
    static final int
    Maximum use duration for continuous spells.

    Fields inherited from class net.minecraft.world.item.Item

    BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    WandItem(SpellTier tier, Element element)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    applySpecialUpgrade(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.world.item.ItemStack upgrade)
    Applies a special upgrade to the wand, such as storage or attunement upgrades.
    protected net.minecraft.world.item.ItemStack
    applyTierUpgrade(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.world.item.ItemStack tomeStack)
    Applies a tier upgrade to the wand if the tome's tier is higher than the wand's current tier.
    net.minecraft.world.item.ItemStack
    applyUpgrade(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.world.item.ItemStack upgrade)
     
    protected boolean
    applyUpgradeSlot(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot upgrade)
    Applies an upgrade from the workbench upgrade slot to the wand in the center slot.
    boolean
    canBreak(net.minecraft.world.item.ItemStack stack)
    used to control whether the item can be broken or if it should stay at 0 durability
    boolean
    canCast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx)
    Normally you would call the events SpellCastEvent.Pre and SpellCastEvent.Tick in order to know when to allow the spell to run, but here you also handle any other conditions to allow casting.
    boolean
    cast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx)
    This is where you make all the spell cast handling (normally just instant spells).
    protected void
    checkLevelUp(PlayerCastContext ctx, net.minecraft.world.item.ItemStack stack, int progression)
    Checks if the wand has enough progression to level up and notifies the player if it has.
    createContext(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, int tick, net.minecraft.world.item.ItemStack stack, Spell spell)
    Creates a PlayerCastContext for the given parameters, calculating spell modifiers based on the tick count.
    protected void
    expandSpellSlots(net.minecraft.world.item.ItemStack wand)
    Expands the spell slots on the wand when an attunement upgrade is applied.
    int
    getBarColor(net.minecraft.world.item.ItemStack stack)
     
    int
    getCurrentCooldown(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level)
    Returns the current cooldown to display on the spell HUD for the given ItemStack.
    int
    getCurrentMaxCooldown(net.minecraft.world.item.ItemStack stack)
    Returns the max cooldown of the current spell to display on the spell HUD for the given ItemStack.
    @NotNull Spell
    getCurrentSpell(net.minecraft.world.item.ItemStack stack)
    Gets the current spell selected in the ItemStack.
    int
    getCustomMaxDamage(net.minecraft.world.item.ItemStack stack)
    you can use this to set custom max damage based on some events
    Gets the element associated with this item.
    int
    getMana(net.minecraft.world.item.ItemStack stack)
     
    int
    getManaCapacity(net.minecraft.world.item.ItemStack stack)
     
    @NotNull net.minecraft.network.chat.Component
    getName(@NotNull net.minecraft.world.item.ItemStack stack)
     
    @NotNull Spell
    getNextSpell(net.minecraft.world.item.ItemStack stack)
    Gets the next spell in the list of spells.
    @NotNull Spell
    getPreviousSpell(net.minecraft.world.item.ItemStack stack)
    If your item will have more than just one spell loaded you need to override this in order to have a previous spell on list, by default it just gets the current spell saved.
    getSpells(net.minecraft.world.item.ItemStack stack)
    If your item will have more than just one spell loaded you need to override this in order to have a list of spells saved, by default it just sends a list with just the current spell.
    int
    getSpellSlotCount(net.minecraft.world.item.ItemStack stack)
     
    getTier(net.minecraft.world.item.ItemStack stack)
    Gets the tier associated with this item.
    int
    getUseDuration(@NotNull net.minecraft.world.item.ItemStack stack)
     
    protected void
    handleInstantSpellTick(PlayerCastContext ctx, Spell spell, net.minecraft.world.item.ItemStack stack, int useTick, int charge)
    Handles the logic for instant spell casting on useTick.
    protected void
    handleProgression(PlayerCastContext ctx, Spell spell, net.minecraft.world.item.ItemStack stack)
    Handles wand progression when a spell is cast.
    @NotNull net.minecraft.world.InteractionResult
    interactLivingEntity(@NotNull net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, @NotNull net.minecraft.world.entity.LivingEntity interactionTarget, @NotNull net.minecraft.world.InteractionHand usedHand)
     
    void
    inventoryTick(@NotNull net.minecraft.world.item.ItemStack stack, @NotNull net.minecraft.world.level.Level world, @NotNull net.minecraft.world.entity.Entity entity, int slot, boolean isHeldInMainHand)
     
    boolean
     
    boolean
    isFoil(@NotNull net.minecraft.world.item.ItemStack stack)
     
    boolean
    onApplyButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks)
     
    void
    onClearButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks)
     
    void
    onUseTick(@NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.entity.LivingEntity user, @NotNull net.minecraft.world.item.ItemStack stack, int timeLeft)
     
    void
    releaseUsing(@NotNull net.minecraft.world.item.ItemStack stack, @NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.entity.LivingEntity livingEntity, int timeCharged)
     
    void
    selectNextSpell(net.minecraft.world.item.ItemStack stack)
    Selects the next spell bound to the given ItemStack.
    void
    selectPreviousSpell(net.minecraft.world.item.ItemStack stack)
    Selects the previous spell bound to the given itemstack.
    boolean
    selectSpell(net.minecraft.world.item.ItemStack stack, int index)
    If your item will have more than just one spell loaded you need to override this in order to have the possibility to switch between the spell list.
    void
    setCustomDamage(net.minecraft.world.item.ItemStack stack, int damage)
    exposing a new way to control when and how damage is set
    void
    setMana(net.minecraft.world.item.ItemStack stack, int mana)
     
    boolean
    showSpellHUD(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack)
    Returns whether the spell HUD should be shown when a player is holding this item.
    boolean
    showTooltip(net.minecraft.world.item.ItemStack stack)
     
    @NotNull net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack>
    use(@NotNull net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, @NotNull net.minecraft.world.InteractionHand hand)
     
    boolean
    Determines if this item is valid for use in a receptacle.

    Methods inherited from class net.minecraft.world.item.Item

    appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, hasCraftingRemainingItem, hurtEnemy, initializeClient, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, overrideOtherStackedOnMe, overrideStackedOnOther, requiredFeatures, shouldOverrideMultiplayerNbt, toString, useOn, useOnRelease, verifyTagAfterLoad

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface com.binaris.wizardry.api.content.item.ICastItem

    showSpellsInWorkbench

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeItem

    canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, initCapabilities, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onInventoryTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation

    Methods inherited from interface com.binaris.wizardry.api.content.item.IManaItem

    consumeMana, getFullness, isManaEmpty, isManaFull, rechargeMana, showManaInWorkbench

    Methods inherited from interface com.binaris.wizardry.api.content.item.IWorkbenchItem

    canPlace
  • Field Details

    • BASE_SPELL_SLOTS

      public static final int BASE_SPELL_SLOTS
      See Also:
    • COOLDOWN_FORFEIT_TICKS

      public static final int COOLDOWN_FORFEIT_TICKS
      Cooldown applied when a spell cast is canceled by forfeit (or any listener from SpellPreCast/SpellTickCast)
      See Also:
    • MAX_USE_DURATION

      public static final int MAX_USE_DURATION
      Maximum use duration for continuous spells.
      See Also:
  • Constructor Details

  • Method Details

    • use

      @NotNull public @NotNull net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(@NotNull @NotNull net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, @NotNull @NotNull net.minecraft.world.InteractionHand hand)
      Overrides:
      use in class net.minecraft.world.item.Item
    • onUseTick

      public void onUseTick(@NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.entity.LivingEntity user, @NotNull @NotNull net.minecraft.world.item.ItemStack stack, int timeLeft)
      Overrides:
      onUseTick in class net.minecraft.world.item.Item
    • canCast

      public boolean canCast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx)
      Description copied from interface: ICastItem
      Normally you would call the events SpellCastEvent.Pre and SpellCastEvent.Tick in order to know when to allow the spell to run, but here you also handle any other conditions to allow casting.
      Specified by:
      canCast in interface ICastItem
      Parameters:
      stack - The ItemStack to cast the spell from
      spell - The spell to cast
      ctx - The context of the cast
      Returns:
      Whether the spell can be cast or not
    • cast

      public boolean cast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx)
      Description copied from interface: ICastItem
      This is where you make all the spell cast handling (normally just instant spells). For doing the continuous spells you could use Item.onUseTick(Level, LivingEntity, ItemStack, int)
      Specified by:
      cast in interface ICastItem
      Parameters:
      stack - The ItemStack to cast the spell from
      spell - The spell to cast
      ctx - The context of the cast
      Returns:
      Whether the spell was cast successfully or not
    • interactLivingEntity

      @NotNull public @NotNull net.minecraft.world.InteractionResult interactLivingEntity(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, @NotNull @NotNull net.minecraft.world.entity.LivingEntity interactionTarget, @NotNull @NotNull net.minecraft.world.InteractionHand usedHand)
      Overrides:
      interactLivingEntity in class net.minecraft.world.item.Item
    • releaseUsing

      public void releaseUsing(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.entity.LivingEntity livingEntity, int timeCharged)
      Overrides:
      releaseUsing in class net.minecraft.world.item.Item
    • onApplyButtonPressed

      public boolean onApplyButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks)
      Specified by:
      onApplyButtonPressed in interface IWorkbenchItem
    • applyUpgrade

      public net.minecraft.world.item.ItemStack applyUpgrade(@Nullable @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.world.item.ItemStack upgrade)
      Specified by:
      applyUpgrade in interface IWorkbenchItem
    • inventoryTick

      public void inventoryTick(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @NotNull @NotNull net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.world.entity.Entity entity, int slot, boolean isHeldInMainHand)
      Overrides:
      inventoryTick in class net.minecraft.world.item.Item
    • handleInstantSpellTick

      protected void handleInstantSpellTick(PlayerCastContext ctx, Spell spell, net.minecraft.world.item.ItemStack stack, int useTick, int charge)
      Handles the logic for instant spell casting on useTick. If the current useTick matches the required charge, it checks if the spell can be cast, consumes mana, sets cooldown, and casts the spell. Finally, it stops the player's item use.
      Parameters:
      stack - The wand item stack
      spell - The spell being cast
      ctx - The player cast context
      useTick - The current use tick
      charge - The required charge time for the spell
    • createContext

      protected PlayerCastContext createContext(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, int tick, net.minecraft.world.item.ItemStack stack, Spell spell)
      Creates a PlayerCastContext for the given parameters, calculating spell modifiers based on the tick count.
      Parameters:
      level - The current level
      player - The player casting the spell
      hand - The hand used to cast the spell
      tick - The current tick count of the casting process
      stack - The wand item stack
      spell - The spell being cast
      Returns:
      A PlayerCastContext with the appropriate modifiers
    • applyUpgradeSlot

      protected boolean applyUpgradeSlot(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot upgrade)
      Applies an upgrade from the workbench upgrade slot to the wand in the center slot.
      Parameters:
      player - The player applying the upgrade (can be null)
      centre - The workbench slot containing the wand
      upgrade - The workbench slot containing the upgrade item
      Returns:
      true if the wand was changed, false otherwise
    • applyTierUpgrade

      protected net.minecraft.world.item.ItemStack applyTierUpgrade(@Nullable @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.world.item.ItemStack tomeStack)
      Applies a tier upgrade to the wand if the tome's tier is higher than the wand's current tier. This method checks if the player has enough progression to upgrade and updates the wand's tier and progression accordingly.
      Parameters:
      player - The player applying the upgrade (can be null)
      wand - The wand item stack to apply the upgrade to
      tomeStack - The arcane tome item stack being used for the upgrade
      Returns:
      The upgraded wand item stack, or the original wand if no upgrade was applied
    • applySpecialUpgrade

      protected void applySpecialUpgrade(@Nullable @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.world.item.ItemStack upgrade)
      Applies a special upgrade to the wand, such as storage or attunement upgrades. This method checks for upgrade limits and applies the upgrade effects accordingly.
      Parameters:
      player - The player applying the upgrade (can be null)
      wand - The wand item stack to apply the upgrade to
      upgrade - The upgrade item stack being applied
    • expandSpellSlots

      protected void expandSpellSlots(net.minecraft.world.item.ItemStack wand)
      Expands the spell slots on the wand when an attunement upgrade is applied. This method adjusts the spell list to accommodate the new slot count.
      Parameters:
      wand - The wand item stack to expand spell slots for
    • handleProgression

      protected void handleProgression(PlayerCastContext ctx, Spell spell, net.minecraft.world.item.ItemStack stack)
      Handles wand progression when a spell is cast. Progression is only added for non-instant spells and for wands below master tier. Progression is added every second (20 ticks) during casting.
      Parameters:
      ctx - The player cast context
      spell - The spell being cast
      stack - The wand item stack
    • checkLevelUp

      protected void checkLevelUp(PlayerCastContext ctx, net.minecraft.world.item.ItemStack stack, int progression)
      Checks if the wand has enough progression to level up and notifies the player if it has. This method is called after progression is added to the wand.
      Parameters:
      ctx - The player cast context
      stack - The wand item stack
      progression - The amount of progression just added
    • onClearButtonPressed

      public void onClearButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks)
      Specified by:
      onClearButtonPressed in interface IWorkbenchItem
    • getName

      @NotNull public @NotNull net.minecraft.network.chat.Component getName(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Overrides:
      getName in class net.minecraft.world.item.Item
    • selectNextSpell

      public void selectNextSpell(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      Selects the next spell bound to the given ItemStack. The given ItemStack will be of this item.
      Specified by:
      selectNextSpell in interface ICastItem
    • selectPreviousSpell

      public void selectPreviousSpell(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      Selects the previous spell bound to the given itemstack. The given itemstack will be of this item.
      Specified by:
      selectPreviousSpell in interface ICastItem
    • getCustomMaxDamage

      public int getCustomMaxDamage(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICustomDamageItem
      you can use this to set custom max damage based on some events
      Specified by:
      getCustomMaxDamage in interface ICustomDamageItem
    • setCustomDamage

      public void setCustomDamage(net.minecraft.world.item.ItemStack stack, int damage)
      Description copied from interface: ICustomDamageItem
      exposing a new way to control when and how damage is set
      Specified by:
      setCustomDamage in interface ICustomDamageItem
    • isFoil

      public boolean isFoil(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Overrides:
      isFoil in class net.minecraft.world.item.Item
    • canBreak

      public boolean canBreak(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICustomDamageItem
      used to control whether the item can be broken or if it should stay at 0 durability
      Specified by:
      canBreak in interface ICustomDamageItem
    • getBarColor

      public int getBarColor(net.minecraft.world.item.ItemStack stack)
      Overrides:
      getBarColor in class net.minecraft.world.item.Item
    • getUseDuration

      public int getUseDuration(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Overrides:
      getUseDuration in class net.minecraft.world.item.Item
    • isClearable

      public boolean isClearable()
      Specified by:
      isClearable in interface IWorkbenchItem
    • showTooltip

      public boolean showTooltip(net.minecraft.world.item.ItemStack stack)
      Specified by:
      showTooltip in interface IWorkbenchItem
    • selectSpell

      public boolean selectSpell(net.minecraft.world.item.ItemStack stack, int index)
      Description copied from interface: ICastItem
      If your item will have more than just one spell loaded you need to override this in order to have the possibility to switch between the spell list.
      Specified by:
      selectSpell in interface ICastItem
    • getCurrentCooldown

      public int getCurrentCooldown(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level)
      Description copied from interface: ICastItem
      Returns the current cooldown to display on the spell HUD for the given ItemStack.
      Specified by:
      getCurrentCooldown in interface ICastItem
    • getCurrentMaxCooldown

      public int getCurrentMaxCooldown(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      Returns the max cooldown of the current spell to display on the spell HUD for the given ItemStack.
      Specified by:
      getCurrentMaxCooldown in interface ICastItem
    • showSpellHUD

      public boolean showSpellHUD(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      Returns whether the spell HUD should be shown when a player is holding this item. Only called client-side.
      Specified by:
      showSpellHUD in interface ICastItem
    • getMana

      public int getMana(net.minecraft.world.item.ItemStack stack)
      Specified by:
      getMana in interface IManaItem
    • getManaCapacity

      public int getManaCapacity(net.minecraft.world.item.ItemStack stack)
      Specified by:
      getManaCapacity in interface IManaItem
    • setMana

      public void setMana(net.minecraft.world.item.ItemStack stack, int mana)
      Specified by:
      setMana in interface IManaItem
    • getSpellSlotCount

      public int getSpellSlotCount(net.minecraft.world.item.ItemStack stack)
      Specified by:
      getSpellSlotCount in interface IWorkbenchItem
    • getCurrentSpell

      @NotNull public @NotNull Spell getCurrentSpell(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      Gets the current spell selected in the ItemStack. This is used for client-side rendering or spell selection utils.
      Specified by:
      getCurrentSpell in interface ICastItem
      Parameters:
      stack - The ItemStack to get the current spell from
      Returns:
      The current spell selected in the ItemStack
    • getNextSpell

      @NotNull public @NotNull Spell getNextSpell(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      Gets the next spell in the list of spells. By default, it just returns the current spell.
      Specified by:
      getNextSpell in interface ICastItem
      Parameters:
      stack - The ItemStack to get the next spell from
      Returns:
      The next spell in the list of spells or the current spell if there is only one spell allowed
    • getPreviousSpell

      @NotNull public @NotNull Spell getPreviousSpell(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      If your item will have more than just one spell loaded you need to override this in order to have a previous spell on list, by default it just gets the current spell saved. Used by the Spell GUI to get the actual spell icon and some client related features
      Specified by:
      getPreviousSpell in interface ICastItem
    • getSpells

      public Spell[] getSpells(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ICastItem
      If your item will have more than just one spell loaded you need to override this in order to have a list of spells saved, by default it just sends a list with just the current spell. Used by the Spell GUI to get all the needed spells to show
      Specified by:
      getSpells in interface ICastItem
    • getElement

      public Element getElement()
      Description copied from interface: IElementValue
      Gets the element associated with this item.
      Specified by:
      getElement in interface IElementValue
      Returns:
      The element of the item.
    • validForReceptacle

      public boolean validForReceptacle()
      Description copied from interface: IElementValue
      Determines if this item is valid for use in a receptacle.
      Specified by:
      validForReceptacle in interface IElementValue
      Returns:
      true if the item can be used in a receptacle, false otherwise.
    • getTier

      public SpellTier getTier(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ITierValue
      Gets the tier associated with this item.
      Specified by:
      getTier in interface ITierValue
      Returns:
      The tier of the item.