Avoid excessive re-checks at the same tick
This commit is contained in:
parent
d21a4653e1
commit
0902c445f6
@ -137,13 +137,18 @@ class MatterReconstructorBlockEntity(blockPos: BlockPos, blockState: BlockState)
|
|||||||
matterNode.discover(this)
|
matterNode.discover(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var changeset = 0
|
||||||
|
|
||||||
private fun containerChanged() {
|
private fun containerChanged() {
|
||||||
matterPerTick = Decimal.ZERO
|
matterPerTick = Decimal.ZERO
|
||||||
progressPerTick = 0.0
|
progressPerTick = 0.0
|
||||||
|
|
||||||
val item = repairContainer[0]
|
val item = repairContainer[0]
|
||||||
|
val thisChangeset = ++changeset
|
||||||
|
|
||||||
tickList.once {
|
tickList.once {
|
||||||
|
if (thisChangeset != changeset) return@once
|
||||||
|
|
||||||
if (lastItem != item.item) {
|
if (lastItem != item.item) {
|
||||||
lastItem = item.item
|
lastItem = item.item
|
||||||
repairProgress = 0.0
|
repairProgress = 0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user