public class EnergyBank extends java.lang.Object implements IEnergyHolder, IEnergyProvider, IEnergyReceiver
Modifier and Type | Field and Description |
---|---|
protected int |
currentStored |
static java.lang.String |
ENERGY_CAPACITY_NBT_TAG |
protected static java.lang.String |
ENERGY_MAX_EXTRACT_NBT_TAG |
protected static java.lang.String |
ENERGY_MAX_RECIEVE_NBT_TAG |
static java.lang.String |
ENERGY_NBT_TAG
NBT *
|
protected int |
maxExtract |
protected int |
maxInsert |
protected int |
maxStored |
Constructor and Description |
---|
EnergyBank(int size)
Simplest constructor of EnergyBank
|
EnergyBank(int size,
int maxIn,
int maxOut)
Constructor for EnergyBank
|
EnergyBank(int initialStored,
int maxStorage,
int maxIn,
int maxOut)
The main constructor for EnergyBank
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentStored()
Get the current energy stored
|
int |
getEnergyStored()
Get current energy stored
|
int |
getMaxEnergyStored()
The max amount of energy this object can hold
|
int |
getMaxExtract()
Get the max extract rate
|
int |
getMaxInsert()
Get the max receive rate
|
int |
getMaxStored()
Get the max energy stored
|
int |
providePower(int maxOut,
boolean doDrain)
The amount of power this object can provide
|
void |
readFromNBT(net.minecraft.nbt.CompoundNBT tag)
Read from the tag
|
int |
receivePower(int incomingPower,
boolean doFill)
Allow the object to receive power
|
void |
setCurrentStored(int currentStored)
Set the current energy stored
|
void |
setMaxExtract(int maxExtract)
Set the max extract
|
void |
setMaxInsert(int maxInsert)
Set the max insert rate
|
void |
setMaxStored(int maxStored)
Set the max energy stored
|
net.minecraft.nbt.CompoundNBT |
writeToNBT(net.minecraft.nbt.CompoundNBT tag)
Save to tag
|
protected int currentStored
protected int maxStored
protected int maxInsert
protected int maxExtract
public static final java.lang.String ENERGY_NBT_TAG
public static final java.lang.String ENERGY_CAPACITY_NBT_TAG
protected static final java.lang.String ENERGY_MAX_RECIEVE_NBT_TAG
protected static final java.lang.String ENERGY_MAX_EXTRACT_NBT_TAG
public EnergyBank(int size)
size
- The max stored, also sets max in and outpublic EnergyBank(int size, int maxIn, int maxOut)
size
- The max energy storedmaxIn
- The max energy in ratemaxOut
- The max energy out ratepublic EnergyBank(int initialStored, int maxStorage, int maxIn, int maxOut)
initialStored
- The initial value of the stored energymaxStorage
- The max amount of energy storedmaxIn
- The max insert ratemaxOut
- The max extract ratepublic int getCurrentStored()
public void setCurrentStored(int currentStored)
currentStored
- The new current storedpublic int getMaxStored()
public void setMaxStored(int maxStored)
maxStored
- The max energy storedpublic int getMaxInsert()
public void setMaxInsert(int maxInsert)
maxInsert
- The max insert ratepublic int getMaxExtract()
public void setMaxExtract(int maxExtract)
maxExtract
- The max extractpublic int getEnergyStored()
getEnergyStored
in interface IEnergyHolder
public int getMaxEnergyStored()
getMaxEnergyStored
in interface IEnergyHolder
public int receivePower(int incomingPower, boolean doFill)
receivePower
in interface IEnergyReceiver
incomingPower
- The amount of power sentdoFill
- True to fill, false to simulatepublic int providePower(int maxOut, boolean doDrain)
providePower
in interface IEnergyProvider
maxOut
- The max amount to extractdoDrain
- True to drain, false to simulatepublic net.minecraft.nbt.CompoundNBT writeToNBT(net.minecraft.nbt.CompoundNBT tag)
tag
- The incoming tagpublic void readFromNBT(net.minecraft.nbt.CompoundNBT tag)
tag
- The written tag