IEnergyStorage

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.capability.IEnergyStorage;

Members

Getter
Checks if energy can be extracted from this storage.
script.zs
// IEnergyStorage.canExtract as bool
myIEnergyStorage.canExtract

Return Type: bool

canExtract() as bool
Checks if energy can be extracted from this storage.

Returns: true if the storage can be extracted from, false otherwise.

script.zs
// IEnergyStorage.canExtract() as bool;
myIEnergyStorage.canExtract();

Return Type: bool

Getter
Checks if this storage can receive energy.
script.zs
// IEnergyStorage.canReceive as bool
myIEnergyStorage.canReceive

Return Type: bool

canReceive() as bool
Checks if this storage can receive energy.

Returns: true if this storage can receive energy, false otherwise.

script.zs
// IEnergyStorage.canReceive() as bool;
myIEnergyStorage.canReceive();

Return Type: bool

Getter
Gets the amount of energy stored.
script.zs
// IEnergyStorage.energyStored as int
myIEnergyStorage.energyStored

Return Type: int

energyStored() as int
Gets the amount of energy stored.

Returns: The amount of energy stored.

script.zs
// IEnergyStorage.energyStored() as int;
myIEnergyStorage.energyStored();

Return Type: int

extractEnergy(maxExtract as int, simulate as bool) as int
Extracts energy from the storage.

Returns: the amount of energy that was extracted.

script.zs
// IEnergyStorage.extractEnergy(maxExtract as int, simulate as bool) as int;
myIEnergyStorage.extractEnergy(400, false);

Parameters:

maxExtract Type: int - The max amount of energy to be extracted.
simulate Type: bool - If the energy should actually be extracted or not.

Return Type: int

Getter
Gets the max energy that can be stored.
script.zs
// IEnergyStorage.maxEnergyStored as int
myIEnergyStorage.maxEnergyStored

Return Type: int

maxEnergyStored() as int
Gets the max energy that can be stored.

Returns: The max energy that can be stored.

script.zs
// IEnergyStorage.maxEnergyStored() as int;
myIEnergyStorage.maxEnergyStored();

Return Type: int

receiveEnergy(maxReceive as int, simulate as bool) as int
Adds energy to the storage.

Returns: the amount of energy that was accepted.

script.zs
// IEnergyStorage.receiveEnergy(maxReceive as int, simulate as bool) as int;
myIEnergyStorage.receiveEnergy(300, false);

Parameters:

maxReceive Type: int - The max amount of energy to be inserted.
simulate Type: bool - If the energy should actually be inserted or not.

Return Type: int