Calculate fluid operations using Longs
This commit is contained in:
parent
ddaa0dafe5
commit
3a813d4353
@ -50,7 +50,7 @@ abstract class AbstractMatteryFluidHandler : IFluidHandler {
|
||||
val fluid = fluid
|
||||
|
||||
if (fluid.isEmpty || fluid.isFluidEqual(resource)) {
|
||||
val new = (fluid.amount + resource.amount).coerceAtMost(capacity)
|
||||
val new = (fluid.amount.toLong() + resource.amount.toLong()).coerceAtMost(capacity.toLong()).toInt()
|
||||
if (new <= fluid.amount) return 0
|
||||
|
||||
if (action.execute()) {
|
||||
@ -86,7 +86,7 @@ abstract class AbstractMatteryFluidHandler : IFluidHandler {
|
||||
if (fluid.isEmpty) {
|
||||
return FluidStack.EMPTY
|
||||
} else {
|
||||
val new = (fluid.amount - maxDrain).coerceAtLeast(0)
|
||||
val new = (fluid.amount.toLong() - maxDrain.toLong()).coerceAtLeast(0L).toInt()
|
||||
|
||||
if (action.execute()) {
|
||||
if (new == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user