From 41422f4a66ac0646b4da7cfa6a1e6865174a27f4 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 16 Sep 2021 14:25:02 -0600 Subject: [PATCH] Fix #2478; make sure to use correct units when calculating fuel usage per tick (#2499) --- .../generator/BaseFluidGeneratorBlockEntity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java index ea9515ef9..fb3dbf7e1 100644 --- a/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java @@ -59,8 +59,8 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn protected long lastOutput = 0; /* - * We use this to keep track of fractional millibuckets, allowing us to hit - * our eu/bucket targets while still only ever removing integer millibucket + * We use this to keep track of fractional fluid units, allowing us to hit + * our eu/bucket targets while still only ever removing integer fluid unit * amounts. */ double pendingWithdraw = 0.0; @@ -110,10 +110,12 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn if (currentRecipe != null) { final int euPerBucket = currentRecipe.getEnergyPerBucket(); - final float millibucketsPerTick = euTick * 1000 / (float) euPerBucket; + + // Make sure to calculate the fluid used per tick based on the underlying fluid unit (droplets) + final float fluidPerTick = (euTick / (euPerBucket / (float)FluidValue.BUCKET.getRawValue())); if (tryAddingEnergy(euTick)) { - pendingWithdraw += millibucketsPerTick; + pendingWithdraw += fluidPerTick; final int currentWithdraw = (int) pendingWithdraw; pendingWithdraw -= currentWithdraw; tank.getFluidInstance().subtractAmount(FluidValue.fromRaw(currentWithdraw));