Matter scanner rebalanced values and added upgrades support
This commit is contained in:
parent
9c74b62f10
commit
ee8c641a61
@ -14,14 +14,18 @@ import ru.dbotthepony.mc.otm.block.entity.ItemJob
|
||||
import ru.dbotthepony.mc.otm.block.entity.MachineJobEventLoop
|
||||
import ru.dbotthepony.mc.otm.config.EnergyBalanceValues
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.IMatteryUpgrade
|
||||
import ru.dbotthepony.mc.otm.capability.energy.BlockEnergyStorageImpl
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.UpgradeType
|
||||
import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.matter.IPatternState
|
||||
import ru.dbotthepony.mc.otm.capability.matter.PatternState
|
||||
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.container.HandlerFilter
|
||||
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
|
||||
@ -37,8 +41,9 @@ import kotlin.math.pow
|
||||
class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
|
||||
MatteryWorkerBlockEntity<ItemJob>(MBlockEntities.MATTER_SCANNER, p_155229_, p_155230_, ItemJob.CODEC) {
|
||||
|
||||
override val upgrades = UpgradeContainer(this::setChangedLight, 2, UpgradeType.BASIC)
|
||||
val container = MatteryContainer(::itemContainerUpdated, 1).also(::addDroppableContainer)
|
||||
val energy = ProfiledEnergyStorage(WorkerEnergyStorage(::energyLevelUpdated, ENERGY_VALUES))
|
||||
val energy = ProfiledEnergyStorage(WorkerEnergyStorage(::energyLevelUpdated, upgrades.transform(MachinesConfig.MATTER_SCANNER)))
|
||||
|
||||
val itemConfig = ConfigurableItemHandler(inputOutput = container.handler(object : HandlerFilter {
|
||||
override fun canInsert(slot: Int, stack: ItemStack): Boolean {
|
||||
@ -149,7 +154,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)), BASE_CONSUMPTION))
|
||||
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.noItem()
|
||||
@ -172,31 +177,7 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
|
||||
var visualProgress by synchronizer.float().property
|
||||
private set
|
||||
|
||||
override fun onJobTick(
|
||||
status: JobStatus<ItemJob>,
|
||||
id: Int
|
||||
) {
|
||||
val result = super.onJobTick(status, id)
|
||||
|
||||
visualProgress = jobEventLoops[0].workProgress
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val BASE_CONSUMPTION get() = _BASE_CONSUMPTION.get()
|
||||
|
||||
private var _BASE_CONSUMPTION: DecimalConfigValue by WriteOnce()
|
||||
var ENERGY_VALUES: EnergyBalanceValues by WriteOnce()
|
||||
private set
|
||||
|
||||
fun registerConfig(builder: ForgeConfigSpec.Builder) {
|
||||
builder.push(MNames.MATTER_SCANNER)
|
||||
|
||||
ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = Decimal(80_000), throughput = Decimal(400))
|
||||
_BASE_CONSUMPTION = builder.defineDecimal("baseConsumption", Decimal(40), Decimal.ONE)
|
||||
|
||||
builder.pop()
|
||||
}
|
||||
override fun onJobTick(status: JobStatus<ItemJob>, id: Int) {
|
||||
visualProgress = status.workProgress
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ object MachinesConfig : AbstractConfig("machines") {
|
||||
ChemicalGeneratorBlockEntity.registerConfig(builder)
|
||||
MatterBottlerBlockEntity.registerConfig(builder)
|
||||
MatterReplicatorBlockEntity.registerConfig(builder)
|
||||
MatterScannerBlockEntity.registerConfig(builder)
|
||||
MatterReconstructorBlockEntity.registerConfig(builder)
|
||||
}
|
||||
|
||||
@ -39,6 +38,13 @@ object MachinesConfig : AbstractConfig("machines") {
|
||||
matterCapacity = Decimal(400),
|
||||
)
|
||||
|
||||
val MATTER_SCANNER = workerValues(
|
||||
MNames.MATTER_SCANNER,
|
||||
energyStorage = Decimal(40_000),
|
||||
energyThroughput = Decimal(200),
|
||||
powerConsumption = Decimal(80),
|
||||
)
|
||||
|
||||
var MATTER_RECYCLER_MATTER_PER_TICK: DecimalConfigValue by WriteOnce()
|
||||
private set
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user