Package net.minecraftforge.energy
Class EnergyStorage
java.lang.Object
net.minecraftforge.energy.EnergyStorage
- All Implemented Interfaces:
- INBTSerializable<Tag>,- IEnergyStorage
Reference implementation of 
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.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intprotected int
- 
Constructor SummaryConstructorsConstructorDescriptionEnergyStorage(int capacity) EnergyStorage(int capacity, int maxTransfer) EnergyStorage(int capacity, int maxReceive, int maxExtract) EnergyStorage(int capacity, int maxReceive, int maxExtract, int energy) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns if this storage can have energy extracted.booleanUsed to determine if this storage can receive energy.voiddeserializeNBT(Tag nbt) intextractEnergy(int maxExtract, boolean simulate) Removes energy from the storage.intReturns the amount of energy currently stored.intReturns the maximum amount of energy that can be stored.intreceiveEnergy(int maxReceive, boolean simulate) Adds energy to the storage.
- 
Field Details- 
energyprotected int energy
- 
capacityprotected int capacity
- 
maxReceiveprotected int maxReceive
- 
maxExtractprotected int maxExtract
 
- 
- 
Constructor Details- 
EnergyStoragepublic EnergyStorage(int capacity) 
- 
EnergyStoragepublic EnergyStorage(int capacity, int maxTransfer) 
- 
EnergyStoragepublic EnergyStorage(int capacity, int maxReceive, int maxExtract) 
- 
EnergyStoragepublic EnergyStorage(int capacity, int maxReceive, int maxExtract, int energy) 
 
- 
- 
Method Details- 
receiveEnergypublic int receiveEnergy(int maxReceive, boolean simulate) Description copied from interface:IEnergyStorageAdds energy to the storage. Returns quantity of energy that was accepted.- Specified by:
- receiveEnergyin interface- IEnergyStorage
- Parameters:
- maxReceive- Maximum amount of energy to be inserted.
- simulate- If TRUE, the insertion will only be simulated.
- Returns:
- Amount of energy that was (or would have been, if simulated) accepted by the storage.
 
- 
extractEnergypublic int extractEnergy(int maxExtract, boolean simulate) Description copied from interface:IEnergyStorageRemoves energy from the storage. Returns quantity of energy that was removed.- Specified by:
- extractEnergyin interface- IEnergyStorage
- Parameters:
- maxExtract- Maximum amount of energy to be extracted.
- simulate- If TRUE, the extraction will only be simulated.
- Returns:
- Amount of energy that was (or would have been, if simulated) extracted from the storage.
 
- 
getEnergyStoredpublic int getEnergyStored()Description copied from interface:IEnergyStorageReturns the amount of energy currently stored.- Specified by:
- getEnergyStoredin interface- IEnergyStorage
 
- 
getMaxEnergyStoredpublic int getMaxEnergyStored()Description copied from interface:IEnergyStorageReturns the maximum amount of energy that can be stored.- Specified by:
- getMaxEnergyStoredin interface- IEnergyStorage
 
- 
canExtractpublic boolean canExtract()Description copied from interface:IEnergyStorageReturns if this storage can have energy extracted. If this is false, then any calls to extractEnergy will return 0.- Specified by:
- canExtractin interface- IEnergyStorage
 
- 
canReceivepublic boolean canReceive()Description copied from interface:IEnergyStorageUsed to determine if this storage can receive energy. If this is false, then any calls to receiveEnergy will return 0.- Specified by:
- canReceivein interface- IEnergyStorage
 
- 
serializeNBT- Specified by:
- serializeNBTin interface- INBTSerializable<Tag>
 
- 
deserializeNBT- Specified by:
- deserializeNBTin interface- INBTSerializable<Tag>
 
 
-