RF wires fix.

This commit is contained in:
Dragon2488 2016-07-22 01:46:43 +07:00
parent 74e0c3669f
commit fe64b8ccf7

View file

@ -1,5 +1,6 @@
package techreborn.parts.powerCables;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver;
import ic2.api.energy.tile.*;
@ -219,8 +220,10 @@ public class CableMultipart extends Multipart
} else if(tile instanceof IEnergyProducerTile &&
((IEnergyProducerTile) tile).canProvideEnergy(facing)) {
return true;
} else if (tile instanceof IEnergyReceiver &&
((IEnergyReceiver) tile).canConnectEnergy(facing) &&
} else if ((tile instanceof IEnergyProvider ||
tile instanceof IEnergyReceiver ||
tile instanceof cofh.api.energy.IEnergyStorage) &&
((IEnergyConnection) tile).canConnectEnergy(facing) &&
RebornCoreConfig.getRebornPower().rf()) {
return true;
} else if (Loader.isModLoaded("IC2") &&
@ -230,7 +233,8 @@ public class CableMultipart extends Multipart
tile instanceof IEnergyAcceptor)) {
return true;
} else if (Loader.isModLoaded("Tesla") &&
tile.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, facing)) {
tile.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, facing) ||
tile.hasCapability(TeslaCapabilities.CAPABILITY_PRODUCER, facing)) {
return true;
}
}
@ -297,8 +301,8 @@ public class CableMultipart extends Multipart
EnumFacing opposite = connection.getOpposite();
//TODO rewrite for new version
if(tileEntity instanceof IEnergyInterfaceTile) {
IEnergyInterfaceTile interfaceTile = (IEnergyInterfaceTile) tileEntity;
if(tileEntity instanceof IEnergyProducerTile) {
IEnergyProducerTile interfaceTile = (IEnergyProducerTile) tileEntity;
if(interfaceTile.canProvideEnergy(opposite)) {
double extractedEU = interfaceTile.useEnergy(getCableType().transferRate, true);
double dispatched = EnergyUtils.dispatchWiresEnergyPacket(getWorld(), getPos(), extractedEU, blockPos);