Class ManaItemHandlerImpl

java.lang.Object
vazkii.botania.common.impl.mana.ManaItemHandlerImpl
All Implemented Interfaces:
ManaItemHandler

public class ManaItemHandlerImpl extends Object implements ManaItemHandler
  • Field Summary

    Fields inherited from interface vazkii.botania.api.mana.ManaItemHandler

    INSTANCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    dispatchMana(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToSend, boolean add)
    Dispatches mana to items in a given player's inventory.
    boolean
    dispatchManaExact(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToSend, boolean add)
    Dispatches an exact amount of mana to items in a given player's inventory.
    float
    getFullDiscountForTools(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack tool)
    Gets the sum of all the discounts on ManaDiscountArmor items equipped on the player passed in.
    int
    getInvocationCountForTool(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet)
    Determines how many times the given tool can get the requested amount of mana.
    List<net.minecraft.world.item.ItemStack>
    getManaAccesories(net.minecraft.world.entity.player.Player player)
    Gets a list containing all mana-holding items in a player's accessories inventory.
    List<net.minecraft.world.item.ItemStack>
    getManaItems(net.minecraft.world.entity.player.Player player)
    Gets a list containing all mana-holding items in a player's inventory.
    boolean
    hasProficiency(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack manaItem)
     
    int
    requestMana(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
    Requests mana from items in a given player's inventory.
    boolean
    requestManaExact(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
    Requests an exact amount of mana from items in a given player's inventory.
    boolean
    requestManaExactForTool(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
    Requests an exact amount of mana from items in a given player's inventory.
    int
    requestManaForTool(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
    Requests mana from items in a given player's inventory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ManaItemHandlerImpl

      public ManaItemHandlerImpl()
  • Method Details

    • getManaItems

      public List<net.minecraft.world.item.ItemStack> getManaItems(net.minecraft.world.entity.player.Player player)
      Description copied from interface: ManaItemHandler
      Gets a list containing all mana-holding items in a player's inventory. Also includes a call to ManaItemsEvent, so other mods can add items from their player-associated inventories.
      Specified by:
      getManaItems in interface ManaItemHandler
      Returns:
      The list of items
    • getManaAccesories

      public List<net.minecraft.world.item.ItemStack> getManaAccesories(net.minecraft.world.entity.player.Player player)
      Description copied from interface: ManaItemHandler
      Gets a list containing all mana-holding items in a player's accessories inventory.
      Specified by:
      getManaAccesories in interface ManaItemHandler
      Returns:
      The list of items
    • requestMana

      public int requestMana(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
      Description copied from interface: ManaItemHandler
      Requests mana from items in a given player's inventory.
      Specified by:
      requestMana in interface ManaItemHandler
      Parameters:
      manaToGet - How much mana is to be requested, if less mana exists than this amount, the amount of mana existent will be returned instead, if you want exact values use ManaItemHandler.requestManaExact(net.minecraft.world.item.ItemStack, net.minecraft.world.entity.player.Player, int, boolean).
      remove - If true, the mana will be removed from the target item. Set to false to just check.
      Returns:
      The amount of mana received from the request.
    • requestManaExact

      public boolean requestManaExact(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
      Description copied from interface: ManaItemHandler
      Requests an exact amount of mana from items in a given player's inventory.
      Specified by:
      requestManaExact in interface ManaItemHandler
      Parameters:
      manaToGet - How much mana is to be requested, if less mana exists than this amount, false will be returned instead, and nothing will happen.
      remove - If true, the mana will be removed from the target item. Set to false to just check.
      Returns:
      If the request was succesful.
    • dispatchMana

      public int dispatchMana(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToSend, boolean add)
      Description copied from interface: ManaItemHandler
      Dispatches mana to items in a given player's inventory. Note that this method does not automatically remove mana from the item which is exporting.
      Specified by:
      dispatchMana in interface ManaItemHandler
      Parameters:
      manaToSend - How much mana is to be sent.
      add - If true, the mana will be added from the target item. Set to false to just check.
      Returns:
      The amount of mana actually sent.
    • dispatchManaExact

      public boolean dispatchManaExact(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToSend, boolean add)
      Description copied from interface: ManaItemHandler
      Dispatches an exact amount of mana to items in a given player's inventory. Note that this method does not automatically remove mana from the item which is exporting.
      Specified by:
      dispatchManaExact in interface ManaItemHandler
      Parameters:
      manaToSend - How much mana is to be sent.
      add - If true, the mana will be added from the target item. Set to false to just check.
      Returns:
      If an item received the mana sent.
    • requestManaForTool

      public int requestManaForTool(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
      Description copied from interface: ManaItemHandler
      Requests mana from items in a given player's inventory. This version also checks for ManaDiscountArmor items equipped to lower the cost.
      Specified by:
      requestManaForTool in interface ManaItemHandler
      Parameters:
      manaToGet - How much mana is to be requested, if less mana exists than this amount, the amount of mana existent will be returned instead, if you want exact values use requestManaExact.
      remove - If true, the mana will be removed from the target item. Set to false to just check.
      Returns:
      The amount of mana received from the request.
    • requestManaExactForTool

      public boolean requestManaExactForTool(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet, boolean remove)
      Description copied from interface: ManaItemHandler
      Requests an exact amount of mana from items in a given player's inventory. This version also checks for ManaDiscountArmor items equipped to lower the cost.
      Specified by:
      requestManaExactForTool in interface ManaItemHandler
      Parameters:
      manaToGet - How much mana is to be requested, if less mana exists than this amount, false will be returned instead, and nothing will happen.
      remove - If true, the mana will be removed from the target item. Set to false to just check.
      Returns:
      If the request was succesful.
    • getInvocationCountForTool

      public int getInvocationCountForTool(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.player.Player player, int manaToGet)
      Description copied from interface: ManaItemHandler
      Determines how many times the given tool can get the requested amount of mana. Takes discounts into consideration.
      Specified by:
      getInvocationCountForTool in interface ManaItemHandler
      Parameters:
      manaToGet - How much mana is to be requested per invocation
      Returns:
      The number of invocations that could be executed before exhausting the player's mana available
    • getFullDiscountForTools

      public float getFullDiscountForTools(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack tool)
      Description copied from interface: ManaItemHandler
      Gets the sum of all the discounts on ManaDiscountArmor items equipped on the player passed in. This discount can vary based on what the passed tool is.
      Specified by:
      getFullDiscountForTools in interface ManaItemHandler
    • hasProficiency

      public boolean hasProficiency(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack manaItem)
      Specified by:
      hasProficiency in interface ManaItemHandler