Chargeable

interface Chargeable

Allows items to store energy and be charged.

Inheritors

Types

Link copied to clipboard
Link copied to clipboard
class Default(maxEnergy: Provider<Long>, affectsItemDurability: Boolean) : ItemBehavior, Chargeable

Properties

Link copied to clipboard
abstract val maxEnergy: Long

The maximum amount of energy this item can store.

Functions

Link copied to clipboard
abstract fun addEnergy(itemStack: ItemStack, energy: Long)

Adds the given energy to the current amount of energy stored in the given itemStack, capped at maxEnergy.

Link copied to clipboard
abstract fun getEnergy(itemStack: ItemStack): Long

Gets the current amount of energy stored in the given itemStack.

Link copied to clipboard
abstract fun setEnergy(itemStack: ItemStack, energy: Long)

Sets the current amount of energy stored in the given itemStack to energy.