Unify storage exportert/importer menus, profile their energy and add energy config

This commit is contained in:
DBotThePony 2023-08-12 14:49:24 +07:00
parent d3ea51928f
commit 6c7f2226a6
Signed by: DBot
GPG Key ID: DCC23B5715498507
10 changed files with 101 additions and 152 deletions

View File

@ -11,14 +11,15 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.capabilities.ForgeCapabilities import net.minecraftforge.common.capabilities.ForgeCapabilities
import net.minecraftforge.items.IItemHandler import net.minecraftforge.items.IItemHandler
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.SERVER_IS_LIVE import ru.dbotthepony.mc.otm.SERVER_IS_LIVE
import ru.dbotthepony.mc.otm.block.CableBlock import ru.dbotthepony.mc.otm.block.CableBlock
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
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.energy.ProfiledEnergyStorage
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
import ru.dbotthepony.mc.otm.config.EnergyBalanceValues import ru.dbotthepony.mc.otm.config.EnergyBalanceValues
import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.config.MachinesConfig
@ -28,8 +29,7 @@ import ru.dbotthepony.mc.otm.core.isNotEmpty
import ru.dbotthepony.mc.otm.core.math.RelativeSide import ru.dbotthepony.mc.otm.core.math.RelativeSide
import ru.dbotthepony.mc.otm.core.orNull import ru.dbotthepony.mc.otm.core.orNull
import ru.dbotthepony.mc.otm.graph.storage.StorageNode import ru.dbotthepony.mc.otm.graph.storage.StorageNode
import ru.dbotthepony.mc.otm.menu.storage.StorageExporterMenu import ru.dbotthepony.mc.otm.menu.storage.StorageImporterExporterMenu
import ru.dbotthepony.mc.otm.menu.storage.StorageImporterMenu
import ru.dbotthepony.mc.otm.once import ru.dbotthepony.mc.otm.once
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
@ -41,13 +41,15 @@ import java.math.BigInteger
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
abstract class AbstractStorageImportExport<T>( abstract class AbstractStorageImportExport(
blockType: BlockEntityType<*>, blockType: BlockEntityType<*>,
blockPos: BlockPos, blockPos: BlockPos,
blockState: BlockState, blockState: BlockState,
energyValues: EnergyBalanceValues = MachinesConfig.STORAGE_INTERFACES energyValues: EnergyBalanceValues = MachinesConfig.STORAGE_INTERFACES
) : MatteryPoweredBlockEntity(blockType, blockPos, blockState) { ) : MatteryPoweredBlockEntity(blockType, blockPos, blockState) {
val energy = WorkerEnergyStorage(::setChangedLight, energyValues) val energy = ProfiledEnergyStorage(WorkerEnergyStorage(::setChangedLight, energyValues))
val energyConfig = ConfigurableEnergy(energy, modesFront = FlowDirection.NONE)
val cell: StorageNode = object : StorageNode(energy) { val cell: StorageNode = object : StorageNode(energy) {
override fun onNeighbour(link: Link) { override fun onNeighbour(link: Link) {
if (link is DirectionLink) { if (link is DirectionLink) {
@ -76,8 +78,11 @@ abstract class AbstractStorageImportExport<T>(
} }
} }
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
return StorageImporterExporterMenu(containerID, inventory, this)
}
init { init {
exposeEnergyGlobally(energy)
savetable(::energy, ENERGY_KEY) savetable(::energy, ENERGY_KEY)
exposeGlobally(MatteryCapability.STORAGE_NODE, cell) { it != RelativeSide.FRONT } exposeGlobally(MatteryCapability.STORAGE_NODE, cell) { it != RelativeSide.FRONT }
} }
@ -92,11 +97,7 @@ abstract class AbstractStorageImportExport<T>(
cell.discover(this) cell.discover(this)
} }
protected abstract val targetCapability: Capability<T> protected val target = front.track(ForgeCapabilities.ITEM_HANDLER)
protected val target by lazy {
front.track(targetCapability)
}
abstract val filter: ItemFilter abstract val filter: ItemFilter
@ -106,26 +107,20 @@ abstract class AbstractStorageImportExport<T>(
companion object { companion object {
const val FILTER_KEY = "filter" const val FILTER_KEY = "filter"
const val MAX_FILTERS = 6 * 3
} }
} }
class StorageImporterBlockEntity( class StorageImporterBlockEntity(
blockPos: BlockPos, blockState: BlockState blockPos: BlockPos, blockState: BlockState
) : AbstractStorageImportExport<IItemHandler>(MBlockEntities.STORAGE_IMPORTER, blockPos, blockState), IItemHandler { ) : AbstractStorageImportExport(MBlockEntities.STORAGE_IMPORTER, blockPos, blockState), IItemHandler {
override val filter = ItemFilter(MAX_FILTERS) { override val filter = ItemFilter(MAX_FILTERS) {
setChangedLight() setChangedLight()
} }
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
return StorageImporterMenu(containerID, inventory, this)
}
private var lastSlot = 0 private var lastSlot = 0
private var nextTick = INTERVAL private var nextTick = INTERVAL
override val targetCapability: Capability<IItemHandler>
get() = ForgeCapabilities.ITEM_HANDLER
init { init {
front.Cap(ForgeCapabilities.ITEM_HANDLER, this) front.Cap(ForgeCapabilities.ITEM_HANDLER, this)
} }
@ -212,7 +207,6 @@ class StorageImporterBlockEntity(
if (leftover.count != extracted.count) { if (leftover.count != extracted.count) {
val extracted2 = target.extractItem(lastSlot, extracted.count - leftover.count, false) val extracted2 = target.extractItem(lastSlot, extracted.count - leftover.count, false)
acceptItem(extracted2, false) acceptItem(extracted2, false)
nextTick += INTERVAL * 4
} }
} }
} }
@ -225,20 +219,15 @@ class StorageImporterBlockEntity(
companion object { companion object {
const val MAX_MOVE_PER_OPERATION = 4 const val MAX_MOVE_PER_OPERATION = 4
private const val INTERVAL = 5 private const val INTERVAL = 5
const val MAX_FILTERS = 6 * 3
} }
} }
class StorageExporterBlockEntity(blockPos: BlockPos, blockState: BlockState) : class StorageExporterBlockEntity(blockPos: BlockPos, blockState: BlockState) :
AbstractStorageImportExport<IItemHandler>(MBlockEntities.STORAGE_EXPORTER, blockPos, blockState), AbstractStorageImportExport(MBlockEntities.STORAGE_EXPORTER, blockPos, blockState),
IStorageEventConsumer<ItemStorageStack> { IStorageEventConsumer<ItemStorageStack> {
override val defaultDisplayName: Component override val defaultDisplayName: Component
get() = MACHINE_NAME get() = MACHINE_NAME
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
return StorageExporterMenu(containerID, inventory, this)
}
private val relevantTuples = ObjectOpenHashSet<UUID>() private val relevantTuples = ObjectOpenHashSet<UUID>()
override val storageType: StorageStack.Type<ItemStorageStack> override val storageType: StorageStack.Type<ItemStorageStack>
@ -281,9 +270,6 @@ class StorageExporterBlockEntity(blockPos: BlockPos, blockState: BlockState) :
private var lastSlot = 0 private var lastSlot = 0
private var nextTick = INTERVAL private var nextTick = INTERVAL
override val targetCapability: Capability<IItemHandler>
get() = ForgeCapabilities.ITEM_HANDLER
override fun tick() { override fun tick() {
super.tick() super.tick()
@ -346,6 +332,5 @@ class StorageExporterBlockEntity(blockPos: BlockPos, blockState: BlockState) :
val MAX_MOVE_PER_OPERATION: BigInteger = BigInteger.valueOf(4L) val MAX_MOVE_PER_OPERATION: BigInteger = BigInteger.valueOf(4L)
private val MACHINE_NAME = TranslatableComponent("block.${OverdriveThatMatters.MOD_ID}.${MNames.STORAGE_EXPORTER}") private val MACHINE_NAME = TranslatableComponent("block.${OverdriveThatMatters.MOD_ID}.${MNames.STORAGE_EXPORTER}")
private const val INTERVAL = 5 private const val INTERVAL = 5
const val MAX_FILTERS = 6 * 3
} }
} }

View File

@ -51,7 +51,7 @@ class StorageBusScreen(menu: StorageBusMenu, inventory: Inventory, title: Compon
it.childrenOrder = -3 it.childrenOrder = -3
} }
val controls = DeviceControls(this, frame, redstoneConfig = menu.redstoneConfig) val controls = DeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, energyConfig = menu.energyConfig)
val mode = LargeEnumRectangleButtonPanel(this, frame, prop = menu.mode, defaultValue = FlowDirection.BI_DIRECTIONAL, enum = FlowDirection::class.java) val mode = LargeEnumRectangleButtonPanel(this, frame, prop = menu.mode, defaultValue = FlowDirection.BI_DIRECTIONAL, enum = FlowDirection::class.java)
mode.add(FlowDirection.INPUT, Widgets18.ONLY_STORE, FlowDirection.INPUT.title) mode.add(FlowDirection.INPUT, Widgets18.ONLY_STORE, FlowDirection.INPUT.title)

View File

@ -1,36 +0,0 @@
package ru.dbotthepony.mc.otm.client.screen.storage
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelInputPanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.slot.FilterSlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
import ru.dbotthepony.mc.otm.menu.storage.StorageExporterMenu
class StorageExporterScreen(menu: StorageExporterMenu, inventory: Inventory, title: Component) :
MatteryScreen<StorageExporterMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = super.makeMainFrame()!!
WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
for (row in 0 .. 2) {
for (column in 0 .. 5) {
FilterSlotPanel(this, frame, menu.busFilterSlots[row + column * 3], 55f + 18f * column, 17f + 18f * row)
}
}
CheckBoxLabelInputPanel(this, frame, menu.busFilterState, TranslatableComponent("otm.gui.filter.is_whitelist"), 59f, 78f, width = 170f)
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig)
return frame
}
}

