Package vazkii.botania.common.impl.mana
Class ManaItemHandlerImpl
java.lang.Object
vazkii.botania.common.impl.mana.ManaItemHandlerImpl
- All Implemented Interfaces:
ManaItemHandler
-
Field Summary
Fields inherited from interface vazkii.botania.api.mana.ManaItemHandler
INSTANCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdispatchMana(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.booleandispatchManaExact(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.floatgetFullDiscountForTools(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.intgetInvocationCountForTool(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.booleanhasProficiency(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack manaItem) intrequestMana(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.booleanrequestManaExact(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.booleanrequestManaExactForTool(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.intrequestManaForTool(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.
-
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:ManaItemHandlerGets 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:
getManaItemsin interfaceManaItemHandler- 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:ManaItemHandlerGets a list containing all mana-holding items in a player's accessories inventory.- Specified by:
getManaAccesoriesin interfaceManaItemHandler- 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:ManaItemHandlerRequests mana from items in a given player's inventory.- Specified by:
requestManain interfaceManaItemHandler- 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 useManaItemHandler.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:ManaItemHandlerRequests an exact amount of mana from items in a given player's inventory.- Specified by:
requestManaExactin interfaceManaItemHandler- 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:ManaItemHandlerDispatches 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:
dispatchManain interfaceManaItemHandler- 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:ManaItemHandlerDispatches 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:
dispatchManaExactin interfaceManaItemHandler- 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:ManaItemHandlerRequests mana from items in a given player's inventory. This version also checks for ManaDiscountArmor items equipped to lower the cost.- Specified by:
requestManaForToolin interfaceManaItemHandler- 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:ManaItemHandlerRequests 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:
requestManaExactForToolin interfaceManaItemHandler- 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:ManaItemHandlerDetermines how many times the given tool can get the requested amount of mana. Takes discounts into consideration.- Specified by:
getInvocationCountForToolin interfaceManaItemHandler- 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:ManaItemHandlerGets 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:
getFullDiscountForToolsin interfaceManaItemHandler
-
hasProficiency
public boolean hasProficiency(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack manaItem) - Specified by:
hasProficiencyin interfaceManaItemHandler
-