Package cn.nukkit.energy
Interface EnergyHolder
public interface EnergyHolder
Defines the interface for energy holders.
If a block, an item, a block-entity implements this interface, it can store energy, accept input or provide output.
- Author:
- superice666
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canAcceptInput
(EnergyType energyType) default boolean
canAcceptInput
(EnergyType energyType, BlockFace face) boolean
canProvideOutput
(EnergyType energyType) default boolean
canProvideOutput
(EnergyType energyType, BlockFace face) double
getName()
double
void
inputInto
(EnergyType energyType, double amount) void
outputFrom
(EnergyType energyType, double amount)
-
Method Details
-
getName
- Returns:
- The name of this energy holder.
-
canAcceptInput
- Parameters:
energyType
- The type of energy to accept.- Returns:
- If this energy holder can accept input.
-
canAcceptInput
- Parameters:
energyType
- The type of energy to accept.face
- The face the energy is coming from.- Returns:
- If this energy holder can accept inout from the given face, usually used by blocks.
-
canProvideOutput
- Parameters:
energyType
- The type of energy to provide.- Returns:
- If this energy holder can provide output.
-
canProvideOutput
- Parameters:
energyType
- The type of energy to provide.face
- The face the energy is going to.- Returns:
- If this energy holder can provide output to the given face, usually used by blocks.
-
inputInto
- Parameters:
energyType
- The type of energy to input into this energy holder.amount
- The amount of energy to input.
-
outputFrom
- Parameters:
energyType
- The type of energy to output from this energy holder.amount
- The amount of energy to output.
-
getStoredEnergyType
- Returns:
- The type of the energy stored in this energy holder. If it can't store any energy, it returns null.
-
getMaxStorage
double getMaxStorage()- Returns:
- The max amount of energy that can stored in this energy holder. If it can't store any energy, it returns 0.
-
getStoredEnergy
double getStoredEnergy()- Returns:
- The amount of energy stored in this energy holder. If it can't store any energy, it returns 0.
-