Make energy counter be more consistent with lastTick
This commit is contained in:
parent
6c6f22c2a1
commit
c689098253
@ -37,7 +37,8 @@ class BlockEntityEnergyCounter(p_155229_: BlockPos, p_155230_: BlockState) : Blo
|
||||
|
||||
fun size() = history.size
|
||||
operator fun get(i: Int) = history[i]
|
||||
val lastTick: Fraction get() = history[historyTick]
|
||||
var lastTick: Fraction = Fraction.ZERO
|
||||
private set
|
||||
|
||||
fun getHistory(ticks: Int): Array<Fraction> {
|
||||
require(!(ticks < 1 || ticks >= history.size)) { "Invalid history length provided" }
|
||||
@ -339,6 +340,7 @@ class BlockEntityEnergyCounter(p_155229_: BlockPos, p_155230_: BlockState) : Blo
|
||||
}
|
||||
|
||||
fun tick() {
|
||||
lastTick = history[historyTick]
|
||||
historyTick = (historyTick + 1) % history.size
|
||||
history[historyTick] = Fraction.ZERO
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user