@@ -64,6 +64,10 @@ public class FuelBurningComponent implements IComponent {
6464 * Buffer of EU that was burnt already, and is awaiting to be turned into heat.
6565 */
6666 private long burningEuBuffer ;
67+ /**
68+ * Total EU of the currently burning item. If 0 it means that we are burning fluid instead.
69+ */
70+ private long burningItemTotalEu ;
6771
6872 public FuelBurningComponent (TemperatureComponent temperature , long maxEuProduction , long euPerDegree , long burningEuMultiplier ) {
6973 this .temperature = temperature ;
@@ -88,15 +92,20 @@ public boolean isBurning() {
8892 return burningEuBuffer > 0 ;
8993 }
9094
91- public void disable () {
95+ public void clearActiveFuel () {
9296 burningEuBuffer = 0 ;
97+ burningItemTotalEu = 0 ;
9398 }
9499
95100 public double getBurningProgress () {
96- return Math .min (1.0 , (double ) burningEuBuffer / (5 * 20 * maxEuProduction ));
101+ if (burningItemTotalEu == 0 ) {
102+ return Math .min (1.0 , (double ) burningEuBuffer / (5 * 20 * maxEuProduction ));
103+ } else {
104+ return Math .min (1.0 , (double ) burningEuBuffer / burningItemTotalEu );
105+ }
97106 }
98107
99- public void tick (List <ConfigurableItemStack > itemInputs , List <ConfigurableFluidStack > fluidInputs ) {
108+ public void tick (List <ConfigurableItemStack > itemInputs , List <ConfigurableFluidStack > fluidInputs , boolean canConsumeNewFuel ) {
100109 // Turn buffer into heat
101110 long maxEuInsertion = Math .min (burningEuBuffer , maxEuProduction );
102111
@@ -109,6 +118,10 @@ public void tick(List<ConfigurableItemStack> itemInputs, List<ConfigurableFluidS
109118 temperature .decreaseTemperature (1 );
110119 }
111120
121+ if (!canConsumeNewFuel ) {
122+ return ;
123+ }
124+
112125 // Refill buffer with item fuel
113126 outer : while (burningEuBuffer < maxEuProduction ) {
114127 // Find first item fuel
@@ -117,7 +130,9 @@ public void tick(List<ConfigurableItemStack> itemInputs, List<ConfigurableFluidS
117130 if (ItemStackHelper .consumeFuel (stack , true )) {
118131 int fuelTime = fuel .getBurnTime (null );
119132 if (fuelTime > 0 ) {
120- burningEuBuffer += fuelTime * EU_PER_BURN_TICK * burningEuMultiplier ;
133+ long fuelTotalEu = fuelTime * EU_PER_BURN_TICK * burningEuMultiplier ;
134+ burningEuBuffer += fuelTotalEu ;
135+ burningItemTotalEu = fuelTotalEu ;
121136 ItemStackHelper .consumeFuel (stack , false );
122137 continue outer ;
123138 }
@@ -137,6 +152,7 @@ public void tick(List<ConfigurableItemStack> itemInputs, List<ConfigurableFluidS
137152 if (mbConsumed > 0 ) {
138153 stack .decrement (mbConsumed );
139154 burningEuBuffer += mbConsumed * euPerMb ;
155+ burningItemTotalEu = 0 ;
140156 continue outer ;
141157 }
142158 }
@@ -149,12 +165,15 @@ public void tick(List<ConfigurableItemStack> itemInputs, List<ConfigurableFluidS
149165 @ Override
150166 public void writeNbt (CompoundTag tag , HolderLookup .Provider registries ) {
151167 tag .putLong ("burningEuBuffer" , burningEuBuffer );
152-
168+ if (burningItemTotalEu != 0 ) {
169+ tag .putLong ("burningItemTotalEu" , burningItemTotalEu );
170+ }
153171 }
154172
155173 @ Override
156174 public void readNbt (CompoundTag tag , HolderLookup .Provider registries , boolean isUpgradingMachine ) {
157175 burningEuBuffer = tag .getLong ("burningEuBuffer" );
176+ burningItemTotalEu = tag .getLong ("burningItemTotalEu" );
158177 }
159178
160179 public List <Component > getTooltips () {
0 commit comments