diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt index 361290d72..a9df1d08f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt @@ -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) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterCapacitorBankScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterCapacitorBankScreen.kt index ce9a0079e..af1bbba09 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterCapacitorBankScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterCapacitorBankScreen.kt @@ -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(p_97741_, p_97742_, p_97743_) { override fun makeMainFrame(): FramePanel> { 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) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/matter/MatterCapacitorBankMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/matter/MatterCapacitorBankMenu.kt index a80f46c49..d117c9a07 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/matter/MatterCapacitorBankMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/matter/MatterCapacitorBankMenu.kt @@ -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() }, {