Interface Rechargeable
- All Superinterfaces:
ItemAttribute
- All Known Implementing Classes:
JetBoots,Jetpack,MultiTool,PortableTeleporter
A
Rechargeable SlimefunItem can hold energy and is able to
be recharged using a ChargingBench.
Any SlimefunItem which is supposed to be chargeable must implement this interface.- Author:
- TheBusyBiscuit
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanaddItemCharge(ItemStack item, float charge) This method adds the given charge to the providedItemStack.default floatgetItemCharge(ItemStack item) This method returns the currently stored energy charge on the providedItemStack.floatgetMaxItemCharge(ItemStack item) This method returns the maximum charge the givenItemStackis capable of holding.default booleanremoveItemCharge(ItemStack item, float charge) This method removes the given charge to the providedItemStack.default voidsetItemCharge(ItemStack item, float charge) This method sets the stored energy charge for a givenItemStack.Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.ItemAttribute
getId
-
Method Details
-
getMaxItemCharge
This method returns the maximum charge the givenItemStackis capable of holding. -
setItemCharge
This method sets the stored energy charge for a givenItemStack. The charge must be at least zero and at mostgetMaxItemCharge(ItemStack).- Parameters:
item- TheItemStackto chargecharge- The amount of charge to store
-
getItemCharge
This method returns the currently stored energy charge on the providedItemStack. -
addItemCharge
This method adds the given charge to the providedItemStack. The method will also return whether this operation was successful. If theItemStackis already at maximum charge, the method will returnfalse.- Parameters:
item- TheItemStackto chargecharge- The amount of charge to add- Returns:
- Whether the given charge could be added successfully
-
removeItemCharge
This method removes the given charge to the providedItemStack. The method will also return whether this operation was successful. If theItemStackdoes not have enough charge, the method will returnfalse.- Parameters:
item- TheItemStackto remove the charge fromcharge- The amount of charge to remove- Returns:
- Whether the given charge could be removed successfully
-