Create: Diesel Generators

Create: Diesel Generators

3M Downloads

[1.20.1-1.3.4] Fuel Customization causes modular engine output 0 SU

wanquanw opened this issue ยท 7 comments

commented

1.20.1-1.3.4, using Kubejs to load datapack and customize gasoline.
This would cause modular engine consume gasoline with working sound effects, but outputs 0 su.
Normal engine works well and output 12288su.

I'm trying to look deeper into it, will update if I find anything new.
-> modify burn_rate (0.05 -> 2) causes this problem <-

{
  "fluid": "#forge:gasoline",
  "sound_pitch": 0.9,
  "normal": {
    "speed": 96,
    "strength": 12288,
    "burn_rate": 2
  },
  "modular": {
    "speed": 96,
    "strength": 24576,
    "burn_rate": 2
  },
  "huge": {
    "speed": 96,
    "strength": 24576,
    "burn_rate": 1
  },
  "burner_multiplier": 1.0
}

latests.log (I failed to find useful info) : https://mclo.gs/0EHujrc

minimum mod set to reproduce:
create-1.20.1-6.0.6.jar
createdieselgenerators-1.20.1-1.3.4.jar
kubejs-forge-2001.6.5-build.16.jar (rhino-forge-2001.2.3-build.10.jar & architectury-9.2.14-forge.jar)

commented

Update5:
burn_rate 1.0 fails, 0.8 works

commented

Update1:
Changing modular engine strength to 12288 won't work.

commented

Update2:
Use datapack directly copied from original mod works well.

commented

Update3:
Only modify strength works (6144 -> 12288)

{
  "fluid": "#forge:gasoline",
  "sound_pitch": 1,
  "normal": {
    "speed": 96.0,
    "strength": 4096.0,
    "burn_rate": 0.05
  },
  "modular": {
    "speed": 96.0,
    "strength": 12288.0,
    "burn_rate": 0.05
  },
  "huge": {
    "speed": 224.0,
    "strength": 12288.0,
    "burn_rate": 0.05
  },
  "burner_multiplier": 1.1
}
commented

Update4:
Only modify burn_rate fails (0.05 -> 2)

{
  "fluid": "#forge:gasoline",
  "sound_pitch": 1,
  "normal": {
    "speed": 96.0,
    "strength": 4096.0,
    "burn_rate": 0.05
  },
  "modular": {
    "speed": 96.0,
    "strength": 6144.0,
    "burn_rate": 2
  },
  "huge": {
    "speed": 224.0,
    "strength": 12288.0,
    "burn_rate": 0.05
  },
  "burner_multiplier": 1.1
}
commented

code analysis:
the major code contributed to this issue is here:

if (enabled()) {
if (remainingTicks < length + 1) {
remainingTicks += length / getFuelBurnRate();
tankInventory.drain(length, IFluidHandler.FluidAction.EXECUTE);
}
if (remainingTicks >= 0)
remainingTicks -= length;
}

where length refers to the length of the modular diesel engine.
When the remaining tick is smaller than length, it will consume fuels and refuel remaining ticks. Then remaining tick will be subtracted by length. However, since remaining tick refueled is scaled up (or down) by the burn rate, if the burn rate of the fuel >= 1, remaining ticks refueled will be immediately, fully consumed, making remaining ticks never reach above zero. That's why if a fuel has a burn rate no less than 1 there will be no speed generated.

commented

More code analysis: prior to 1.3.3, the value of burn_rate refers to the amount of fuel to be consumed by diesel engine / modular diesel engine of length 1 every 20 tick. Starting with 1.3.3, burn_rate refers to the amount of fuel to be consumed per tick.