Proper charge slot background
This commit is contained in:
parent
2e894abd67
commit
f598cc7bbd
@ -58,6 +58,7 @@ object Widgets18 {
|
|||||||
val EQUIPMENT_BATTERY_SLOT_BACKGROUND = slotBgGrid.next()
|
val EQUIPMENT_BATTERY_SLOT_BACKGROUND = slotBgGrid.next()
|
||||||
val PATTERN_SLOT_BACKGROUND = slotBgGrid.next()
|
val PATTERN_SLOT_BACKGROUND = slotBgGrid.next()
|
||||||
val MATTER_CAPACITOR_SLOT_BACKGROUND = slotBgGrid.next()
|
val MATTER_CAPACITOR_SLOT_BACKGROUND = slotBgGrid.next()
|
||||||
|
val CHARGE_SLOT_BACKGROUND = slotBgGrid.next()
|
||||||
|
|
||||||
private val controlsGrid = WidgetLocation.SIDE_CONTROLS.grid(rows = 8, columns = 9)
|
private val controlsGrid = WidgetLocation.SIDE_CONTROLS.grid(rows = 8, columns = 9)
|
||||||
|
|
||||||
|
@ -218,7 +218,10 @@ class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen<ExoPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (slot in menu.exoPackChargeSlots) {
|
for (slot in menu.exoPackChargeSlots) {
|
||||||
SlotPanel(this, chargeStrip2, slot).dock = Dock.BOTTOM
|
SlotPanel(this, chargeStrip2, slot).also {
|
||||||
|
it.dock = Dock.BOTTOM
|
||||||
|
it.slotBackground = Widgets18.CHARGE_SLOT_BACKGROUND
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollPanel.dock = Dock.RIGHT
|
scrollPanel.dock = Dock.RIGHT
|
||||||
|
@ -21,10 +21,13 @@ abstract class AbstractSlotPanel<out S : MatteryScreen<*>> @JvmOverloads constru
|
|||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
height: Float = SIZE,
|
height: Float = SIZE,
|
||||||
open val noItemIcon: IGUIRenderable? = null
|
open var noItemIcon: IGUIRenderable? = null
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height), IItemStackPanel {
|
) : EditablePanel<S>(screen, parent, x, y, width, height), IItemStackPanel {
|
||||||
|
open var slotBackground: IGUIRenderable? = null
|
||||||
|
|
||||||
protected open fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
protected open fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
SLOT_BACKGROUND.render(graphics, width = width, height = height)
|
SLOT_BACKGROUND.render(graphics, width = width, height = height)
|
||||||
|
slotBackground?.render(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun renderRegular(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String? = null) {
|
protected open fun renderRegular(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String? = null) {
|
||||||
|
@ -24,11 +24,9 @@ open class InventorySlotPanel<out S : MatteryScreen<*>, out T : MatteryMenu.Inve
|
|||||||
get() = slot.filter?.get()
|
get() = slot.filter?.get()
|
||||||
set(value) { slot.filter?.accept(value) }
|
set(value) { slot.filter?.accept(value) }
|
||||||
|
|
||||||
override fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun renderBackgroundBeforeFilter(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
super.renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
|
||||||
|
|
||||||
if (slot.chargeFlag?.get() == true) {
|
if (slot.chargeFlag?.get() == true) {
|
||||||
Widgets18.BATTERY_SLOT_BACKGROUND.render(graphics, 0f, 0f, width, height)
|
Widgets18.CHARGE_SLOT_BACKGROUND.render(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +36,13 @@ abstract class UserFilteredSlotPanel<out S : MatteryScreen<*>, out T : Slot>(
|
|||||||
) : SlotPanel<S, T>(screen, parent, slot, x, y, width, height, noItemIcon) {
|
) : SlotPanel<S, T>(screen, parent, slot, x, y, width, height, noItemIcon) {
|
||||||
abstract var slotFilter: Item?
|
abstract var slotFilter: Item?
|
||||||
|
|
||||||
|
protected open fun renderBackgroundBeforeFilter(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {}
|
||||||
|
|
||||||
override fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
super.renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
super.renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
|
renderBackgroundBeforeFilter(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
if (slotFilter != null) {
|
if (slotFilter != null) {
|
||||||
if (slotFilter !== Items.AIR) {
|
if (slotFilter !== Items.AIR) {
|
||||||
val itemStack = ItemStack(slotFilter!!, 1)
|
val itemStack = ItemStack(slotFilter!!, 1)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Loading…
Reference in New Issue
Block a user