Fixed some power math

This commit is contained in:
DarkGuardsman 2013-07-08 01:28:37 -04:00
parent 0db6bb803d
commit 30161f90f1
2 changed files with 2 additions and 9 deletions

View file

@ -245,12 +245,6 @@ public class NetworkPowerTiles extends NetworkTileEntities implements IElectrici
ElectricityPack totalRequest = this.getRequestWithoutReduction();
totalElectricity.amperes *= (tileRequest.amperes / totalRequest.amperes);
double ampsReceived = totalElectricity.amperes;
double voltsReceived = totalElectricity.voltage;
totalElectricity.amperes = ampsReceived;
totalElectricity.voltage = voltsReceived;
return totalElectricity;
}
}

View file

@ -179,15 +179,14 @@ public abstract class TileEntityRunnableMachine extends TileEntityElectrical imp
/** Requests an even amount of electricity from all sides. */
double wattsPerSide = (requestPack.getWatts() / connectedNetworks.size());
double voltage = requestPack.voltage;
/*TODO change this out to calculate if the network on each side can handle a larger request than another network to evenly distribute drain rather than asked the same of a network they may not be able to put out a larger amount*/
for (IElectricityNetwork network : connectedNetworks)
{
if (wattsPerSide > 0 && requestPack.getWatts() > 0)
{
network.startRequesting(tileEntity, wattsPerSide / voltage, voltage);
ElectricityPack receivedPack = network.consumeElectricity(tileEntity);
consumedPack.amperes += receivedPack.amperes;
consumedPack.voltage = Math.max(consumedPack.voltage, receivedPack.voltage);
consumedPack = ElectricityPack.getFromWatts(consumedPack.getWatts() + receivedPack.getWatts(), Math.max(consumedPack.voltage, receivedPack.voltage));
}
else
{