Package cn.nukkit.energy
Interface EnergyType
public interface EnergyType
定义一个能源种类
Define an energy type.
- Author:
- superice666
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canConvertTo
(EnergyType type) default boolean
default double
convertTo
(EnergyType type, double amount) Convert the amount of energy to the target energy type.default double
When converting from this energy type to another energy type, the amount of energy is converted firstly to the "base" energy type, and then converted to the target energy type.getName()
-
Method Details
-
getName
- Returns:
- The name of this energy type.
-
getBaseRatio
default double getBaseRatio()When converting from this energy type to another energy type, the amount of energy is converted firstly to the "base" energy type, and then converted to the target energy type.
If both two EnergyType returns a positive number, then they can convert to each other.- Returns:
- The ratio used when convent this type of energy to another type of energy.
-
canConvertToBase
default boolean canConvertToBase()- Returns:
- Whether this energy type use base ratio.
-
canConvertTo
- Parameters:
type
- The energy type to convert to.- Returns:
- If this energy type can convert to the target energy type.
-
convertTo
Convert the amount of energy to the target energy type.- Parameters:
type
- The energy type to convert to.amount
- The amount of energy to convert.- Returns:
- The amount of energy converted to the target energy type.
-