Matter replicator failsafe upgrades support

This commit is contained in:
DBotThePony 2023-07-19 21:26:33 +07:00
parent ab51740ddf
commit b3e6caf5ba
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -102,7 +102,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
}
}
override val upgrades = UpgradeContainer(this::setChangedLight, 3, UpgradeType.BASIC_MATTER)
override val upgrades = UpgradeContainer(this::setChangedLight, 3, UpgradeType.REPLICATOR)
val energy = ProfiledEnergyStorage(WorkerEnergyStorage(::powerLevelUpdated, upgrades.transform(ENERGY_VALUES)))
val matter = ProfiledMatterStorage(MatterStorageImpl(::matterLevelUpdated, FlowDirection.INPUT, upgrades.matterCapacity(::MATTER_CAPACITY)))
val container = MatteryContainer(::itemContainerUpdated, 5).also(::addDroppableContainer)
@ -215,7 +215,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
task = allocation.task.asImmutable(),
matterValue = matter.matter,
pattern = allocation.pattern?.asImmutable(),
asDust = (level?.random?.nextDouble() ?: 1.0) > (allocation.pattern?.researchPercent ?: 2.0),
asDust = (level?.random?.nextDouble() ?: 1.0) * upgrades.failureMultiplier > (allocation.pattern?.researchPercent ?: 2.0),
ticks = ticks,
))
}