public class EnergyStorage extends java.lang.Object implements IEnergyStorage
IEnergyStorage
. Use/extend this or implement your own.
Derived from the Redstone Flux power system designed by King Lemming and originally utilized in Thermal Expansion and related mods.
Created with consent and permission of King Lemming and Team CoFH. Released with permission under LGPL 2.1 when bundled with Forge.Modifier and Type | Field and Description |
---|---|
protected int |
capacity |
protected int |
energy |
protected int |
maxExtract |
protected int |
maxReceive |
Constructor and Description |
---|
EnergyStorage(int capacity) |
EnergyStorage(int capacity,
int maxTransfer) |
EnergyStorage(int capacity,
int maxReceive,
int maxExtract) |
Modifier and Type | Method and Description |
---|---|
boolean |
canExtract()
Returns if this storage can have energy extracted.
|
boolean |
canReceive()
Used to determine if this storage can receive energy.
|
int |
extractEnergy(int maxExtract,
boolean simulate)
Removes energy from the storage.
|
int |
getEnergyStored()
Returns the amount of energy currently stored.
|
int |
getMaxEnergyStored()
Returns the maximum amount of energy that can be stored.
|
int |
receiveEnergy(int maxReceive,
boolean simulate)
Adds energy to the storage.
|
protected int energy
protected int capacity
protected int maxReceive
protected int maxExtract
public EnergyStorage(int capacity)
public EnergyStorage(int capacity, int maxTransfer)
public EnergyStorage(int capacity, int maxReceive, int maxExtract)
public int receiveEnergy(int maxReceive, boolean simulate)
IEnergyStorage
receiveEnergy
in interface IEnergyStorage
maxReceive
- Maximum amount of energy to be inserted.simulate
- If TRUE, the insertion will only be simulated.public int extractEnergy(int maxExtract, boolean simulate)
IEnergyStorage
extractEnergy
in interface IEnergyStorage
maxExtract
- Maximum amount of energy to be extracted.simulate
- If TRUE, the extraction will only be simulated.public int getEnergyStored()
IEnergyStorage
getEnergyStored
in interface IEnergyStorage
public int getMaxEnergyStored()
IEnergyStorage
getMaxEnergyStored
in interface IEnergyStorage
public boolean canExtract()
IEnergyStorage
canExtract
in interface IEnergyStorage
public boolean canReceive()
IEnergyStorage
canReceive
in interface IEnergyStorage