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 net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cofh.api.energy.IEnergyConnection;
|
import cofh.api.energy.IEnergyConnection;
|
||||||
import cofh.api.energy.IEnergyHandler;
|
import cofh.api.energy.IEnergyHandler;
|
||||||
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.api.power.IEngine;
|
import buildcraft.api.power.IEngine;
|
||||||
import buildcraft.api.tiles.IHeatable;
|
import buildcraft.api.tiles.IHeatable;
|
||||||
|
@ -294,6 +295,13 @@ public abstract class TileEngine extends TileBuildCraft implements IPipeConnecti
|
||||||
} else if (tile instanceof IEnergyHandler) {
|
} else if (tile instanceof IEnergyHandler) {
|
||||||
IEnergyHandler handler = (IEnergyHandler) tile;
|
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(
|
int maxEnergy = handler.receiveEnergy(
|
||||||
orientation.getOpposite(),
|
orientation.getOpposite(),
|
||||||
this.energy, true);
|
this.energy, true);
|
||||||
|
@ -328,7 +336,14 @@ public abstract class TileEngine extends TileBuildCraft implements IPipeConnecti
|
||||||
extracted, false);
|
extracted, false);
|
||||||
|
|
||||||
extractEnergy(neededRF, true);
|
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;
|
return false;
|
||||||
} else if (tile instanceof IEngine) {
|
} else if (tile instanceof IEngine) {
|
||||||
return ((IEngine) tile).canReceiveFromEngine(side.getOpposite());
|
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());
|
return ((IEnergyConnection) tile).canConnectEnergy(side.getOpposite());
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue