Interface ManaItemHandler

All Known Implementing Classes:
ManaItemHandlerImpl

public interface ManaItemHandler
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ManaItemHandler
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default 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.
    default 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.
    default 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.
    default 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.
    default 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.
    default 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.
    default boolean
    hasProficiency(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack manaItem)
     
     
    default 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.
    default 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.
    default 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.
    default 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.
  • Field Details

  • Method Details

    • instance

      static ManaItemHandler instance()
    • getManaItems

      default 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. Also includes a call to ManaItemsEvent, so other mods can add items from their player-associated inventories.
      Returns:
      The list of items
    • getManaAccesories

      default 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.
      Returns:
      The list of items
    • requestMana

      default 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.
      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(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

      default 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.
      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

      default 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. Note that this method does not automatically remove mana from the item which is exporting.
      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

      default 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. Note that this method does not automatically remove mana from the item which is exporting.
      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

      default 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. This version also checks for ManaDiscountArmor items equipped to lower the cost.
      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

      default 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. This version also checks for ManaDiscountArmor items equipped to lower the cost.
      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

      default 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. Takes discounts into consideration.
      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

      default 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. This discount can vary based on what the passed tool is.
    • hasProficiency

      default boolean hasProficiency(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack manaItem)