Energy Converters

Energy Converters

10M Downloads

MJ Producer draws far too much power

vladmarica opened this issue ยท 2 comments

commented

I was testing out my Energy Meters mod using this mod to generate MJ and I noticed that the MJ Producer draws far too much power from the Energy Bridge.

The Problem

If the Energy Bridge is full and the MJ Producer is connected to an IMjReceiver that requests 2 MJ, it will supply the 2 MJ and use up all of the energy in the bridge in a single tick. This problem is caused by this segment:

long available = (long)Math.min(this.getBridgeEnergyStored() / EnergyConvertersConfig.mjConversion * MjAPI.MJ, requested);
long taken = receiver.receivePower(available, false);
this.retrieveEnergyFromBridge(available - taken, false);

available - taken is an MJ value, it needs to be scaled down to Energy Bridge units before calling retrieveEnergyFromBridge.

commented

i could swear I've fixed this bug in the past >_> Thank you for your contribution.

commented

Ah, I see, you had previously fixed a similar issue with the MJ Consumer. I guess this solves the problem on the Producer side. Thanks for accepting my PR!