Fixed some power math
This commit is contained in:
parent
0db6bb803d
commit
30161f90f1
2 changed files with 2 additions and 9 deletions
|
@ -245,12 +245,6 @@ public class NetworkPowerTiles extends NetworkTileEntities implements IElectrici
|
||||||
ElectricityPack totalRequest = this.getRequestWithoutReduction();
|
ElectricityPack totalRequest = this.getRequestWithoutReduction();
|
||||||
totalElectricity.amperes *= (tileRequest.amperes / totalRequest.amperes);
|
totalElectricity.amperes *= (tileRequest.amperes / totalRequest.amperes);
|
||||||
|
|
||||||
double ampsReceived = totalElectricity.amperes;
|
|
||||||
double voltsReceived = totalElectricity.voltage;
|
|
||||||
|
|
||||||
totalElectricity.amperes = ampsReceived;
|
|
||||||
totalElectricity.voltage = voltsReceived;
|
|
||||||
|
|
||||||
return totalElectricity;
|
return totalElectricity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,15 +179,14 @@ public abstract class TileEntityRunnableMachine extends TileEntityElectrical imp
|
||||||
/** Requests an even amount of electricity from all sides. */
|
/** Requests an even amount of electricity from all sides. */
|
||||||
double wattsPerSide = (requestPack.getWatts() / connectedNetworks.size());
|
double wattsPerSide = (requestPack.getWatts() / connectedNetworks.size());
|
||||||
double voltage = requestPack.voltage;
|
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)
|
for (IElectricityNetwork network : connectedNetworks)
|
||||||
{
|
{
|
||||||
if (wattsPerSide > 0 && requestPack.getWatts() > 0)
|
if (wattsPerSide > 0 && requestPack.getWatts() > 0)
|
||||||
{
|
{
|
||||||
network.startRequesting(tileEntity, wattsPerSide / voltage, voltage);
|
network.startRequesting(tileEntity, wattsPerSide / voltage, voltage);
|
||||||
ElectricityPack receivedPack = network.consumeElectricity(tileEntity);
|
ElectricityPack receivedPack = network.consumeElectricity(tileEntity);
|
||||||
consumedPack.amperes += receivedPack.amperes;
|
consumedPack = ElectricityPack.getFromWatts(consumedPack.getWatts() + receivedPack.getWatts(), Math.max(consumedPack.voltage, receivedPack.voltage));
|
||||||
consumedPack.voltage = Math.max(consumedPack.voltage, receivedPack.voltage);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue