Move matter recycler config values to subobject
This commit is contained in:
parent
7bc58bb7ff
commit
43d14486b7
@ -44,11 +44,11 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
|
||||
}
|
||||
}
|
||||
|
||||
val matter = ProfiledMatterStorage(MatterStorageImpl(::matterLevelUpdated, FlowDirection.OUTPUT, MachinesConfig.MATTER_RECYCLER_CAPACITY::get))
|
||||
val matter = ProfiledMatterStorage(MatterStorageImpl(::matterLevelUpdated, FlowDirection.OUTPUT, MachinesConfig.MatterRecycler.VALUES::matterCapacity))
|
||||
val container = MatteryContainer(::itemContainerUpdated, 1).also(::addDroppableContainer)
|
||||
|
||||
val matterNode = SimpleMatterNode(matter = matter)
|
||||
val energy = ProfiledEnergyStorage(WorkerEnergyStorage(::energyLevelUpdated, MachinesConfig.MATTER_RECYCLER))
|
||||
val energy = ProfiledEnergyStorage(WorkerEnergyStorage(::energyLevelUpdated, MachinesConfig.MatterRecycler.VALUES))
|
||||
|
||||
val itemConfig = ConfigurableItemHandler(input = container.handler(object : HandlerFilter {
|
||||
override fun canInsert(slot: Int, stack: ItemStack): Boolean {
|
||||
@ -117,8 +117,8 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
|
||||
|
||||
return JobContainer.success(
|
||||
RecyclerJob(
|
||||
(actualMatter / MachinesConfig.MATTER_RECYCLER_MATTER_PER_TICK.get()).toDouble(),
|
||||
MachinesConfig.MATTER_RECYCLER.powerConsumption,
|
||||
(actualMatter / MachinesConfig.MatterRecycler.MATTER_PER_TICK).toDouble(),
|
||||
MachinesConfig.MatterRecycler.VALUES.powerConsumption,
|
||||
actualMatter
|
||||
)
|
||||
)
|
||||
@ -126,7 +126,7 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
|
||||
|
||||
override fun onJobTick(status: JobStatus<RecyclerJob>, id: Int) {
|
||||
val job = status.job
|
||||
val toReceive = job.totalMatter.coerceAtMost(MachinesConfig.MATTER_RECYCLER_MATTER_PER_TICK.get() * status.ticksAdvanced)
|
||||
val toReceive = job.totalMatter.coerceAtMost(MachinesConfig.MatterRecycler.MATTER_PER_TICK * status.ticksAdvanced)
|
||||
|
||||
if (toReceive.isZero)
|
||||
return status.success()
|
||||
|
@ -1,17 +1,12 @@
|
||||
package ru.dbotthepony.mc.otm.config
|
||||
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterBottlerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterDecomposerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReplicatorBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidStationBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.ChemicalGeneratorBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.energy.BlockEnergyStorageImpl
|
||||
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.util.WriteOnce
|
||||
import ru.dbotthepony.mc.otm.registry.MNames
|
||||
|
||||
object MachinesConfig : AbstractConfig("machines") {
|
||||
@ -44,21 +39,20 @@ object MachinesConfig : AbstractConfig("machines") {
|
||||
powerConsumption = Decimal(80),
|
||||
)
|
||||
|
||||
var MATTER_RECYCLER_MATTER_PER_TICK: DecimalConfigValue by WriteOnce()
|
||||
private set
|
||||
|
||||
var MATTER_RECYCLER_CAPACITY: DecimalConfigValue by WriteOnce()
|
||||
private set
|
||||
|
||||
val MATTER_RECYCLER = workerValues(
|
||||
private val MATTER_RECYCLER = workerValues(
|
||||
MNames.MATTER_RECYCLER,
|
||||
energyStorage = Decimal(80_000),
|
||||
energyThroughput = Decimal(400),
|
||||
powerConsumption = Decimal(100),
|
||||
matterCapacity = Decimal(400),
|
||||
workTimeMultiplier = null
|
||||
) {
|
||||
MATTER_RECYCLER_MATTER_PER_TICK = defineDecimal("MATTER_PER_TICK", Decimal("0.5"))
|
||||
MATTER_RECYCLER_CAPACITY = defineDecimal("MATTER_CAPACITY", Decimal(400), Decimal.ONE)
|
||||
MatterRecycler
|
||||
}
|
||||
|
||||
object MatterRecycler {
|
||||
val VALUES by ::MATTER_RECYCLER
|
||||
val MATTER_PER_TICK by builder.defineDecimal("MATTER_PER_TICK", Decimal("0.5"))
|
||||
}
|
||||
|
||||
private val MATTER_RECONSTRUCTOR = workerValues(
|
||||
|
Loading…
Reference in New Issue
Block a user