forgor about gauge updates when container contents changes in matter capacitor bank
This commit is contained in:
parent
4d51ed5210
commit
10421570be
@ -60,8 +60,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
|||||||
return summ
|
return summ
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tick() {
|
private fun updateGaugeLevel() {
|
||||||
super.tick()
|
|
||||||
var stored = Decimal.ZERO
|
var stored = Decimal.ZERO
|
||||||
var maxStored = Decimal.ZERO
|
var maxStored = Decimal.ZERO
|
||||||
|
|
||||||
@ -74,6 +73,11 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
|||||||
gaugeLevel = stored.percentage(maxStored)
|
gaugeLevel = stored.percentage(maxStored)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun tick() {
|
||||||
|
super.tick()
|
||||||
|
updateGaugeLevel()
|
||||||
|
}
|
||||||
|
|
||||||
override fun receiveMatter(howMuch: Decimal, simulate: Boolean): Decimal {
|
override fun receiveMatter(howMuch: Decimal, simulate: Boolean): Decimal {
|
||||||
if (!howMuch.isPositive)
|
if (!howMuch.isPositive)
|
||||||
return Decimal.ZERO
|
return Decimal.ZERO
|
||||||
@ -134,7 +138,6 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
|||||||
super.notifyChanged(old)
|
super.notifyChanged(old)
|
||||||
|
|
||||||
capacitorStatus[slot].value = item.getCapability(MatteryCapability.MATTER_ITEM) != null
|
capacitorStatus[slot].value = item.getCapability(MatteryCapability.MATTER_ITEM) != null
|
||||||
gaugeLevel = storedMatter.percentage(maxStoredMatter)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun canAutomationPlaceItem(itemStack: ItemStack): Boolean {
|
override fun canAutomationPlaceItem(itemStack: ItemStack): Boolean {
|
||||||
@ -155,7 +158,12 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
|||||||
get() = 1
|
get() = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
val container = SlottedContainer.simple(BatteryBankBlockEntity.CAPACITY, ::Slot, ::markDirtyFast).also(::addDroppableContainer)
|
private fun containerUpdated() {
|
||||||
|
markDirtyFast()
|
||||||
|
updateGaugeLevel()
|
||||||
|
}
|
||||||
|
|
||||||
|
val container = SlottedContainer.simple(BatteryBankBlockEntity.CAPACITY, ::Slot, ::containerUpdated).also(::addDroppableContainer)
|
||||||
val itemConfig = ConfigurableItemHandler(inputOutput = container)
|
val itemConfig = ConfigurableItemHandler(inputOutput = container)
|
||||||
|
|
||||||
val capacitorStatus = immutableList(BatteryBankBlockEntity.CAPACITY) {
|
val capacitorStatus = immutableList(BatteryBankBlockEntity.CAPACITY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user