diff --git a/src/api/java/cofh/api/energy/IEnergyConnection.java b/src/api/java/cofh/api/energy/IEnergyConnection.java index 65c64d31f..29ef0a1ce 100644 --- a/src/api/java/cofh/api/energy/IEnergyConnection.java +++ b/src/api/java/cofh/api/energy/IEnergyConnection.java @@ -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. *
* 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); } diff --git a/src/api/java/cofh/api/energy/IEnergyHandler.java b/src/api/java/cofh/api/energy/IEnergyHandler.java index a25517c4a..16b236e7a 100644 --- a/src/api/java/cofh/api/energy/IEnergyHandler.java +++ b/src/api/java/cofh/api/energy/IEnergyHandler.java @@ -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. *
* A reference implementation is provided {@link TileEnergyHandler}. + *
+ * 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);
}
diff --git a/src/api/java/cofh/api/energy/IEnergyProvider.java b/src/api/java/cofh/api/energy/IEnergyProvider.java
index 12ec6f4aa..ef0e09d06 100644
--- a/src/api/java/cofh/api/energy/IEnergyProvider.java
+++ b/src/api/java/cofh/api/energy/IEnergyProvider.java
@@ -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);
}
diff --git a/src/api/java/cofh/api/energy/IEnergyReceiver.java b/src/api/java/cofh/api/energy/IEnergyReceiver.java
index b1a9e57cd..989e9baa5 100644
--- a/src/api/java/cofh/api/energy/IEnergyReceiver.java
+++ b/src/api/java/cofh/api/energy/IEnergyReceiver.java
@@ -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);
}
diff --git a/src/main/java/vazkii/botania/common/Botania.java b/src/main/java/vazkii/botania/common/Botania.java
index ae4180d54..5f60f9d81 100644
--- a/src/main/java/vazkii/botania/common/Botania.java
+++ b/src/main/java/vazkii/botania/common/Botania.java
@@ -52,6 +52,7 @@ public class Botania {
public static boolean bloodMagicLoaded = false;
public static boolean coloredLightsLoaded = false;
public static boolean etFuturumLoaded = false;
+ public static boolean rfApiLoaded = false;
public static ILightHelper lightHelper;
@@ -70,6 +71,7 @@ public class Botania {
bloodMagicLoaded = Loader.isModLoaded("AWWayofTime"); // Psh, noob
coloredLightsLoaded = Loader.isModLoaded("easycoloredlights");
etFuturumLoaded = Loader.isModLoaded("etfuturum");
+ rfApiLoaded = ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy");
lightHelper = coloredLightsLoaded ? new LightHelperColored() : new LightHelperVanilla();
diff --git a/src/main/java/vazkii/botania/common/block/tile/mana/TileRFGenerator.java b/src/main/java/vazkii/botania/common/block/tile/mana/TileRFGenerator.java
index 923e21b49..d11011894 100644
--- a/src/main/java/vazkii/botania/common/block/tile/mana/TileRFGenerator.java
+++ b/src/main/java/vazkii/botania/common/block/tile/mana/TileRFGenerator.java
@@ -14,12 +14,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraftforge.fml.common.Loader;
+import net.minecraftforge.fml.common.ModAPIManager;
+import net.minecraftforge.fml.common.Optional;
import vazkii.botania.api.mana.IManaReceiver;
+import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileMod;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyReceiver;
-import net.minecraftforge.fml.common.Optional;
import java.util.EnumMap;
import java.util.Map;
@@ -31,11 +32,10 @@ public class TileRFGenerator extends TileMod implements IManaReceiver, IEnergyCo
private static final int MAX_MANA = 1280 * CONVERSION_RATE;
private static final String TAG_MANA = "mana";
-
int mana = 0;
// Thanks to skyboy for help with this cuz I'm a noob with RF
- private EnumMap