Profiled matter capacitor storage
This commit is contained in:
parent
69c93d4b16
commit
35d222d15a
@ -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.FlowDirection
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||||
import ru.dbotthepony.mc.otm.capability.matter.IMatterStorage
|
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.HandlerFilter
|
||||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||||
import ru.dbotthepony.mc.otm.core.immutableList
|
import ru.dbotthepony.mc.otm.core.immutableList
|
||||||
@ -28,7 +29,8 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
|||||||
var gaugeLevel by syncher.float()
|
var gaugeLevel by syncher.float()
|
||||||
private set
|
private set
|
||||||
|
|
||||||
val matterNode = SimpleMatterNode(matter = this)
|
val profiled = ProfiledMatterStorage(this)
|
||||||
|
val matterNode = SimpleMatterNode(matter = profiled)
|
||||||
|
|
||||||
override val canSetMatterLevel: Boolean
|
override val canSetMatterLevel: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
@ -155,7 +157,8 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
savetables.stateful(::container, INVENTORY_KEY)
|
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)
|
exposeGlobally(MatteryCapability.MATTER_NODE, matterNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.button.makeDeviceControls
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.MatterCapacitorSlotPanel
|
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.MatterGaugePanel
|
||||||
|
import ru.dbotthepony.mc.otm.client.screen.widget.ProfiledMatterGaugePanel
|
||||||
|
|
||||||
class MatterCapacitorBankScreen(p_97741_: MatterCapacitorBankMenu, p_97742_: Inventory, p_97743_: Component) :
|
class MatterCapacitorBankScreen(p_97741_: MatterCapacitorBankMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<MatterCapacitorBankMenu>(p_97741_, p_97742_, p_97743_) {
|
MatteryScreen<MatterCapacitorBankMenu>(p_97741_, p_97742_, p_97743_) {
|
||||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
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)
|
MatterGaugePanel(this, frame, menu.totalMatterGauge, LEFT_MARGIN + m.width + 1f, GAUGE_TOP_WITHOUT_SLOT)
|
||||||
|
|
||||||
for (i in 0 .. 5)
|
for (i in 0 .. 5)
|
||||||
|
@ -8,6 +8,7 @@ import ru.dbotthepony.mc.otm.menu.MatterContainerInputSlot
|
|||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||||
|
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
|
||||||
import ru.dbotthepony.mc.otm.registry.game.MMenus
|
import ru.dbotthepony.mc.otm.registry.game.MMenus
|
||||||
|
|
||||||
class MatterCapacitorBankMenu @JvmOverloads constructor(
|
class MatterCapacitorBankMenu @JvmOverloads constructor(
|
||||||
@ -15,7 +16,7 @@ class MatterCapacitorBankMenu @JvmOverloads constructor(
|
|||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
tile: MatterCapacitorBankBlockEntity? = null
|
tile: MatterCapacitorBankBlockEntity? = null
|
||||||
) : MatteryMenu(MMenus.MATTER_CAPACITOR_BANK, p_38852_, inventory, tile) {
|
) : MatteryMenu(MMenus.MATTER_CAPACITOR_BANK, p_38852_, inventory, tile) {
|
||||||
val matterGauge = LevelGaugeWidget(this)
|
val matterGauge = ProfiledLevelGaugeWidget(this, tile?.profiled)
|
||||||
val totalMatterGauge = LevelGaugeWidget(this)
|
val totalMatterGauge = LevelGaugeWidget(this)
|
||||||
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
|
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
|
||||||
|
|
||||||
@ -23,7 +24,6 @@ class MatterCapacitorBankMenu @JvmOverloads constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
matterGauge.with(tile)
|
|
||||||
totalMatterGauge.with({
|
totalMatterGauge.with({
|
||||||
tile.matterNode.graph.getMatterStorageLevel()
|
tile.matterNode.graph.getMatterStorageLevel()
|
||||||
}, {
|
}, {
|
||||||
|
Loading…
Reference in New Issue
Block a user