Fix when Mattery energy is exposed as Mekanism energy it ignore energy flow direction

Just like Mekanism for a long time ignored throughput limits when something charge its items through Forge Energy
This commit is contained in:
DBotThePony 2023-07-22 12:05:41 +07:00
parent d2c2fbd3d2
commit c887025a6c
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -170,11 +170,11 @@ class Mattery2MekanismEnergyWrapper(private val power: IMatteryEnergyStorage) :
override fun insertEnergy(container: Int, howMuch: FloatingLong, action: Action): FloatingLong { override fun insertEnergy(container: Int, howMuch: FloatingLong, action: Action): FloatingLong {
val copy = howMuch.copy() val copy = howMuch.copy()
return copy.minusEqual((power.receiveEnergy(howMuch.toDecimal() * Mekanism2MatteryEnergyWrapper.mekanism2MtJ, action.simulate()) * mtj2Mekanism).toFloatingLong()) return copy.minusEqual((power.receiveEnergyChecked(howMuch.toDecimal() * Mekanism2MatteryEnergyWrapper.mekanism2MtJ, action.simulate()) * mtj2Mekanism).toFloatingLong())
} }
override fun extractEnergy(container: Int, howMuch: FloatingLong, action: Action): FloatingLong { override fun extractEnergy(container: Int, howMuch: FloatingLong, action: Action): FloatingLong {
return (power.extractEnergy(howMuch.toDecimal() * Mekanism2MatteryEnergyWrapper.mekanism2MtJ, action.simulate()) * mtj2Mekanism).toFloatingLong() return (power.extractEnergyChecked(howMuch.toDecimal() * Mekanism2MatteryEnergyWrapper.mekanism2MtJ, action.simulate()) * mtj2Mekanism).toFloatingLong()
} }
} }