diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/FlywheelBatteryBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/FlywheelBatteryBlockEntity.kt index 5430e2ced..37b1322cc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/FlywheelBatteryBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/FlywheelBatteryBlockEntity.kt @@ -9,6 +9,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage +import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.core.getBlockStateNow import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.plus @@ -116,10 +117,10 @@ class FlywheelBatteryBlockEntity(blockPos: BlockPos, blockState: BlockState) : M val material = FlywheelMaterials[entry.key]!! energy.parent.maxBatteryLevel = material.storage * entry.intValue cachedChargeEfficiency = material.receiveEfficiency - energy.extractEnergy(energy.parent.batteryLevel * Decimal("0.000004") * material.momentumLossSpeed, false) + energy.extractEnergy(energy.parent.batteryLevel * MachinesConfig.Flywheel.PASSIVE_LOSS * material.momentumLossSpeed, false) } else { energy.parent.maxBatteryLevel = Decimal.ZERO - energy.extractEnergy(energy.parent.batteryLevel * Decimal("0.0004"), false) + energy.extractEnergy(energy.parent.batteryLevel * MachinesConfig.Flywheel.ACTIVE_LOSS, false) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt index fca8fd99a..e3d633896 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt @@ -312,4 +312,28 @@ object MachinesConfig : AbstractConfig("machines") { EssenceStorage BriefcaseGrill } + + object Flywheel { + init { + builder.push("flywheel") + } + + val PASSIVE_LOSS: Decimal by builder + .comment("Amount of energy lost per tick in % of energy stored") + .defineDecimal("PASSIVE_LOSS", Decimal("0.000001"), Decimal.ZERO) + + val ACTIVE_LOSS: Decimal by builder + .comment("Amount of energy lost per tick in % of energy stored if Flywheel configuration is invalid") + .comment("Keep in mind that all stored energy is instantly lost when controller is broken by any means") + .comment("unless using mod which fully preserve blockentity metadata such as Mekanism cardboard box or Carry On") + .defineDecimal("ACTIVE_LOSS", Decimal("0.0004"), Decimal.ZERO) + + init { + builder.pop() + } + } + + init { + Flywheel + } }