Program: 171527
Project: 171527
Buggy source:
@Override public void onUpdate(){
  super.onUpdate();
  if (world.isRemote) {
    boolean hasFuel=(this.getLiquidAmount() > 0 || !Config.isFuelRequired(gauge));
    if (ConfigSound.soundEnabled) {
      if (this.horn == null) {
        this.horn=ImmersiveRailroading.proxy.newSound(this.getDefinition().horn,false,100,gauge);
        this.idle=ImmersiveRailroading.proxy.newSound(this.getDefinition().idle,true,80,gauge);
      }
      if (hasFuel) {
        if (!idle.isPlaying() && getTurnedOn()) {
          this.idle.play(getPositionVector());
        }
        if (idle.isPlaying() && getTurnedOn() == false) {
          idle.stop();
        }
      }
 else {
        if (idle.isPlaying()) {
          idle.stop();
        }
      }
      if (this.getDataManager().get(HORN) != 0 && !horn.isPlaying()) {
        horn.play(getPositionVector());
      }
      float absThrottle=Math.abs(this.getThrottle());
      if (this.soundThrottle > absThrottle && getEngineTemperature() > 70 && getTurnedOn()) {
        this.soundThrottle-=Math.min(0.01f,this.soundThrottle - absThrottle);
      }
 else       if (this.soundThrottle < absThrottle && getEngineTemperature() > 70 && getTurnedOn()) {
        this.soundThrottle+=Math.min(0.01f,absThrottle - this.soundThrottle);
      }
      if (horn.isPlaying()) {
        horn.setPosition(getPositionVector());
        horn.setVelocity(getVelocity());
        horn.update();
      }
      if (idle.isPlaying()) {
        idle.setPitch(0.7f + this.soundThrottle / 4);
        idle.setVolume(Math.max(0.1f,this.soundThrottle));
        idle.setPosition(getPositionVector());
        idle.setVelocity(getVelocity());
        idle.update();
      }
    }
    if (!ConfigGraphics.particlesEnabled) {
      return;
    }
    Vec3d fakeMotion=new Vec3d(this.motionX,this.motionY,this.motionZ);
    List<RenderComponent> exhausts=this.getDefinition().getComponents(RenderComponentType.DIESEL_EXHAUST_X,gauge);
    float throttle=Math.abs(this.getThrottle());
    if (exhausts != null && throttle > 0 && hasFuel && getEngineTemperature() > 70 && getTurnedOn()) {
      for (      RenderComponent exhaust : exhausts) {
        Vec3d particlePos=this.getPositionVector().add(VecUtil.rotateYaw(exhaust.center(),this.rotationYaw + 180)).addVector(0,0.35 * gauge.scale(),0);
        double smokeMod=(1 + Math.min(1,Math.max(0.2,Math.abs(this.getCurrentSpeed().minecraft()) * 2))) / 2;
        EntitySmokeParticle sp=new EntitySmokeParticle(world,(int)(40 * (1 + throttle) * smokeMod),throttle,throttle,exhaust.width());
        particlePos=particlePos.subtract(fakeMotion);
        sp.setPosition(particlePos.x,particlePos.y,particlePos.z);
        sp.setVelocity(fakeMotion.x,fakeMotion.y + 0.4 * gauge.scale(),fakeMotion.z);
        world.spawnEntity(sp);
      }
    }
    return;
  }
  if (this.getLiquidAmount() > 0) {
    float burnTime=BurnUtil.getBurnTime(this.getLiquid());
    if (burnTime == 0) {
      burnTime=200;
    }
    burnTime*=getDefinition().getFuelEfficiency() / 100f;
    burnTime*=(Config.ConfigBalance.locoDieselFuelEfficiency / 100f);
    float heatUpSpeed=0.0029167f * Config.ConfigBalance.dieselLocoHeatTimeScale;
    if (getTurnedOn()) {
      if (getEngineTemperature() < 150 && this.getLiquidAmount() > 0) {
        setEngineTemperature(getEngineTemperature() + heatUpSpeed);
        theTank.drain(1,true);
      }
      if (getEngineTemperature() > 150) {
        setEngineTemperature(150);
      }
    }
 else {
      if (getEngineTemperature() > 0) {
        setEngineTemperature(getEngineTemperature() - 0.02f);
      }
      if (getEngineTemperature() < 0) {
        setEngineTemperature(0);
      }
    }
    float consumption=Math.abs(getThrottle()) + 0.05f;
    consumption*=100;
    consumption*=gauge.scale();
    internalBurn-=consumption;
    if (canTurnOnOff == false) {
      tick++;
      if (tick == turnOnOffDelay) {
        tick=0;
        canTurnOnOff=true;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onUpdate(){
  super.onUpdate();
  if (world.isRemote) {
    boolean hasFuel=(this.getLiquidAmount() > 0 || !Config.isFuelRequired(gauge));
    if (ConfigSound.soundEnabled) {
      if (this.horn == null) {
        this.horn=ImmersiveRailroading.proxy.newSound(this.getDefinition().horn,false,100,gauge);
        this.idle=ImmersiveRailroading.proxy.newSound(this.getDefinition().idle,true,80,gauge);
      }
      if (hasFuel) {
        if (!idle.isPlaying() && getTurnedOn() && Config.isFuelRequired(gauge)) {
          this.idle.play(getPositionVector());
        }
 else {
          this.idle.play(getPositionVector());
        }
        if (idle.isPlaying() && getTurnedOn() == false && Config.isFuelRequired(gauge)) {
          idle.stop();
        }
      }
 else {
        if (idle.isPlaying()) {
          idle.stop();
        }
      }
      if (this.getDataManager().get(HORN) != 0 && !horn.isPlaying()) {
        horn.play(getPositionVector());
      }
      float absThrottle=Math.abs(this.getThrottle());
      if (this.soundThrottle > absThrottle && getEngineTemperature() > 70 && getTurnedOn() && Config.isFuelRequired(gauge)) {
        this.soundThrottle-=Math.min(0.01f,this.soundThrottle - absThrottle);
      }
 else       if (this.soundThrottle < absThrottle && getEngineTemperature() > 70 && getTurnedOn() && Config.isFuelRequired(gauge)) {
        this.soundThrottle+=Math.min(0.01f,absThrottle - this.soundThrottle);
      }
 else {
        if (this.soundThrottle > absThrottle) {
          this.soundThrottle-=Math.min(0.01f,this.soundThrottle - absThrottle);
        }
 else         if (this.soundThrottle < absThrottle) {
          this.soundThrottle+=Math.min(0.01f,absThrottle - this.soundThrottle);
        }
      }
      if (horn.isPlaying()) {
        horn.setPosition(getPositionVector());
        horn.setVelocity(getVelocity());
        horn.update();
      }
      if (idle.isPlaying()) {
        idle.setPitch(0.7f + this.soundThrottle / 4);
        idle.setVolume(Math.max(0.1f,this.soundThrottle));
        idle.setPosition(getPositionVector());
        idle.setVelocity(getVelocity());
        idle.update();
      }
    }
    if (!ConfigGraphics.particlesEnabled) {
      return;
    }
    Vec3d fakeMotion=new Vec3d(this.motionX,this.motionY,this.motionZ);
    List<RenderComponent> exhausts=this.getDefinition().getComponents(RenderComponentType.DIESEL_EXHAUST_X,gauge);
    float throttle=Math.abs(this.getThrottle());
    if (exhausts != null && throttle > 0 && hasFuel && getEngineTemperature() > 70 && getTurnedOn()) {
      for (      RenderComponent exhaust : exhausts) {
        Vec3d particlePos=this.getPositionVector().add(VecUtil.rotateYaw(exhaust.center(),this.rotationYaw + 180)).addVector(0,0.35 * gauge.scale(),0);
        double smokeMod=(1 + Math.min(1,Math.max(0.2,Math.abs(this.getCurrentSpeed().minecraft()) * 2))) / 2;
        EntitySmokeParticle sp=new EntitySmokeParticle(world,(int)(40 * (1 + throttle) * smokeMod),throttle,throttle,exhaust.width());
        particlePos=particlePos.subtract(fakeMotion);
        sp.setPosition(particlePos.x,particlePos.y,particlePos.z);
        sp.setVelocity(fakeMotion.x,fakeMotion.y + 0.4 * gauge.scale(),fakeMotion.z);
        world.spawnEntity(sp);
      }
    }
    return;
  }
  if (this.getLiquidAmount() > 0) {
    float burnTime=BurnUtil.getBurnTime(this.getLiquid());
    if (burnTime == 0) {
      burnTime=200;
    }
    burnTime*=getDefinition().getFuelEfficiency() / 100f;
    burnTime*=(Config.ConfigBalance.locoDieselFuelEfficiency / 100f);
    float heatUpSpeed=0.0029167f * Config.ConfigBalance.dieselLocoHeatTimeScale;
    if (getTurnedOn()) {
      if (getEngineTemperature() < 73 && this.getLiquidAmount() > 0) {
        setEngineTemperature(getEngineTemperature() + heatUpSpeed);
        theTank.drain(1,true);
      }
      if (getEngineTemperature() > 150) {
        setEngineTemperature(150);
      }
      if (this.getCurrentSpeed().metric() < 10 && getEngineTemperature() > 70) {
        setEngineTemperature(getEngineTemperature() - 0.02f);
      }
    }
 else {
      if (getEngineTemperature() > 0) {
        setEngineTemperature(getEngineTemperature() - 0.02f);
      }
 else {
        setEngineTemperature(0);
      }
    }
    if (getEngineTemperature() > 70 && getTurnedOn() && this.getCurrentSpeed().metric() > 10) {
      setEngineTemperature(getEngineTemperature() + (float)((heatUpSpeed / 2000) * this.getCurrentSpeed().metric()));
    }
    float consumption=Math.abs(getThrottle()) + 0.05f;
    consumption*=100;
    consumption*=gauge.scale();
    internalBurn-=consumption;
    if (canTurnOnOff == false) {
      tick++;
      if (tick == turnOnOffDelay) {
        tick=0;
        canTurnOnOff=true;
      }
    }
  }
}