2015-07-15 00:19:44 +02:00
|
|
|
package cofh.api.energy;
|
|
|
|
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2015-07-15 00:19:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
|
|
|
* <p>
|
|
|
|
* A reference implementation is provided {@link TileEnergyHandler}.
|
|
|
|
*
|
|
|
|
* @author King Lemming
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
|
|
|
|
|
|
|
// merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
|
|
|
*
|
|
|
|
* @param from
|
|
|
|
* Orientation the energy is received from.
|
|
|
|
* @param maxReceive
|
|
|
|
* Maximum amount of energy to receive.
|
|
|
|
* @param simulate
|
|
|
|
* If TRUE, the charge will only be simulated.
|
|
|
|
* @return Amount of energy that was (or would have been, if simulated) received.
|
|
|
|
*/
|
|
|
|
@Override
|
2016-01-07 18:20:59 +01:00
|
|
|
int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
|
2015-07-15 00:19:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
|
|
|
*
|
|
|
|
* @param from
|
|
|
|
* Orientation the energy is extracted from.
|
|
|
|
* @param maxExtract
|
|
|
|
* Maximum amount of energy to extract.
|
|
|
|
* @param simulate
|
|
|
|
* If TRUE, the extraction will only be simulated.
|
|
|
|
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
|
|
|
*/
|
|
|
|
@Override
|
2016-01-07 18:20:59 +01:00
|
|
|
int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
|
2015-07-15 00:19:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the amount of energy currently stored.
|
|
|
|
*/
|
|
|
|
@Override
|
2016-01-07 18:20:59 +01:00
|
|
|
int getEnergyStored(EnumFacing from);
|
2015-07-15 00:19:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the maximum amount of energy that can be stored.
|
|
|
|
*/
|
|
|
|
@Override
|
2016-01-07 18:20:59 +01:00
|
|
|
int getMaxEnergyStored(EnumFacing from);
|
2015-07-15 00:19:44 +02:00
|
|
|
|
|
|
|
}
|