View File

@ -0,0 +1,55 @@
package ru.dbotthepony.mc.otm.client.screen.storage
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelInputPanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.slot.FilterSlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.util.GridPanel
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
import ru.dbotthepony.mc.otm.menu.storage.StorageImporterExporterMenu
class StorageImporterExporterScreen(menu: StorageImporterExporterMenu, inventory: Inventory, title: Component) : MatteryScreen<StorageImporterExporterMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, 148f, 130f, title)
makeBars(frame, profiledEnergy = menu.profiledEnergy, batterySlot = menu.batterySlot)
val right = EditablePanel(this, frame, width = AbstractSlotPanel.SIZE * 6f)
right.dock = Dock.RIGHT
val grid = GridPanel(this, right, columns = 6, rows = 3, height = AbstractSlotPanel.SIZE * 3f)
grid.dock = Dock.TOP
for (slot in menu.filterSlots) {
FilterSlotPanel(this, grid, slot)
}
CheckBoxLabelInputPanel(this, right, menu.isWhitelist, TranslatableComponent("otm.gui.filter.is_whitelist")).also {
it.dock = Dock.BOTTOM
it.dockTop = 2f
it.childrenOrder = -1
}
CheckBoxLabelInputPanel(this, right, menu.matchNBT, TranslatableComponent("otm.gui.filter.match_nbt")).also {
it.dock = Dock.BOTTOM
it.dockTop = 2f
it.childrenOrder = -2
}
CheckBoxLabelInputPanel(this, right, menu.matchTag, TranslatableComponent("otm.gui.filter.match_tag")).also {
it.dock = Dock.BOTTOM
it.dockTop = 2f
it.childrenOrder = -3
}
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, energyConfig = menu.energyConfig)
return frame
}
}

View File

@ -1,36 +0,0 @@
package ru.dbotthepony.mc.otm.client.screen.storage
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelInputPanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.slot.FilterSlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
import ru.dbotthepony.mc.otm.menu.storage.StorageImporterMenu
class StorageImporterScreen(menu: StorageImporterMenu, inventory: Inventory, title: Component) :
MatteryScreen<StorageImporterMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = super.makeMainFrame()!!
WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
for (row in 0 .. 2) {
for (column in 0 .. 5) {
FilterSlotPanel(this, frame, menu.busFilterSlots[row + column * 3], 55f + 18f * column, 17f + 18f * row)
}
}
CheckBoxLabelInputPanel(this, frame, menu.busFilterState, TranslatableComponent("otm.gui.filter.is_whitelist"), 59f, 78f, width = 170f)
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig)
return frame
}
}

View File

