Profiled matter capacitor storage

This commit is contained in:
DBotThePony 2025-02-22 18:56:45 +07:00
parent 69c93d4b16
commit 35d222d15a
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 9 additions and 5 deletions

View File

@ -15,6 +15,7 @@ import ru.dbotthepony.mc.otm.block.entity.tech.BatteryBankBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.matter.IMatterStorage
import ru.dbotthepony.mc.otm.capability.matter.ProfiledMatterStorage
import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.immutableList
@ -28,7 +29,8 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
var gaugeLevel by syncher.float()
private set
val matterNode = SimpleMatterNode(matter = this)
val profiled = ProfiledMatterStorage(this)
val matterNode = SimpleMatterNode(matter = profiled)
override val canSetMatterLevel: Boolean
get() = false
@ -155,7 +157,8 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
init {
savetables.stateful(::container, INVENTORY_KEY)
exposeGlobally(MatteryCapability.MATTER_BLOCK, this)
savetables.stateful(profiled::savedata, "profiled_matter_storage")
exposeGlobally(MatteryCapability.MATTER_BLOCK, profiled)
exposeGlobally(MatteryCapability.MATTER_NODE, matterNode)
}

View File

@ -8,13 +8,14 @@ import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.slot.MatterCapacitorSlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProfiledMatterGaugePanel
class MatterCapacitorBankScreen(p_97741_: MatterCapacitorBankMenu, p_97742_: Inventory, p_97743_: Component) :
MatteryScreen<MatterCapacitorBankMenu>(p_97741_, p_97742_, p_97743_) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = super.makeMainFrame()!!
val m = MatterGaugePanel(this, frame, menu.matterGauge, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
val m = ProfiledMatterGaugePanel(this, frame, menu.matterGauge, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
MatterGaugePanel(this, frame, menu.totalMatterGauge, LEFT_MARGIN + m.width + 1f, GAUGE_TOP_WITHOUT_SLOT)
for (i in 0 .. 5)

View File

@ -8,6 +8,7 @@ import ru.dbotthepony.mc.otm.menu.MatterContainerInputSlot
import ru.dbotthepony.mc.otm.menu.MatteryMenu
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
import ru.dbotthepony.mc.otm.registry.game.MMenus
class MatterCapacitorBankMenu @JvmOverloads constructor(
@ -15,7 +16,7 @@ class MatterCapacitorBankMenu @JvmOverloads constructor(
inventory: Inventory,
tile: MatterCapacitorBankBlockEntity? = null
) : MatteryMenu(MMenus.MATTER_CAPACITOR_BANK, p_38852_, inventory, tile) {
val matterGauge = LevelGaugeWidget(this)
val matterGauge = ProfiledLevelGaugeWidget(this, tile?.profiled)
val totalMatterGauge = LevelGaugeWidget(this)
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
@ -23,7 +24,6 @@ class MatterCapacitorBankMenu @JvmOverloads constructor(
init {
if (tile != null) {
matterGauge.with(tile)
totalMatterGauge.with({
tile.matterNode.graph.getMatterStorageLevel()
}, {