public class EnergyStorage extends java.lang.Object implements IEnergyStorage
IEnergyStorage
. Use/extend this or implement your own.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 |
---|---|
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 |
getMaxExtract() |
int |
getMaxReceive() |
void |
modifyEnergyStored(int energy)
This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage.
|
EnergyStorage |
readFromNBT(net.minecraft.nbt.NBTTagCompound nbt) |
int |
receiveEnergy(int maxReceive,
boolean simulate)
Adds energy to the storage.
|
void |
setCapacity(int capacity) |
void |
setEnergyStored(int energy)
This function is included to allow for server -> client sync.
|
void |
setMaxExtract(int maxExtract) |
void |
setMaxReceive(int maxReceive) |
void |
setMaxTransfer(int maxTransfer) |
net.minecraft.nbt.NBTTagCompound |
writeToNBT(net.minecraft.nbt.NBTTagCompound nbt) |
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 EnergyStorage readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
public net.minecraft.nbt.NBTTagCompound writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
public void setCapacity(int capacity)
public void setMaxTransfer(int maxTransfer)
public void setMaxReceive(int maxReceive)
public void setMaxExtract(int maxExtract)
public int getMaxReceive()
public int getMaxExtract()
public void setEnergyStored(int energy)
energy
- public void modifyEnergyStored(int energy)
energy
- 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