@ -5,6 +5,7 @@ import ru.dbotthepony.mc.otm.block.entity.storage.StorageBusBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
import ru.dbotthepony.mc.otm.menu.input.IntInputWithFeedback import ru.dbotthepony.mc.otm.menu.input.IntInputWithFeedback
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
@ -20,6 +21,7 @@ class StorageBusMenu(
val insertPriority = IntInputWithFeedback(this, tile?.let { it::insertPriority }) val insertPriority = IntInputWithFeedback(this, tile?.let { it::insertPriority })
val extractPriority = IntInputWithFeedback(this, tile?.let { it::extractPriority }) val extractPriority = IntInputWithFeedback(this, tile?.let { it::extractPriority })
val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget) val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig)
val mode = EnumInputWithFeedback(this, tile?.let { it::mode }, FlowDirection.WITHOUT_NONE) val mode = EnumInputWithFeedback(this, tile?.let { it::mode }, FlowDirection.WITHOUT_NONE)
init { init {

View File

@ -1,22 +0,0 @@
package ru.dbotthepony.mc.otm.menu.storage
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.block.entity.storage.StorageExporterBlockEntity
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.registry.MMenus
class StorageExporterMenu(
p_38852_: Int,
inventory: Inventory,
tile: StorageExporterBlockEntity? = null
) : MatteryPoweredMenu(
MMenus.STORAGE_EXPORTER, p_38852_, inventory, tile
) {
val busFilterSlots = addFilterSlots(tile?.filter, StorageExporterBlockEntity.MAX_FILTERS)
val busFilterState = BooleanInputWithFeedback(this, tile?.let { it.filter::isWhitelist })
init {
addInventorySlots()
}
}

View File

@ -0,0 +1,24 @@
package ru.dbotthepony.mc.otm.menu.storage
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.block.entity.storage.AbstractStorageImportExport
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus
class StorageImporterExporterMenu(
containerId: Int, inventory: Inventory, tile: AbstractStorageImportExport? = null
) : MatteryPoweredMenu(MMenus.STORAGE_IMPORTER_EXPORTER, containerId, inventory, tile) {
val filterSlots = addFilterSlots(tile?.filter, AbstractStorageImportExport.MAX_FILTERS)
val isWhitelist = BooleanInputWithFeedback(this, tile?.let { it.filter::isWhitelist })
val matchNBT = BooleanInputWithFeedback(this, tile?.let { it.filter::matchNBT })
val matchTag = BooleanInputWithFeedback(this, tile?.let { it.filter::matchTag })
val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig)
init {
addInventorySlots()
}
}

View File

@ -1,18 +0,0 @@
package ru.dbotthepony.mc.otm.menu.storage
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.block.entity.storage.StorageImporterBlockEntity
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.registry.MMenus
class StorageImporterMenu(
containerId: Int, inventory: Inventory, tile: StorageImporterBlockEntity? = null
) : MatteryPoweredMenu(MMenus.STORAGE_IMPORTER, containerId, inventory, tile) {
val busFilterSlots = addFilterSlots(tile?.filter, StorageImporterBlockEntity.MAX_FILTERS)
val busFilterState = BooleanInputWithFeedback(this, tile?.let { it.filter::isWhitelist })
init {
addInventorySlots()
}
}

View File

@ -26,8 +26,7 @@ import ru.dbotthepony.mc.otm.client.screen.storage.DriveRackScreen
import ru.dbotthepony.mc.otm.client.screen.storage.DriveViewerScreen import ru.dbotthepony.mc.otm.client.screen.storage.DriveViewerScreen
import ru.dbotthepony.mc.otm.client.screen.storage.ItemMonitorScreen import ru.dbotthepony.mc.otm.client.screen.storage.ItemMonitorScreen
import ru.dbotthepony.mc.otm.client.screen.storage.StorageBusScreen import ru.dbotthepony.mc.otm.client.screen.storage.StorageBusScreen
import ru.dbotthepony.mc.otm.client.screen.storage.StorageExporterScreen import ru.dbotthepony.mc.otm.client.screen.storage.StorageImporterExporterScreen
import ru.dbotthepony.mc.otm.client.screen.storage.StorageImporterScreen
import ru.dbotthepony.mc.otm.client.screen.storage.StoragePowerSupplierScreen import ru.dbotthepony.mc.otm.client.screen.storage.StoragePowerSupplierScreen
import ru.dbotthepony.mc.otm.client.screen.tech.AndroidChargerScreen import ru.dbotthepony.mc.otm.client.screen.tech.AndroidChargerScreen
import ru.dbotthepony.mc.otm.client.screen.tech.AndroidStationScreen import ru.dbotthepony.mc.otm.client.screen.tech.AndroidStationScreen
@ -57,8 +56,7 @@ import ru.dbotthepony.mc.otm.menu.storage.DriveRackMenu
import ru.dbotthepony.mc.otm.menu.storage.DriveViewerMenu import ru.dbotthepony.mc.otm.menu.storage.DriveViewerMenu
import ru.dbotthepony.mc.otm.menu.storage.ItemMonitorMenu import ru.dbotthepony.mc.otm.menu.storage.ItemMonitorMenu
import ru.dbotthepony.mc.otm.menu.storage.StorageBusMenu import ru.dbotthepony.mc.otm.menu.storage.StorageBusMenu
import ru.dbotthepony.mc.otm.menu.storage.StorageExporterMenu import ru.dbotthepony.mc.otm.menu.storage.StorageImporterExporterMenu
import ru.dbotthepony.mc.otm.menu.storage.StorageImporterMenu
import ru.dbotthepony.mc.otm.menu.storage.StoragePowerSupplierMenu import ru.dbotthepony.mc.otm.menu.storage.StoragePowerSupplierMenu
import ru.dbotthepony.mc.otm.menu.tech.AndroidChargerMenu import ru.dbotthepony.mc.otm.menu.tech.AndroidChargerMenu
import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu
@ -104,8 +102,7 @@ object MMenus {
val FLUID_TANK: MenuType<FluidTankMenu> by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu, FeatureFlags.VANILLA_SET) } val FLUID_TANK: MenuType<FluidTankMenu> by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu, FeatureFlags.VANILLA_SET) }
val STORAGE_BUS: MenuType<StorageBusMenu> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu, FeatureFlags.VANILLA_SET) } val STORAGE_BUS: MenuType<StorageBusMenu> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu, FeatureFlags.VANILLA_SET) }
val STORAGE_EXPORTER: MenuType<StorageExporterMenu> by registry.register(MNames.STORAGE_EXPORTER) { MenuType(::StorageExporterMenu, FeatureFlags.VANILLA_SET) } val STORAGE_IMPORTER_EXPORTER: MenuType<StorageImporterExporterMenu> by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterExporterMenu, FeatureFlags.VANILLA_SET) }
val STORAGE_IMPORTER: MenuType<StorageImporterMenu> by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterMenu, FeatureFlags.VANILLA_SET) }
val STORAGE_POWER_SUPPLIER: MenuType<StoragePowerSupplierMenu> by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu, FeatureFlags.VANILLA_SET) } val STORAGE_POWER_SUPPLIER: MenuType<StoragePowerSupplierMenu> by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu, FeatureFlags.VANILLA_SET) }
internal fun register(bus: IEventBus) { internal fun register(bus: IEventBus) {
@ -113,7 +110,6 @@ object MMenus {
bus.addListener(this::registerClient) bus.addListener(this::registerClient)
} }
@Suppress("unchecked_cast")
private fun registerClient(event: FMLClientSetupEvent) { private fun registerClient(event: FMLClientSetupEvent) {
event.enqueueWork { event.enqueueWork {
MenuScreens.register(ANDROID_STATION, ::AndroidStationScreen) MenuScreens.register(ANDROID_STATION, ::AndroidStationScreen)
@ -137,8 +133,7 @@ object MMenus {
MenuScreens.register(TWIN_PLATE_PRESS, ::TwinPlatePressScreen) MenuScreens.register(TWIN_PLATE_PRESS, ::TwinPlatePressScreen)
MenuScreens.register(MATTER_RECYCLER, ::MatterRecyclerScreen) MenuScreens.register(MATTER_RECYCLER, ::MatterRecyclerScreen)
MenuScreens.register(STORAGE_BUS, ::StorageBusScreen) MenuScreens.register(STORAGE_BUS, ::StorageBusScreen)
MenuScreens.register(STORAGE_EXPORTER, ::StorageExporterScreen) MenuScreens.register(STORAGE_IMPORTER_EXPORTER, ::StorageImporterExporterScreen)
MenuScreens.register(STORAGE_IMPORTER, ::StorageImporterScreen)
MenuScreens.register(STORAGE_POWER_SUPPLIER, ::StoragePowerSupplierScreen) MenuScreens.register(STORAGE_POWER_SUPPLIER, ::StoragePowerSupplierScreen)
MenuScreens.register(ENERGY_SERVO, ::EnergyServoScreen) MenuScreens.register(ENERGY_SERVO, ::EnergyServoScreen)
MenuScreens.register(HOLO_SIGN, ::HoloSignScreen) MenuScreens.register(HOLO_SIGN, ::HoloSignScreen)