fix engines for new RF API
This commit is contained in:
parent
1d863e4718
commit
94f4787ab7
1 changed files with 17 additions and 2 deletions
|
@ -17,6 +17,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import buildcraft.api.power.IEngine;
|
||||
import buildcraft.api.tiles.IHeatable;
|
||||
|
@ -294,6 +295,13 @@ public abstract class TileEngine extends TileBuildCraft implements IPipeConnecti
|
|||
} else if (tile instanceof IEnergyHandler) {
|
||||
IEnergyHandler handler = (IEnergyHandler) tile;
|
||||
|
||||
int maxEnergy = handler.receiveEnergy(
|
||||
orientation.getOpposite(),
|
||||
this.energy, true);
|
||||
return extractEnergy(maxEnergy, false);
|
||||
} else if (tile instanceof IEnergyReceiver) {
|
||||
IEnergyReceiver handler = (IEnergyReceiver) tile;
|
||||
|
||||
int maxEnergy = handler.receiveEnergy(
|
||||
orientation.getOpposite(),
|
||||
this.energy, true);
|
||||
|
@ -327,6 +335,13 @@ public abstract class TileEngine extends TileBuildCraft implements IPipeConnecti
|
|||
orientation.getOpposite(),
|
||||
extracted, false);
|
||||
|
||||
extractEnergy(neededRF, true);
|
||||
} else if (tile instanceof IEnergyReceiver) {
|
||||
IEnergyReceiver handler = (IEnergyReceiver) tile;
|
||||
int neededRF = handler.receiveEnergy(
|
||||
orientation.getOpposite(),
|
||||
extracted, false);
|
||||
|
||||
extractEnergy(neededRF, true);
|
||||
}
|
||||
}
|
||||
|
@ -511,7 +526,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPipeConnecti
|
|||
return false;
|
||||
} else if (tile instanceof IEngine) {
|
||||
return ((IEngine) tile).canReceiveFromEngine(side.getOpposite());
|
||||
} else if (tile instanceof IEnergyHandler) {
|
||||
} else if (tile instanceof IEnergyHandler || tile instanceof IEnergyReceiver) {
|
||||
return ((IEnergyConnection) tile).canConnectEnergy(side.getOpposite());
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue