Updated to official RF API.

This commit is contained in:
GirafiStudios committed 2016-02-10 20:33:21 +01:00
1 parent d3e1bf80b4
commit ba944db343
4 files changed
+13 -64

No files matched your search

@@ -2,20 +2,21 @@ package cofh.api.energy;
import net.minecraft.util.EnumFacing;
/**
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
* accept it; otherwise just use IEnergyHandler.
* <p>
* Note that {@link IEnergyHandler} is an extension of this.
*
*
* @author King Lemming
*
*
*/
public interface IEnergyConnection {
/**
* Returns TRUE if the TileEntity can connect on a given side.
*/
boolean canConnectEnergy(EnumFacing facing);
boolean canConnectEnergy(EnumFacing from);
}
@@ -2,58 +2,26 @@ package cofh.api.energy;
import net.minecraft.util.EnumFacing;
/**
* 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}.
* <p>
* Note that {@link IEnergyReceiver} and {@link IEnergyProvider} are extensions of this.
*
* @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
int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate);
/**
* 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
int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate);
public interface IEnergyHandler extends IEnergyConnection {
/**
* Returns the amount of energy currently stored.
*/
@Override
int getEnergyStored(EnumFacing facing);
int getEnergyStored(EnumFacing from);
/**
* Returns the maximum amount of energy that can be stored.
*/
@Override
int getMaxEnergyStored(EnumFacing facing);
int getMaxEnergyStored(EnumFacing from);
}
@@ -11,7 +11,7 @@ import net.minecraft.util.EnumFacing;
* @author King Lemming
*
*/
public interface IEnergyProvider extends IEnergyConnection {
public interface IEnergyProvider extends IEnergyHandler {
/**
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
@@ -24,16 +24,6 @@ public interface IEnergyProvider extends IEnergyConnection {
* If TRUE, the extraction will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted.
*/
int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(EnumFacing facing);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(EnumFacing facing);
int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
}
@@ -11,7 +11,7 @@ import net.minecraft.util.EnumFacing;
* @author King Lemming
*
*/
public interface IEnergyReceiver extends IEnergyConnection {
public interface IEnergyReceiver extends IEnergyHandler {
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
@@ -24,16 +24,6 @@ public interface IEnergyReceiver extends IEnergyConnection {
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(EnumFacing facing);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(EnumFacing facing);
int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
}