Импорт класса

Link to импорт-класса

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.capability.IEnergyStorage;

Name: canExtract

Checks if energy can be extracted from this storage.

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

ZenScript
Copy
// IEnergyStorage.canExtract() as boolean

myIEnergyStorage.canExtract();

Name: canReceive

Checks if this storage can receive energy.

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

ZenScript
Copy
// IEnergyStorage.canReceive() as boolean

myIEnergyStorage.canReceive();

Name: extractEnergy

Extracts energy from the storage.

Returns: the amount of energy that was extracted.
Return Type: int

ZenScript
Copy
// IEnergyStorage.extractEnergy(maxExtract as int, simulate as boolean) as int

myIEnergyStorage.extractEnergy(400, false);
ПараметрТипОписание
Параметр
maxExtract
Тип
int
Описание
The max amount of energy to be extracted.
Параметр
simulate
Тип
boolean
Описание
If the energy should actually be extracted or not.

Name: getEnergyStored

Gets the amount of energy stored.

Returns: The amount of energy stored.
Return Type: int

ZenScript
Copy
// IEnergyStorage.getEnergyStored() as int

myIEnergyStorage.getEnergyStored();

Link to getMaxEnergyStored

Name: getMaxEnergyStored

Gets the max energy that can be stored.

Returns: The max energy that can be stored.
Return Type: int

ZenScript
Copy
// IEnergyStorage.getMaxEnergyStored() as int

myIEnergyStorage.getMaxEnergyStored();

Name: receiveEnergy

Adds energy to the storage.

Returns: the amount of energy that was accepted.
Return Type: int

ZenScript
Copy
// IEnergyStorage.receiveEnergy(maxReceive as int, simulate as boolean) as int

myIEnergyStorage.receiveEnergy(300, false);
ПараметрТипОписание
Параметр
maxReceive
Тип
int
Описание
The max amount of energy to be inserted.
Параметр
simulate
Тип
boolean
Описание
If the energy should actually be inserted or not.

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
canExtract
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if energy can be extracted from this storage.
Название
canReceive
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if this storage can receive energy.
Название
energyStored
Тип
int
Имеет Getter
true
Имеет Setter
false
Описание
Gets the amount of energy stored.
Название
maxEnergyStored
Тип
int
Имеет Getter
true
Имеет Setter
false
Описание
Gets the max energy that can be stored.