Add redstone control to battery bank menu
This commit is contained in:
parent
0ad7618ad7
commit
12779ddc62
@ -6,12 +6,13 @@ import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
|
||||
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.widget.WidePowerGaugePanel
|
||||
|
||||
class BatteryBankScreen(menu: BatteryBankMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||
MatteryScreen<BatteryBankMenu>(menu, p_97742_, p_97743_) {
|
||||
|
||||
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerLevel, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
||||
@ -22,6 +23,8 @@ class BatteryBankScreen(menu: BatteryBankMenu, p_97742_: Inventory, p_97743_: Co
|
||||
for (i in 6 .. 11)
|
||||
BatterySlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * (i - 6), 32f + 18f)
|
||||
|
||||
makeDeviceControls(this, frame, redstone = menu.redstone)
|
||||
|
||||
return frame
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import kotlin.jvm.JvmOverloads
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.BatteryBankBlockEntity
|
||||
import net.minecraft.world.SimpleContainer
|
||||
import ru.dbotthepony.mc.otm.block.entity.RedstoneSetting
|
||||
import ru.dbotthepony.mc.otm.core.ImmutableList
|
||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
@ -12,6 +13,7 @@ import ru.dbotthepony.mc.otm.core.orNull
|
||||
import ru.dbotthepony.mc.otm.menu.BatterySlot
|
||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
||||
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||
|
||||
class BatteryBankMenu @JvmOverloads constructor(
|
||||
@ -21,8 +23,13 @@ class BatteryBankMenu @JvmOverloads constructor(
|
||||
) : MatteryMenu(MMenus.BATTERY_BANK, p_38852_, inventory, tile) {
|
||||
val powerLevel: LevelGaugeWidget
|
||||
override val storageSlots: List<MatterySlot>
|
||||
val redstone = EnumInputWithFeedback(this, RedstoneSetting::class.java)
|
||||
|
||||
init {
|
||||
if (tile != null) {
|
||||
redstone.with(tile.redstoneControl::redstoneSetting)
|
||||
}
|
||||
|
||||
val container: Container = tile?.container ?: SimpleContainer(BatteryBankBlockEntity.CAPACITY)
|
||||
powerLevel = LevelGaugeWidget(this, tile?.getCapability(MatteryCapability.ENERGY)?.orNull())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user