diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt index 2cc112b88..6feb56bb3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt @@ -40,7 +40,7 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) val toDust: Boolean, var matterValue: Decimal, ticks: Double, - ) : Job(ticks, MachinesConfig.MATTER_DECOMPOSER.powerConsumption) { + ) : Job(ticks, MachinesConfig.MATTER_DECOMPOSER.energyConsumption) { companion object { val CODEC: Codec by lazy { RecordCodecBuilder.create { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReconstructorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReconstructorBlockEntity.kt index 3dffd4e37..3e312cf0b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReconstructorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReconstructorBlockEntity.kt @@ -10,36 +10,28 @@ import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.level.Level import net.minecraft.world.level.block.state.BlockState -import net.minecraftforge.common.ForgeConfigSpec -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue import net.minecraftforge.registries.ForgeRegistries import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.UpgradeType -import ru.dbotthepony.mc.otm.capability.energy.BlockEnergyStorageImpl import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.matter.IMatterStorage import ru.dbotthepony.mc.otm.capability.matter.PatternState import ru.dbotthepony.mc.otm.capability.matter.MatterStorageImpl import ru.dbotthepony.mc.otm.capability.matter.ProfiledMatterStorage -import ru.dbotthepony.mc.otm.config.EnergyBalanceValues import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.container.HandlerFilter import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.UpgradeContainer import ru.dbotthepony.mc.otm.core.math.Decimal -import ru.dbotthepony.mc.otm.core.math.DecimalConfigValue -import ru.dbotthepony.mc.otm.core.math.defineDecimal import ru.dbotthepony.mc.otm.core.registryName -import ru.dbotthepony.mc.otm.core.util.WriteOnce import ru.dbotthepony.mc.otm.graph.matter.MatterNode import ru.dbotthepony.mc.otm.matter.IMatterValue import ru.dbotthepony.mc.otm.matter.MatterManager import ru.dbotthepony.mc.otm.menu.matter.MatterReconstructorMenu import ru.dbotthepony.mc.otm.registry.MBlockEntities -import ru.dbotthepony.mc.otm.registry.MNames class MatterReconstructorBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryPoweredBlockEntity(MBlockEntities.MATTER_RECONSTRUCTOR, blockPos, blockState) { val repairContainer = MatteryContainer(::containerChanged, 1).also(::addDroppableContainer) @@ -225,7 +217,7 @@ class MatterReconstructorBlockEntity(blockPos: BlockPos, blockState: BlockState) val thisProgressPerTick = progressPerTick * (1.0 + upgrades.speedBonus) val matterPerTick = matterPerTick * (1.0 + upgrades.speedBonus) - val energyConsumption = MachinesConfig.MatterReconstructor.VALUES.powerConsumption * (1.0 + upgrades.speedBonus) * (upgrades.energyConsumed + Decimal.ONE) + val energyConsumption = MachinesConfig.MatterReconstructor.VALUES.energyConsumption * (1.0 + upgrades.speedBonus) * (upgrades.energyConsumed + Decimal.ONE) if (!item.isEmpty && matterPerTick.isPositive && thisProgressPerTick > 0.0 && item.isRepairable && item.isDamaged) { var progressPerTick = (repairProgress + thisProgressPerTick).coerceAtMost(item.damageValue.toDouble()) - repairProgress diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt index 53e353361..2717c81e7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt @@ -118,7 +118,7 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) return JobContainer.success( RecyclerJob( (actualMatter / MachinesConfig.MatterRecycler.MATTER_PER_TICK).toDouble(), - MachinesConfig.MatterRecycler.VALUES.powerConsumption, + MachinesConfig.MatterRecycler.VALUES.energyConsumption, actualMatter ) ) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt index 2009e343d..1c64fd770 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt @@ -144,7 +144,7 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : stack.shrink(1) container.setChanged() val complexity = MatterManager.get(copy).complexity - return JobContainer.success(ItemJob(copy, (if (complexity > 1.0) complexity.pow(1.25) else complexity.pow(0.5)) * MachinesConfig.MATTER_SCANNER.workTimeMultiplier, MachinesConfig.MATTER_SCANNER.powerConsumption)) + return JobContainer.success(ItemJob(copy, (if (complexity > 1.0) complexity.pow(1.25) else complexity.pow(0.5)) * MachinesConfig.MATTER_SCANNER.workTimeMultiplier, MachinesConfig.MATTER_SCANNER.energyConsumption)) } return JobContainer.noItem() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt index df68623fc..f7583bede 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt @@ -102,7 +102,7 @@ class PlatePressBlockEntity( ItemJob( recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess), recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier, - MachinesConfig.PLATE_PRESS.powerConsumption * toProcess, + MachinesConfig.PLATE_PRESS.energyConsumption * toProcess, experience = recipe.experience.sample(level.random) * toProcess)) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt index e11236c03..ab30d0401 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PoweredFurnaceBlockEntity.kt @@ -107,7 +107,7 @@ class PoweredFurnaceBlockEntity( inputs[id][0].shrink(toProcess) JobContainer.success(ItemJob( - output.copyWithCount(toProcess), it.cookingTime * config.workTimeMultiplier, config.powerConsumption * toProcess, it.experience * toProcess + output.copyWithCount(toProcess), it.cookingTime * config.workTimeMultiplier, config.energyConsumption * toProcess, it.experience * toProcess )) }.orElse(JobContainer.noItem()) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/AbstractConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/AbstractConfig.kt index 1214d2f30..906314c6c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/AbstractConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/AbstractConfig.kt @@ -19,10 +19,10 @@ abstract class AbstractConfig(private val configName: String, private val type: builder.push(name) val obj = object : BatteryBalanceValues { - override val energyCapacity: Decimal by builder.defineDecimal("capacity", storage, minimum = Decimal.ONE) - override val maxEnergyReceive: Decimal by builder.defineDecimal("receive", receive, minimum = Decimal.ONE) - override val maxEnergyExtract: Decimal by builder.defineDecimal("extract", extract, minimum = Decimal.ONE) - override val initialBatteryLevel: Decimal by builder.defineDecimal("initialBatteryLevel", initialBatteryLevel, minimum = Decimal.ZERO) + override val energyCapacity: Decimal by builder.defineDecimal("ENERGY_CAPACITY", storage, minimum = Decimal.ONE) + override val maxEnergyReceive: Decimal by builder.defineDecimal("MAX_RECEIVE", receive, minimum = Decimal.ONE) + override val maxEnergyExtract: Decimal by builder.defineDecimal("MAX_EXTRACT", extract, minimum = Decimal.ONE) + override val initialBatteryLevel: Decimal by builder.defineDecimal("INITIAL_BATTERY_LEVEL", initialBatteryLevel, minimum = Decimal.ZERO) } builder.pop() @@ -34,8 +34,8 @@ abstract class AbstractConfig(private val configName: String, private val type: builder.push(name) val obj = object : EnergyBalanceValues { - override val energyCapacity: Decimal by builder.defineDecimal("capacity", storage, minimum = Decimal.ONE) - override val energyThroughput: Decimal by builder.defineDecimal("throughput", throughput, minimum = Decimal.ONE) + override val energyCapacity: Decimal by builder.defineDecimal("ENERGY_CAPACITY", storage, minimum = Decimal.ONE) + override val energyThroughput: Decimal by builder.defineDecimal("ENERGY_THROUGHPUT", throughput, minimum = Decimal.ONE) } configurator.invoke(builder) @@ -56,11 +56,11 @@ abstract class AbstractConfig(private val configName: String, private val type: builder.push(name) val obj = object : WorkerBalanceValues { - override val energyCapacity: Decimal by builder.defineDecimal("capacity", energyStorage, minimum = Decimal.ONE) - override val energyThroughput: Decimal by builder.defineDecimal("throughput", energyThroughput, minimum = Decimal.ONE) - override val powerConsumption: Decimal by builder.defineDecimal("powerConsumption", powerConsumption, minimum = Decimal.ONE) - override val matterCapacity: Decimal by (if (matterCapacity == null) GetterSetter.box(Decimal.ZERO) else builder.defineDecimal("matterCapacity", matterCapacity, minimum = Decimal.ONE)) - override val workTimeMultiplier: Double by (if (workTimeMultiplier == null) GetterSetter.box(1.0) else builder.defineInRange("workTimeMultiplier", workTimeMultiplier, 0.0)) + override val energyCapacity: Decimal by builder.defineDecimal("ENERGY_CAPACITY", energyStorage, minimum = Decimal.ONE) + override val energyThroughput: Decimal by builder.defineDecimal("ENERGY_THROUGHPUT", energyThroughput, minimum = Decimal.ONE) + override val energyConsumption: Decimal by builder.defineDecimal("ENERGY_CONSUMPTION", powerConsumption, minimum = Decimal.ONE) + override val matterCapacity: Decimal by (if (matterCapacity == null) GetterSetter.box(Decimal.ZERO) else builder.defineDecimal("MATTER_CAPACITY", matterCapacity, minimum = Decimal.ONE)) + override val workTimeMultiplier: Double by (if (workTimeMultiplier == null) GetterSetter.box(1.0) else builder.defineInRange("WORK_TIME_MULTIPLIER", workTimeMultiplier, 0.0)) } configurator.invoke(builder) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/BalanceValues.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/BalanceValues.kt index 6ff056147..1a0a59e3e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/BalanceValues.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/BalanceValues.kt @@ -9,7 +9,7 @@ interface EnergyBalanceValues { interface WorkerBalanceValues : EnergyBalanceValues { val workTimeMultiplier: Double - val powerConsumption: Decimal + val energyConsumption: Decimal val matterCapacity: Decimal } 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 57c8dfeaa..1cd3ee462 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt @@ -72,17 +72,17 @@ object MachinesConfig : AbstractConfig("machines") { val ALLOW_TO_SKIP_ANVIL: Boolean by builder .comment("Allow to repair tools without having their anvil-repair items researched") .comment("Ignored if onlyAnvil is true") - .define("allowToSkipAnvil", false) + .define("ALLOW_TO_SKIP_ANVIL", false) val ONLY_ANVIL: Boolean by builder .comment("Force repairing only by matter value of anvil materials") .comment("Doesn't make logical sense but might be good for balancing") - .define("onlyAnvil", false) + .define("ONLY_ANVIL", false) val FAILURE_CHANCE: Double by builder .comment("Constant additional chance (over pattern research factor) that replication will fail at any given tick") .comment("In event of failure repair tick is wasted, as well as resources") - .defineInRange("failureChance", 0.01, 0.0, 0.99) + .defineInRange("FAILURE_CHANCE", 0.01, 0.0, 0.99) val DIVISOR: Double by builder .comment("Magnitute of **slowdown** of repairer.") @@ -91,7 +91,7 @@ object MachinesConfig : AbstractConfig("machines") { .comment("---") .comment("If value is smaller than 1, repairer will repair items faster") .comment("If value is bigger than 1, repairer will repair items slower") - .defineInRange("divisor", 3.0, 0.1, Double.MAX_VALUE) + .defineInRange("DIVISOR", 3.0, 0.1, Double.MAX_VALUE) } val STORAGE_POWER_SUPPLIER = BlockEnergyStorageImpl.makeConfigEntry(builder, MNames.STORAGE_POWER_SUPPLIER, capacity = Decimal(100_000), throughput = Decimal(320))