Battery slot background icon
This commit is contained in:
parent
b5f5b800cd
commit
f63a87298d
@ -13,4 +13,5 @@ object Widgets18 {
|
||||
val C = GRID.next()
|
||||
val CROSS = GRID.next()
|
||||
val FORWARD_SLASH = GRID.next()
|
||||
val BATTERY_SLOT_BACKGROUND = GRID.next()
|
||||
}
|
||||
|
@ -470,6 +470,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
||||
val canvas = object : DraggableCanvasPanel(this@AndroidStationScreen, null) {
|
||||
private val random = Random()
|
||||
private var scroller: PreviewScrollers = PreviewScrollers.values().let { it[random.nextInt(it.size)] }
|
||||
private var firstTick = false
|
||||
|
||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
drawColor = RGBAColor.BLACK
|
||||
@ -488,7 +489,11 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
||||
override fun tick() {
|
||||
super.tick()
|
||||
|
||||
if (isPreview) {
|
||||
if (isPreview && !layoutInvalidated) {
|
||||
if (firstTick) {
|
||||
scroller.init.invoke(this, random)
|
||||
}
|
||||
|
||||
val status = scroller.scroll.invoke(this, random)
|
||||
|
||||
if (!status) {
|
||||
@ -606,7 +611,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
||||
it.dock = Dock.TOP
|
||||
}
|
||||
|
||||
SlotPanel(this, stripLeft, menu.batterySlot).also {
|
||||
BatterySlotPanel(this, stripLeft, menu.batterySlot).also {
|
||||
it.dock = Dock.TOP
|
||||
it.dockTop = 6f
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.BatteryBankMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
@ -17,10 +18,10 @@ class BatteryBankScreen(menu: BatteryBankMenu, p_97742_: Inventory, p_97743_: Co
|
||||
WidePowerGaugePanel(this, frame, menu.powerLevel, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
||||
|
||||
for (i in 0 .. 5)
|
||||
SlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * i, 32f)
|
||||
BatterySlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * i, 32f)
|
||||
|
||||
for (i in 6 .. 11)
|
||||
SlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * (i - 6), 32f + 18f)
|
||||
BatterySlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * (i - 6), 32f + 18f)
|
||||
|
||||
return frame
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class ChemicalGeneratorScreen(menu: ChemicalGeneratorMenu, inventory: Inventory,
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.energy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
val self = this
|
||||
val progress = object : ProgressGaugePanel(self, frame, menu.progress, 78f, PROGRESS_ARROW_TOP) {
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.DriveRackMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
@ -15,7 +16,7 @@ class DriveRackScreen(menu: DriveRackMenu, inventory: Inventory, title: Componen
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.storageSlots[0], 71f, 32f)
|
||||
SlotPanel(this, frame, menu.storageSlots[1], 71f + 18f, 32f)
|
||||
|
@ -46,7 +46,7 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp
|
||||
}
|
||||
|
||||
views.add(PowerGaugePanel(this, frame, menu.powerWidget, 8f, 16f))
|
||||
views.add(SlotPanel(this, frame, menu.batterySlot, 8f, 67f))
|
||||
views.add(BatterySlotPanel(this, frame, menu.batterySlot, 8f, 67f))
|
||||
views.add(SlotPanel(this, frame, menu.driveSlot, 8f, 85f))
|
||||
|
||||
val grid = GridPanel(this, frame, 28f, 16f, GRID_WIDTH * 18f, GRID_HEIGHT * 18f, GRID_WIDTH, GRID_HEIGHT)
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.ButtonPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
@ -22,7 +23,7 @@ class MatterBottlerScreen(menu: MatterBottlerMenu, inventory: Inventory, title:
|
||||
val p = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matterWidget, LEFT_MARGIN + p.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
for (i in 0 .. 2) {
|
||||
SlotPanel(this, frame, menu.storageSlots[i], 31f + i * 18, PROGRESS_SLOT_TOP)
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.MatterDecomposerMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
|
||||
@ -18,7 +19,7 @@ class MatterDecomposerScreen(p_97741_: MatterDecomposerMenu, p_97742_: Inventory
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matterWidget, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.input, 56f, PROGRESS_SLOT_TOP)
|
||||
ProgressGaugePanel(this, frame, menu.progressWidget, 78f, PROGRESS_ARROW_TOP)
|
||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
|
||||
@ -16,7 +17,7 @@ class MatterRecyclerScreen(menu: MatterRecyclerMenu, inventory: Inventory, title
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matter, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
ProgressGaugePanel(this, frame, menu.progress, 63f, PROGRESS_ARROW_TOP).flop = true
|
||||
SlotPanel(this, frame, menu.input, 93f, PROGRESS_SLOT_TOP)
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.MatterReplicatorMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
|
||||
@ -17,7 +18,7 @@ class MatterReplicatorScreen(p_97741_: MatterReplicatorMenu, p_97742_: Inventory
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
MatterGaugePanel(this, frame, menu.matter, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
ProgressGaugePanel(this, frame, menu.progress, 54f, PROGRESS_ARROW_TOP)
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.menu.MatterScannerMenu
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PatternGaugePanel
|
||||
@ -17,7 +18,7 @@ class MatterScannerScreen(p_97741_: MatterScannerMenu, p_97742_: Inventory, p_97
|
||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
PatternGaugePanel(this, frame, menu.patterns, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
ProgressGaugePanel(this, frame, menu.progress, 63f, PROGRESS_ARROW_TOP).flop = true
|
||||
SlotPanel(this, frame, menu.input, 93f, PROGRESS_SLOT_TOP)
|
||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
@ -15,7 +16,7 @@ class PlatePressScreen(menu: PlatePressMenu, inventory: Inventory, title: Compon
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.inputSlot, 56f, PROGRESS_SLOT_TOP)
|
||||
ProgressGaugePanel(this, frame, menu.progressGauge, 78f, PROGRESS_ARROW_TOP)
|
||||
|
@ -3,10 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxLabelInputPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FilterSlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
||||
|
||||
@ -18,7 +15,7 @@ class StorageBusScreen(menu: StorageBusMenu, inventory: Inventory, title: Compon
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
for (row in 0 .. 2) {
|
||||
for (column in 0 .. 5) {
|
||||
|
@ -3,10 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxLabelInputPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FilterSlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
||||
|
||||
@ -18,7 +15,7 @@ class StorageExporterScreen(menu: StorageExporterMenu, inventory: Inventory, tit
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
for (row in 0 .. 2) {
|
||||
for (column in 0 .. 5) {
|
||||
|
@ -3,10 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxLabelInputPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FilterSlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
||||
|
||||
@ -18,7 +15,7 @@ class StorageImporterScreen(menu: StorageImporterMenu, inventory: Inventory, tit
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
for (row in 0 .. 2) {
|
||||
for (column in 0 .. 5) {
|
||||
|
@ -16,7 +16,7 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
SlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
object : Label(this@StoragePowerSupplierScreen, frame, 28f, 17f, width = 140f) {
|
||||
override fun tick() {
|
||||
|
@ -8,10 +8,7 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions
|
||||
import org.lwjgl.opengl.GL11
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||
import ru.dbotthepony.mc.otm.client.render.drawColor
|
||||
import ru.dbotthepony.mc.otm.client.render.drawRect
|
||||
import ru.dbotthepony.mc.otm.client.render.drawTexturedRectAuto
|
||||
import ru.dbotthepony.mc.otm.client.render.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.core.RGBAColor
|
||||
|
||||
@ -21,7 +18,8 @@ abstract class AbstractSlotPanel @JvmOverloads constructor(
|
||||
x: Float = 0f,
|
||||
y: Float = 0f,
|
||||
width: Float = SIZE,
|
||||
height: Float = SIZE
|
||||
height: Float = SIZE,
|
||||
open val noItemIcon: SkinElement? = null
|
||||
) : EditablePanel(
|
||||
screen, parent, x, y, width, height
|
||||
) {
|
||||
@ -86,7 +84,12 @@ abstract class AbstractSlotPanel @JvmOverloads constructor(
|
||||
|
||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
||||
renderRegular(stack, getItemStack())
|
||||
val itemStack = getItemStack()
|
||||
renderRegular(stack, itemStack)
|
||||
|
||||
if (itemStack.isEmpty) {
|
||||
noItemIcon?.render(stack, width = width, height = height)
|
||||
}
|
||||
}
|
||||
|
||||
override fun innerRenderTooltips(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float): Boolean {
|
||||
|
@ -124,8 +124,10 @@ open class EditablePanel @JvmOverloads constructor(
|
||||
protected val children = ArrayList<EditablePanel>()
|
||||
val childrenView: List<EditablePanel> = Collections.unmodifiableList(children)
|
||||
|
||||
private var layoutInvalidated = true
|
||||
private var boundsInvalidated = true
|
||||
var layoutInvalidated = true
|
||||
private set
|
||||
var boundsInvalidated = true
|
||||
private set
|
||||
|
||||
protected var visibleAsChildren: Boolean = true
|
||||
private set
|
||||
|
@ -9,6 +9,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu
|
||||
import net.minecraft.world.inventory.Slot
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.client.render.SkinElement
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||
import ru.dbotthepony.mc.otm.client.render.drawRect
|
||||
import ru.dbotthepony.mc.otm.client.render.setDrawColor
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
@ -20,9 +22,10 @@ open class SlotPanel<T : Slot>(
|
||||
val slot: T,
|
||||
x: Float = 0f,
|
||||
y: Float = 0f,
|
||||
width: Float = 18f,
|
||||
height: Float = 18f
|
||||
) : AbstractSlotPanel(screen, parent, x, y, width, height) {
|
||||
width: Float = AbstractSlotPanel.SIZE,
|
||||
height: Float = AbstractSlotPanel.SIZE,
|
||||
noItemIcon: SkinElement? = null
|
||||
) : AbstractSlotPanel(screen, parent, x, y, width, height, noItemIcon) {
|
||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||
screen.returnSlot = slot
|
||||
return true
|
||||
@ -91,6 +94,8 @@ open class SlotPanel<T : Slot>(
|
||||
val texture = minecraft.getTextureAtlas(icon.first).apply(icon.second)
|
||||
RenderSystem.setShaderTexture(0, texture.atlas().location())
|
||||
GuiComponent.blit(stack, 1, 1, 0, 16, 16, texture)
|
||||
} else {
|
||||
noItemIcon?.render(stack, width = width, height = height)
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,4 +110,14 @@ open class SlotPanel<T : Slot>(
|
||||
// no op, screen does it for us (completely)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : Slot> BatterySlotPanel(
|
||||
screen: MatteryScreen<*>,
|
||||
parent: EditablePanel?,
|
||||
slot: T,
|
||||
x: Float = 0f,
|
||||
y: Float = 0f,
|
||||
width: Float = AbstractSlotPanel.SIZE,
|
||||
height: Float = AbstractSlotPanel.SIZE,
|
||||
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.BATTERY_SLOT_BACKGROUND)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
src/main/resources/assets/overdrive_that_matters/textures/gui/widgets_18.xcf
(Stored with Git LFS)
BIN
src/main/resources/assets/overdrive_that_matters/textures/gui/widgets_18.xcf
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue
Block a user