Make EditablePanel be generic and upper-bound to Screen
This commit is contained in:
parent
7b478d485a
commit
a6a06fd4cd
@ -1,11 +1,13 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels;
|
package ru.dbotthepony.mc.otm.client.screen.panels;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen;
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class FlexGridPanel extends EditablePanel {
|
public class FlexGridPanel<S extends Screen> extends EditablePanel<S> {
|
||||||
public enum FlexAlign {
|
public enum FlexAlign {
|
||||||
TOP_LEFT,
|
TOP_LEFT,
|
||||||
TOP_CENTER,
|
TOP_CENTER,
|
||||||
@ -23,15 +25,15 @@ public class FlexGridPanel extends EditablePanel {
|
|||||||
protected FlexAlign align = FlexAlign.MIDDLE_CENTER;
|
protected FlexAlign align = FlexAlign.MIDDLE_CENTER;
|
||||||
public int panels_per_row = 1;
|
public int panels_per_row = 1;
|
||||||
|
|
||||||
public FlexGridPanel(@Nonnull MatteryScreen<?> screen, @Nullable EditablePanel parent, float x, float y, float width, float height) {
|
public FlexGridPanel(@Nonnull S screen, @Nullable EditablePanel<?> parent, float x, float y, float width, float height) {
|
||||||
super(screen, parent, x, y, width, height);
|
super(screen, parent, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlexGridPanel(@Nonnull MatteryScreen<?> screen, @Nullable EditablePanel parent, float x, float y) {
|
public FlexGridPanel(@Nonnull S screen, @Nullable EditablePanel<?> parent, float x, float y) {
|
||||||
super(screen, parent, x, y);
|
super(screen, parent, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlexGridPanel(@Nonnull MatteryScreen<?> screen, @Nullable EditablePanel parent) {
|
public FlexGridPanel(@Nonnull S screen, @Nullable EditablePanel<?> parent) {
|
||||||
super(screen, parent);
|
super(screen, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ public class FlexGridPanel extends EditablePanel {
|
|||||||
return align;
|
return align;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlexGridPanel setAlign(FlexAlign align) {
|
public FlexGridPanel<S> setAlign(FlexAlign align) {
|
||||||
this.align = align;
|
this.align = align;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ private class Tree(val node: AndroidResearchType<*>) : Iterable<Tree> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun put(
|
fun put(
|
||||||
rows: Int2ObjectFunction<EditablePanel>,
|
rows: Int2ObjectFunction<EditablePanel<AndroidStationScreen>>,
|
||||||
left: Float,
|
left: Float,
|
||||||
capability: MatteryPlayerCapability
|
capability: MatteryPlayerCapability
|
||||||
): Pair<AndroidResearchButton, Float> {
|
): Pair<AndroidResearchButton, Float> {
|
||||||
@ -247,11 +247,11 @@ private class Tree(val node: AndroidResearchType<*>) : Iterable<Tree> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class AndroidResearchButton(
|
private class AndroidResearchButton(
|
||||||
parent: EditablePanel,
|
parent: EditablePanel<AndroidStationScreen>,
|
||||||
private val node: AndroidResearch,
|
private val node: AndroidResearch,
|
||||||
private val lines: List<LinePos>,
|
private val lines: List<LinePos>,
|
||||||
private val highlightLines: Map<AndroidResearchType<*>, List<LinePos>>
|
private val highlightLines: Map<AndroidResearchType<*>, List<LinePos>>
|
||||||
) :EditablePanel(
|
): EditablePanel<AndroidStationScreen>(
|
||||||
parent.screen,
|
parent.screen,
|
||||||
parent,
|
parent,
|
||||||
0f,
|
0f,
|
||||||
@ -417,8 +417,8 @@ private class AndroidResearchButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum class PreviewScrollers(
|
private enum class PreviewScrollers(
|
||||||
val init: (EditablePanel, Random) -> Unit,
|
val init: (EditablePanel<*>, Random) -> Unit,
|
||||||
val scroll: (EditablePanel, Random) -> Boolean
|
val scroll: (EditablePanel<*>, Random) -> Boolean
|
||||||
) {
|
) {
|
||||||
LEFT_TO_RIGHT(
|
LEFT_TO_RIGHT(
|
||||||
init = { it, random ->
|
init = { it, random ->
|
||||||
@ -472,10 +472,10 @@ private enum class PreviewScrollers(
|
|||||||
class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: Inventory, p_97743_: Component) :
|
class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<AndroidStationMenu>(p_97741_, p_97742_, p_97743_) {
|
MatteryScreen<AndroidStationMenu>(p_97741_, p_97742_, p_97743_) {
|
||||||
|
|
||||||
private fun makeCanvas(isPreview: Boolean): DraggableCanvasPanel {
|
private fun makeCanvas(isPreview: Boolean): DraggableCanvasPanel<AndroidStationScreen> {
|
||||||
val rows = Int2ObjectAVLTreeMap<EditablePanel>()
|
val rows = Int2ObjectAVLTreeMap<EditablePanel<AndroidStationScreen>>()
|
||||||
|
|
||||||
val canvas = object : DraggableCanvasPanel(this@AndroidStationScreen, null) {
|
val canvas = object : DraggableCanvasPanel<AndroidStationScreen>(this@AndroidStationScreen, null) {
|
||||||
private val random = Random()
|
private val random = Random()
|
||||||
private var scroller: PreviewScrollers = PreviewScrollers.values().let { it[random.nextInt(it.size)] }
|
private var scroller: PreviewScrollers = PreviewScrollers.values().let { it[random.nextInt(it.size)] }
|
||||||
private var firstTick = false
|
private var firstTick = false
|
||||||
@ -522,7 +522,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
|
|
||||||
for (i in 0 .. tree.height) {
|
for (i in 0 .. tree.height) {
|
||||||
rows.computeIfAbsent(i, Int2ObjectFunction {
|
rows.computeIfAbsent(i, Int2ObjectFunction {
|
||||||
object : EditablePanel(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
object : EditablePanel<AndroidStationScreen>(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int) = false
|
override fun mouseClickedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseReleasedInner(x: Double, y: Double, button: Int) = false
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double) = false
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double) = false
|
||||||
@ -536,7 +536,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
|
|
||||||
for (research in graph.second) {
|
for (research in graph.second) {
|
||||||
val row = rows.computeIfAbsent(research.researchTreeDepth, Int2ObjectFunction {
|
val row = rows.computeIfAbsent(research.researchTreeDepth, Int2ObjectFunction {
|
||||||
object : EditablePanel(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
object : EditablePanel<AndroidStationScreen>(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int) = false
|
override fun mouseClickedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseReleasedInner(x: Double, y: Double, button: Int) = false
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double) = false
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double) = false
|
||||||
@ -568,8 +568,8 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
|
||||||
private var research: FramePanel? = null
|
private var research: FramePanel<AndroidStationScreen>? = null
|
||||||
private var playerStrip: EditablePanel by Delegates.notNull()
|
private var playerStrip: EditablePanel<AndroidStationScreen> by Delegates.notNull()
|
||||||
var hoveredResearch: AndroidResearch? = null
|
var hoveredResearch: AndroidResearch? = null
|
||||||
|
|
||||||
private fun openResearchTree() {
|
private fun openResearchTree() {
|
||||||
@ -614,10 +614,10 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<AndroidStationScreen> {
|
||||||
val frame = FramePanel(this, 200f, 108f, title)
|
val frame = FramePanel(this, 200f, 108f, title)
|
||||||
|
|
||||||
object : Label(this@AndroidStationScreen, frame, height = 11f, shadow = true) {
|
object : Label<AndroidStationScreen>(this@AndroidStationScreen, frame, height = 11f, shadow = true) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.BOTTOM
|
dock = Dock.BOTTOM
|
||||||
dockTop = 2f
|
dockTop = 2f
|
||||||
|
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
|||||||
class BatteryBankScreen(menu: BatteryBankMenu, p_97742_: Inventory, p_97743_: Component) :
|
class BatteryBankScreen(menu: BatteryBankMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<BatteryBankMenu>(menu, p_97742_, p_97743_) {
|
MatteryScreen<BatteryBankMenu>(menu, p_97742_, p_97743_) {
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel{
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.powerLevel, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
WidePowerGaugePanel(this, frame, menu.powerLevel, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
||||||
|
@ -8,7 +8,7 @@ import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
|||||||
import ru.dbotthepony.mc.otm.menu.CargoCrateMenu
|
import ru.dbotthepony.mc.otm.menu.CargoCrateMenu
|
||||||
|
|
||||||
class CargoCrateScreen(menu: CargoCrateMenu, inventory: Inventory, title: Component) : MatteryScreen<CargoCrateMenu>(menu, inventory, title) {
|
class CargoCrateScreen(menu: CargoCrateMenu, inventory: Inventory, title: Component) : MatteryScreen<CargoCrateMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, 22f + 4f + 6f * 18f, getTitle())
|
val frame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, 22f + 4f + 6f * 18f, getTitle())
|
||||||
val grid = GridPanel(this, frame, 8f, 18f, 9f * 18f, 6f * 18f, 9, 6)
|
val grid = GridPanel(this, frame, 8f, 18f, 9f * 18f, 6f * 18f, 9, 6)
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@ import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
|||||||
import ru.dbotthepony.mc.otm.menu.ChemicalGeneratorMenu
|
import ru.dbotthepony.mc.otm.menu.ChemicalGeneratorMenu
|
||||||
|
|
||||||
class ChemicalGeneratorScreen(menu: ChemicalGeneratorMenu, inventory: Inventory, title: Component) : MatteryScreen<ChemicalGeneratorMenu>(menu, inventory, title) {
|
class ChemicalGeneratorScreen(menu: ChemicalGeneratorMenu, inventory: Inventory, title: Component) : MatteryScreen<ChemicalGeneratorMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.energy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
WidePowerGaugePanel(this, frame, menu.energy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
BatterySlotPanel(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 self = this
|
||||||
val progress = object : ProgressGaugePanel(self, frame, menu.progress, 78f, PROGRESS_ARROW_TOP) {
|
val progress = object : ProgressGaugePanel<ChemicalGeneratorScreen>(self, frame, menu.progress, 78f, PROGRESS_ARROW_TOP) {
|
||||||
override fun makeTooltip(): MutableList<Component> {
|
override fun makeTooltip(): MutableList<Component> {
|
||||||
val list = super.makeTooltip()
|
val list = super.makeTooltip()
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
|||||||
class DriveRackScreen(menu: DriveRackMenu, inventory: Inventory, title: Component) :
|
class DriveRackScreen(menu: DriveRackMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<DriveRackMenu>(menu, inventory, title) {
|
MatteryScreen<DriveRackMenu>(menu, inventory, title) {
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -16,11 +16,11 @@ import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak
|
|||||||
class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Component) :
|
class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<DriveViewerMenu>(menu, inventory, title) {
|
MatteryScreen<DriveViewerMenu>(menu, inventory, title) {
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = FramePanel(this, null, 0f, 0f, FRAME_WIDTH, FRAME_HEIGHT, getTitle())
|
val frame = FramePanel(this, null, 0f, 0f, FRAME_WIDTH, FRAME_HEIGHT, getTitle())
|
||||||
|
|
||||||
val views = ArrayList<EditablePanel>()
|
val views = ArrayList<EditablePanel<*>>()
|
||||||
val settings = ArrayList<EditablePanel>()
|
val settings = ArrayList<EditablePanel<*>>()
|
||||||
|
|
||||||
frame.Tab(onOpen = {
|
frame.Tab(onOpen = {
|
||||||
for (panel in views) {
|
for (panel in views) {
|
||||||
@ -54,7 +54,7 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp
|
|||||||
views.add(scrollBar)
|
views.add(scrollBar)
|
||||||
|
|
||||||
for (i in 0 until GRID_WIDTH * GRID_HEIGHT) {
|
for (i in 0 until GRID_WIDTH * GRID_HEIGHT) {
|
||||||
object : AbstractSlotPanel(this@DriveViewerScreen, grid, 0f, 0f) {
|
object : AbstractSlotPanel<DriveViewerScreen>(this@DriveViewerScreen, grid, 0f, 0f) {
|
||||||
override fun getItemStack(): ItemStack {
|
override fun getItemStack(): ItemStack {
|
||||||
val index = i + scrollBar.scroll * GRID_WIDTH
|
val index = i + scrollBar.scroll * GRID_WIDTH
|
||||||
return menu.networkedItemView.sortedView.getOrNull(index)?.stack?.item ?: ItemStack.EMPTY
|
return menu.networkedItemView.sortedView.getOrNull(index)?.stack?.item ?: ItemStack.EMPTY
|
||||||
|
@ -8,10 +8,10 @@ import ru.dbotthepony.mc.otm.core.formatPower
|
|||||||
import ru.dbotthepony.mc.otm.menu.EnergyCounterMenu
|
import ru.dbotthepony.mc.otm.menu.EnergyCounterMenu
|
||||||
|
|
||||||
class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title: Component) : MatteryScreen<EnergyCounterMenu>(menu, inventory, title) {
|
class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title: Component) : MatteryScreen<EnergyCounterMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
var label: Label = object : Label(this@EnergyCounterScreen, frame) {
|
var label: Label<EnergyCounterScreen> = object : Label<EnergyCounterScreen>(this@EnergyCounterScreen, frame) {
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
super.tick()
|
super.tick()
|
||||||
text = TranslatableComponent(
|
text = TranslatableComponent(
|
||||||
@ -24,7 +24,7 @@ class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title:
|
|||||||
label.dock = Dock.TOP
|
label.dock = Dock.TOP
|
||||||
label.setDockMargin(4f, 0f, 0f, 0f)
|
label.setDockMargin(4f, 0f, 0f, 0f)
|
||||||
|
|
||||||
label = object : Label(this@EnergyCounterScreen, frame) {
|
label = object : Label<EnergyCounterScreen>(this@EnergyCounterScreen, frame) {
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
super.tick()
|
super.tick()
|
||||||
text = TranslatableComponent(
|
text = TranslatableComponent(
|
||||||
@ -37,7 +37,7 @@ class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title:
|
|||||||
label.dock = Dock.TOP
|
label.dock = Dock.TOP
|
||||||
label.setDockMargin(4f, 0f, 0f, 0f)
|
label.setDockMargin(4f, 0f, 0f, 0f)
|
||||||
|
|
||||||
label = object : Label(this@EnergyCounterScreen, frame) {
|
label = object : Label<EnergyCounterScreen>(this@EnergyCounterScreen, frame) {
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
super.tick()
|
super.tick()
|
||||||
text = TranslatableComponent(
|
text = TranslatableComponent(
|
||||||
@ -50,7 +50,7 @@ class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title:
|
|||||||
label.dock = Dock.TOP
|
label.dock = Dock.TOP
|
||||||
label.setDockMargin(4f, 0f, 0f, 0f)
|
label.setDockMargin(4f, 0f, 0f, 0f)
|
||||||
|
|
||||||
label = object : Label(this@EnergyCounterScreen, frame) {
|
label = object : Label<EnergyCounterScreen>(this@EnergyCounterScreen, frame) {
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
super.tick()
|
super.tick()
|
||||||
text = TranslatableComponent(
|
text = TranslatableComponent(
|
||||||
@ -63,7 +63,7 @@ class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title:
|
|||||||
label.dock = Dock.TOP
|
label.dock = Dock.TOP
|
||||||
label.setDockMargin(4f, 0f, 0f, 0f)
|
label.setDockMargin(4f, 0f, 0f, 0f)
|
||||||
|
|
||||||
label = object : Label(this@EnergyCounterScreen, frame) {
|
label = object : Label<EnergyCounterScreen>(this@EnergyCounterScreen, frame) {
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
super.tick()
|
super.tick()
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak
|
|||||||
|
|
||||||
@MouseTweaksDisableWheelTweak
|
@MouseTweaksDisableWheelTweak
|
||||||
class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuitInventoryMenu>(menu, TranslatableComponent("otm.gui.exosuit")) {
|
class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuitInventoryMenu>(menu, TranslatableComponent("otm.gui.exosuit")) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = FramePanel(this, width = 200f, height = 180f, title = this.title)
|
val frame = FramePanel(this, width = 200f, height = 180f, title = this.title)
|
||||||
|
|
||||||
val toolbeltLine = EditablePanel(this, frame, height = 18f)
|
val toolbeltLine = EditablePanel(this, frame, height = 18f)
|
||||||
@ -23,7 +23,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
|
|||||||
|
|
||||||
toolbeltLine.setDockMargin(top = 3f)
|
toolbeltLine.setDockMargin(top = 3f)
|
||||||
|
|
||||||
var mainInventoryLine: EditablePanel? = null
|
var mainInventoryLine: EditablePanel<*>? = null
|
||||||
|
|
||||||
val scrollPanel = DiscreteScrollBarPanel(this, null, maxScroll = { ((menu.playerCombinedInventorySlots.size - 27) + 8) / 9 },
|
val scrollPanel = DiscreteScrollBarPanel(this, null, maxScroll = { ((menu.playerCombinedInventorySlots.size - 27) + 8) / 9 },
|
||||||
scrollCallback = {
|
scrollCallback = {
|
||||||
@ -45,7 +45,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
|
|||||||
|
|
||||||
scrollPanel.scroll = menu.lastScroll
|
scrollPanel.scroll = menu.lastScroll
|
||||||
|
|
||||||
mainInventoryLine = object : EditablePanel(this@ExoSuitInventoryScreen, frame, height = 18f * 3f) {
|
mainInventoryLine = object : EditablePanel<ExoSuitInventoryScreen>(this@ExoSuitInventoryScreen, frame, height = 18f * 3f) {
|
||||||
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return scrollPanel.mouseScrolledInner(x, y, scroll)
|
return scrollPanel.mouseScrolledInner(x, y, scroll)
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
|
|||||||
|
|
||||||
val resultPanel = SlotPanel(this, craftingCanvas, menu.craftingResultSlot, x = craftingCanvas.width - 18f, y = topLine.height / 2f - 9f)
|
val resultPanel = SlotPanel(this, craftingCanvas, menu.craftingResultSlot, x = craftingCanvas.width - 18f, y = topLine.height / 2f - 9f)
|
||||||
|
|
||||||
val arrowPanel = object : EditablePanel(
|
val arrowPanel = object : EditablePanel<ExoSuitInventoryScreen>(
|
||||||
this@ExoSuitInventoryScreen,
|
this@ExoSuitInventoryScreen,
|
||||||
craftingCanvas,
|
craftingCanvas,
|
||||||
x = craftingSlotsCanvas.width,
|
x = craftingSlotsCanvas.width,
|
||||||
|
@ -27,7 +27,7 @@ import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak
|
|||||||
class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Component) :
|
class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<ItemMonitorMenu>(menu, inventory, title) {
|
MatteryScreen<ItemMonitorMenu>(menu, inventory, title) {
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = FramePanel(this@ItemMonitorScreen, null, 0f, 0f, 1f, 1f, getTitle())
|
val frame = FramePanel(this@ItemMonitorScreen, null, 0f, 0f, 1f, 1f, getTitle())
|
||||||
|
|
||||||
val topPanel = EditablePanel(this, frame)
|
val topPanel = EditablePanel(this, frame)
|
||||||
@ -54,7 +54,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
gridPanel.dock = Dock.FILL
|
gridPanel.dock = Dock.FILL
|
||||||
|
|
||||||
for (i in 0 until ITEM_GRID_WIDTH * ITEM_GRID_HEIGHT) {
|
for (i in 0 until ITEM_GRID_WIDTH * ITEM_GRID_HEIGHT) {
|
||||||
object : AbstractSlotPanel(this@ItemMonitorScreen, gridPanel) {
|
object : AbstractSlotPanel<ItemMonitorScreen>(this@ItemMonitorScreen, gridPanel) {
|
||||||
private val index get() = i + viewScrollBar.scroll * ITEM_GRID_WIDTH
|
private val index get() = i + viewScrollBar.scroll * ITEM_GRID_WIDTH
|
||||||
|
|
||||||
override fun getItemStack(): ItemStack {
|
override fun getItemStack(): ItemStack {
|
||||||
@ -113,7 +113,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
SlotPanel(this, craftingGrid, menu.craftingSlots[i])
|
SlotPanel(this, craftingGrid, menu.craftingSlots[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
val arrowAndButtons = object : EditablePanel(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.w) {
|
val arrowAndButtons = object : EditablePanel<ItemMonitorScreen>(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.w) {
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.h / 2f)
|
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.h / 2f)
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
craftingHistoryScroll.setDockMargin(left = 2f)
|
craftingHistoryScroll.setDockMargin(left = 2f)
|
||||||
|
|
||||||
for (i in 0 until 9) {
|
for (i in 0 until 9) {
|
||||||
object : AbstractSlotPanel(this@ItemMonitorScreen, craftingHistory) {
|
object : AbstractSlotPanel<ItemMonitorScreen>(this@ItemMonitorScreen, craftingHistory) {
|
||||||
override fun getItemStack(): ItemStack {
|
override fun getItemStack(): ItemStack {
|
||||||
return ItemStack(Items.ARROW, 42)
|
return ItemStack(Items.ARROW, 42)
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ import ru.dbotthepony.mc.otm.menu.MatterBottlerMenu
|
|||||||
class MatterBottlerScreen(menu: MatterBottlerMenu, inventory: Inventory, title: Component) :
|
class MatterBottlerScreen(menu: MatterBottlerMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<MatterBottlerMenu>(menu, inventory, title) {
|
MatteryScreen<MatterBottlerMenu>(menu, inventory, title) {
|
||||||
|
|
||||||
private var progress: ProgressGaugePanel? = null
|
private var progress: ProgressGaugePanel<MatterBottlerScreen>? = null
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val p = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
val p = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
|
|||||||
|
|
||||||
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 {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val m = MatterGaugePanel(this, frame, menu.matterGauge, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
val m = MatterGaugePanel(this, frame, menu.matterGauge, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
||||||
|
@ -13,7 +13,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
|||||||
class MatterDecomposerScreen(p_97741_: MatterDecomposerMenu, p_97742_: Inventory, p_97743_: Component) :
|
class MatterDecomposerScreen(p_97741_: MatterDecomposerMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<MatterDecomposerMenu>(p_97741_, p_97742_, p_97743_) {
|
MatteryScreen<MatterDecomposerMenu>(p_97741_, p_97742_, p_97743_) {
|
||||||
|
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -23,7 +23,7 @@ class MatterPanelScreen(
|
|||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
title: Component
|
title: Component
|
||||||
) : MatteryScreen<MatterPanelMenu>(menu, inventory, title) {
|
) : MatteryScreen<MatterPanelMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
var isPatternView = true
|
var isPatternView = true
|
||||||
|
|
||||||
val frame = FramePanel.padded(this, null, GRID_WIDTH * AbstractSlotPanel.SIZE + ScrollBarConstants.WIDTH + 4f, GRID_HEIGHT * AbstractSlotPanel.SIZE, title)
|
val frame = FramePanel.padded(this, null, GRID_WIDTH * AbstractSlotPanel.SIZE + ScrollBarConstants.WIDTH + 4f, GRID_HEIGHT * AbstractSlotPanel.SIZE, title)
|
||||||
@ -46,7 +46,7 @@ class MatterPanelScreen(
|
|||||||
it.tooltip = TranslatableComponent("otm.container.matter_panel.tasks")
|
it.tooltip = TranslatableComponent("otm.container.matter_panel.tasks")
|
||||||
}
|
}
|
||||||
|
|
||||||
val canvas = object : EditablePanel(this@MatterPanelScreen, frame, width = GRID_WIDTH * AbstractSlotPanel.SIZE) {
|
val canvas = object : EditablePanel<MatterPanelScreen>(this@MatterPanelScreen, frame, width = GRID_WIDTH * AbstractSlotPanel.SIZE) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.LEFT
|
dock = Dock.LEFT
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ class MatterPanelScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (row in 0 until GRID_HEIGHT) {
|
for (row in 0 until GRID_HEIGHT) {
|
||||||
val rowCanvas = object : EditablePanel(this@MatterPanelScreen, canvas, height = AbstractSlotPanel.SIZE) {
|
val rowCanvas = object : EditablePanel<MatterPanelScreen>(this@MatterPanelScreen, canvas, height = AbstractSlotPanel.SIZE) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.TOP
|
dock = Dock.TOP
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ class MatterPanelScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i in 0 until GRID_WIDTH) {
|
for (i in 0 until GRID_WIDTH) {
|
||||||
object : AbstractSlotPanel(this@MatterPanelScreen, rowCanvas) {
|
object : AbstractSlotPanel<MatterPanelScreen>(this@MatterPanelScreen, rowCanvas) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.LEFT
|
dock = Dock.LEFT
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ class MatterPanelScreen(
|
|||||||
private fun openTask(task: IReplicationTask<*>) {
|
private fun openTask(task: IReplicationTask<*>) {
|
||||||
val frame = FramePanel.padded(this, null, 170f, 20f, TranslatableComponent("otm.container.matter_panel.task"))
|
val frame = FramePanel.padded(this, null, 170f, 20f, TranslatableComponent("otm.container.matter_panel.task"))
|
||||||
|
|
||||||
object : AbstractSlotPanel(this@MatterPanelScreen, frame) {
|
object : AbstractSlotPanel<MatterPanelScreen>(this@MatterPanelScreen, frame) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.LEFT
|
dock = Dock.LEFT
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ class MatterPanelScreen(
|
|||||||
rowControls.dock = Dock.TOP
|
rowControls.dock = Dock.TOP
|
||||||
rowControls.dockTop = 3f
|
rowControls.dockTop = 3f
|
||||||
|
|
||||||
object : AbstractSlotPanel(this@MatterPanelScreen, rowInput) {
|
object : AbstractSlotPanel<MatterPanelScreen>(this@MatterPanelScreen, rowInput) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.LEFT
|
dock = Dock.LEFT
|
||||||
dockRight = 2f
|
dockRight = 2f
|
||||||
@ -209,7 +209,7 @@ class MatterPanelScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val input = object : EditBoxPanel(this@MatterPanelScreen, rowInput) {
|
val input = object : EditBoxPanel<MatterPanelScreen>(this@MatterPanelScreen, rowInput) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.FILL
|
dock = Dock.FILL
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
|||||||
import ru.dbotthepony.mc.otm.menu.MatterRecyclerMenu
|
import ru.dbotthepony.mc.otm.menu.MatterRecyclerMenu
|
||||||
|
|
||||||
class MatterRecyclerScreen(menu: MatterRecyclerMenu, inventory: Inventory, title: Component) : MatteryScreen<MatterRecyclerMenu>(menu, inventory, title) {
|
class MatterRecyclerScreen(menu: MatterRecyclerMenu, inventory: Inventory, title: Component) : MatteryScreen<MatterRecyclerMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
|||||||
|
|
||||||
class MatterReplicatorScreen(p_97741_: MatterReplicatorMenu, p_97742_: Inventory, p_97743_: Component) :
|
class MatterReplicatorScreen(p_97741_: MatterReplicatorMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<MatterReplicatorMenu>(p_97741_, p_97742_, p_97743_) {
|
MatteryScreen<MatterReplicatorMenu>(p_97741_, p_97742_, p_97743_) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
|||||||
|
|
||||||
class MatterScannerScreen(p_97741_: MatterScannerMenu, p_97742_: Inventory, p_97743_: Component) :
|
class MatterScannerScreen(p_97741_: MatterScannerMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<MatterScannerMenu>(p_97741_, p_97742_, p_97743_) {
|
MatteryScreen<MatterScannerMenu>(p_97741_, p_97742_, p_97743_) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
val m = PowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -32,10 +32,10 @@ import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
|||||||
abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, title: Component) : AbstractContainerScreen<T>(menu, inventory, title) {
|
abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, title: Component) : AbstractContainerScreen<T>(menu, inventory, title) {
|
||||||
constructor(menu: T, title: Component) : this(menu, menu.inventory, title)
|
constructor(menu: T, title: Component) : this(menu, menu.inventory, title)
|
||||||
|
|
||||||
protected val panels = ArrayDeque<EditablePanel>()
|
protected val panels = ArrayDeque<EditablePanel<*>>()
|
||||||
|
|
||||||
var inventoryFrame: FramePanel? = null
|
var inventoryFrame: FramePanel<out MatteryScreen<*>>? = null
|
||||||
var mainFrame: FramePanel? = null
|
var mainFrame: FramePanel<out MatteryScreen<*>>? = null
|
||||||
private var madeMainFrame = false
|
private var madeMainFrame = false
|
||||||
|
|
||||||
var itemRenderer: ItemRenderer
|
var itemRenderer: ItemRenderer
|
||||||
@ -51,12 +51,12 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
val quickCraftingType get() = quickCraftingType
|
val quickCraftingType get() = quickCraftingType
|
||||||
val isQuickCrafting get() = isQuickCrafting
|
val isQuickCrafting get() = isQuickCrafting
|
||||||
|
|
||||||
private val inventorySlotsRows = Int2ObjectAVLTreeMap<EditablePanel>()
|
private val inventorySlotsRows = Int2ObjectAVLTreeMap<EditablePanel<MatteryScreen<*>>>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (menu.playerInventorySlots.isNotEmpty() && menu.autoCreateInventoryFrame) {
|
if (menu.playerInventorySlots.isNotEmpty() && menu.autoCreateInventoryFrame) {
|
||||||
if (menu.playerExoSuitSlots.isEmpty()) {
|
if (menu.playerExoSuitSlots.isEmpty()) {
|
||||||
inventoryFrame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, INVENTORY_FRAME_HEIGHT, inventory.displayName).also(this::addPanel)
|
inventoryFrame = FramePanel<MatteryScreen<*>>(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, INVENTORY_FRAME_HEIGHT, inventory.displayName).also(this::addPanel)
|
||||||
|
|
||||||
val hotbarStrip = EditablePanel(this, inventoryFrame, height = AbstractSlotPanel.SIZE)
|
val hotbarStrip = EditablePanel(this, inventoryFrame, height = AbstractSlotPanel.SIZE)
|
||||||
hotbarStrip.dock = Dock.BOTTOM
|
hotbarStrip.dock = Dock.BOTTOM
|
||||||
@ -77,9 +77,9 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inventoryFrame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH_EXTENDED, INVENTORY_FRAME_HEIGHT, inventory.displayName).also(this::addPanel)
|
inventoryFrame = FramePanel<MatteryScreen<*>>(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH_EXTENDED, INVENTORY_FRAME_HEIGHT, inventory.displayName).also(this::addPanel)
|
||||||
|
|
||||||
var slotListCanvas: EditablePanel? = null
|
var slotListCanvas: EditablePanel<MatteryScreen<*>>? = null
|
||||||
|
|
||||||
val scrollbar = DiscreteScrollBarPanel(this, inventoryFrame, { ((menu.playerCombinedInventorySlots.size - 27) + 8) / 9 }, {
|
val scrollbar = DiscreteScrollBarPanel(this, inventoryFrame, { ((menu.playerCombinedInventorySlots.size - 27) + 8) / 9 }, {
|
||||||
_, old, new ->
|
_, old, new ->
|
||||||
@ -99,7 +99,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
menu.ply.matteryPlayer?.exoSuitMenu?.lastScroll = new
|
menu.ply.matteryPlayer?.exoSuitMenu?.lastScroll = new
|
||||||
})
|
})
|
||||||
|
|
||||||
slotListCanvas = object : EditablePanel(this@MatteryScreen, inventoryFrame, height = AbstractSlotPanel.SIZE * 3f) {
|
slotListCanvas = object : EditablePanel<MatteryScreen<*>>(this@MatteryScreen, inventoryFrame, height = AbstractSlotPanel.SIZE * 3f) {
|
||||||
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
scrollbar.mouseScrolledInner(x, y, scroll)
|
scrollbar.mouseScrolledInner(x, y, scroll)
|
||||||
return true
|
return true
|
||||||
@ -130,9 +130,9 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun getInventorySlotsRow(index: Int): EditablePanel {
|
protected fun getInventorySlotsRow(index: Int): EditablePanel<MatteryScreen<*>> {
|
||||||
return inventorySlotsRows.computeIfAbsent(index, Int2ObjectFunction {
|
return inventorySlotsRows.computeIfAbsent(index, Int2ObjectFunction {
|
||||||
val canvas = object : EditablePanel(this@MatteryScreen, null, width = AbstractSlotPanel.SIZE * 9f, height = AbstractSlotPanel.SIZE) {
|
val canvas = object : EditablePanel<MatteryScreen<*>>(this@MatteryScreen, null, width = AbstractSlotPanel.SIZE * 9f, height = AbstractSlotPanel.SIZE) {
|
||||||
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i in 0 .. (8).coerceAtMost(menu.playerCombinedInventorySlots.size - offset - 1)) {
|
for (i in 0 .. (8).coerceAtMost(menu.playerCombinedInventorySlots.size - offset - 1)) {
|
||||||
val slot = object : SlotPanel<Slot>(this@MatteryScreen, canvas, menu.playerCombinedInventorySlots[offset + i]) {
|
val slot = object : SlotPanel<MatteryScreen<*>, Slot>(this@MatteryScreen, canvas, menu.playerCombinedInventorySlots[offset + i]) {
|
||||||
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
movePanels()
|
movePanels()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addPanel(panel: EditablePanel): Boolean {
|
fun addPanel(panel: EditablePanel<out MatteryScreen<*>>): Boolean {
|
||||||
if (!panels.contains(panel)) {
|
if (!panels.contains(panel)) {
|
||||||
panels.addFirst(panel)
|
panels.addFirst(panel)
|
||||||
return true
|
return true
|
||||||
@ -179,7 +179,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removePanel(panel: EditablePanel): Boolean {
|
fun removePanel(panel: EditablePanel<out MatteryScreen<*>>): Boolean {
|
||||||
val indexOf = panels.indexOf(panel)
|
val indexOf = panels.indexOf(panel)
|
||||||
|
|
||||||
if (indexOf != -1) {
|
if (indexOf != -1) {
|
||||||
@ -195,7 +195,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
*
|
*
|
||||||
* @param panel panel to be pushed up
|
* @param panel panel to be pushed up
|
||||||
*/
|
*/
|
||||||
fun popup(panel: EditablePanel) {
|
fun popup(panel: EditablePanel<out MatteryScreen<*>>) {
|
||||||
val indexOf = panels.indexOf(panel)
|
val indexOf = panels.indexOf(panel)
|
||||||
|
|
||||||
require(indexOf != -1) { "No such panel $panel" }
|
require(indexOf != -1) { "No such panel $panel" }
|
||||||
@ -215,7 +215,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
*
|
*
|
||||||
* @return FramePanel created, or null
|
* @return FramePanel created, or null
|
||||||
*/
|
*/
|
||||||
protected open fun makeMainFrame(): FramePanel? {
|
protected open fun makeMainFrame(): FramePanel<out MatteryScreen<*>>? {
|
||||||
return FramePanel(this, null, 0f, 0f, DEFAULT_FRAME_WIDTH, DEFAULT_FRAME_HEIGHT, getTitle())
|
return FramePanel(this, null, 0f, 0f, DEFAULT_FRAME_WIDTH, DEFAULT_FRAME_HEIGHT, getTitle())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.client.screen.widget.PatternGaugePanel
|
|||||||
|
|
||||||
class PatternStorageScreen(p_97741_: PatternStorageMenu, p_97742_: Inventory, p_97743_: Component) :
|
class PatternStorageScreen(p_97741_: PatternStorageMenu, p_97742_: Inventory, p_97743_: Component) :
|
||||||
MatteryScreen<PatternStorageMenu>(p_97741_, p_97742_, p_97743_) {
|
MatteryScreen<PatternStorageMenu>(p_97741_, p_97742_, p_97743_) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
val m = PatternGaugePanel(this, frame, menu.storedThis, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
val m = PatternGaugePanel(this, frame, menu.storedThis, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)
|
||||||
|
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.menu.PlatePressMenu
|
|||||||
|
|
||||||
class PlatePressScreen(menu: PlatePressMenu, inventory: Inventory, title: Component) :
|
class PlatePressScreen(menu: PlatePressMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<PlatePressMenu>(menu, inventory, title) {
|
MatteryScreen<PlatePressMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.menu.StorageBusMenu
|
|||||||
|
|
||||||
class StorageBusScreen(menu: StorageBusMenu, inventory: Inventory, title: Component) :
|
class StorageBusScreen(menu: StorageBusMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<StorageBusMenu>(menu, inventory, title) {
|
MatteryScreen<StorageBusMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.menu.StorageExporterMenu
|
|||||||
|
|
||||||
class StorageExporterScreen(menu: StorageExporterMenu, inventory: Inventory, title: Component) :
|
class StorageExporterScreen(menu: StorageExporterMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<StorageExporterMenu>(menu, inventory, title) {
|
MatteryScreen<StorageExporterMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.menu.StorageImporterMenu
|
|||||||
|
|
||||||
class StorageImporterScreen(menu: StorageImporterMenu, inventory: Inventory, title: Component) :
|
class StorageImporterScreen(menu: StorageImporterMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<StorageImporterMenu>(menu, inventory, title) {
|
MatteryScreen<StorageImporterMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = super.makeMainFrame()!!
|
val frame = super.makeMainFrame()!!
|
||||||
|
|
||||||
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
WidePowerGaugePanel(this, frame, menu.powerWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
|
@ -11,7 +11,7 @@ import ru.dbotthepony.mc.otm.menu.StoragePowerSupplierMenu
|
|||||||
|
|
||||||
class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inventory, title: Component) :
|
class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inventory, title: Component) :
|
||||||
MatteryScreen<StoragePowerSupplierMenu>(menu, inventory, title) {
|
MatteryScreen<StoragePowerSupplierMenu>(menu, inventory, title) {
|
||||||
override fun makeMainFrame(): FramePanel {
|
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
|
||||||
val frame = FramePanel(this, width = 200f, height = 60f, title)
|
val frame = FramePanel(this, width = 200f, height = 60f, title)
|
||||||
|
|
||||||
HorizontalPowerGaugePanel(this, frame, menu.powerWidget).also {
|
HorizontalPowerGaugePanel(this, frame, menu.powerWidget).also {
|
||||||
@ -33,7 +33,7 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve
|
|||||||
|
|
||||||
labels.dock = Dock.FILL
|
labels.dock = Dock.FILL
|
||||||
|
|
||||||
object : Label(this@StoragePowerSupplierScreen, labels) {
|
object : Label<StoragePowerSupplierScreen>(this@StoragePowerSupplierScreen, labels) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.TOP
|
dock = Dock.TOP
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object : Label(this@StoragePowerSupplierScreen, labels) {
|
object : Label<StoragePowerSupplierScreen>(this@StoragePowerSupplierScreen, labels) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.TOP
|
dock = Dock.TOP
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels
|
|||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -12,17 +14,15 @@ import ru.dbotthepony.mc.otm.client.render.*
|
|||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
import ru.dbotthepony.mc.otm.core.RGBAColor
|
import ru.dbotthepony.mc.otm.core.RGBAColor
|
||||||
|
|
||||||
abstract class AbstractSlotPanel @JvmOverloads constructor(
|
abstract class AbstractSlotPanel<out S : MatteryScreen<*>> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
height: Float = SIZE,
|
height: Float = SIZE,
|
||||||
open val noItemIcon: SkinElement? = null
|
open val noItemIcon: SkinElement? = null
|
||||||
) : EditablePanel(
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
screen, parent, x, y, width, height
|
|
||||||
) {
|
|
||||||
protected open fun renderSlotBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
protected open fun renderSlotBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
SLOT_BACKGROUND.render(stack, width = width, height = height)
|
SLOT_BACKGROUND.render(stack, width = width, height = height)
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement
|
import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
import ru.dbotthepony.mc.otm.client.render.element
|
import ru.dbotthepony.mc.otm.client.render.element
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
|
||||||
open class BackgroundPanel(
|
open class BackgroundPanel<out S : Screen>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 10f,
|
width: Float = 10f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
init {
|
init {
|
||||||
dockPadding = DockProperty(3f, 3f, 3f, 3f)
|
dockPadding = DockProperty(3f, 3f, 3f, 3f)
|
||||||
}
|
}
|
||||||
@ -23,18 +25,18 @@ open class BackgroundPanel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun padded(
|
fun <S : Screen> padded(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 10f,
|
width: Float = 10f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
) = BackgroundPanel(screen, parent, x, y, width + 6f, height + 6f)
|
) = BackgroundPanel(screen, parent, x, y, width + 6f, height + 6f)
|
||||||
|
|
||||||
fun paddedCenter(
|
fun <S : Screen> paddedCenter(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 10f,
|
width: Float = 10f,
|
||||||
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack
|
|||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.gui.components.Button
|
import net.minecraft.client.gui.components.Button
|
||||||
import net.minecraft.client.gui.components.Button.OnPress
|
import net.minecraft.client.gui.components.Button.OnPress
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||||
@ -16,19 +17,19 @@ import java.util.*
|
|||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.reflect.KMutableProperty0
|
import kotlin.reflect.KMutableProperty0
|
||||||
|
|
||||||
open class ButtonPanel(
|
open class ButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = HEIGHT,
|
height: Float = HEIGHT,
|
||||||
label: Component
|
label: Component
|
||||||
) : MinecraftWidgetPanel<Button>(screen, parent, x, y, width, height) {
|
) : MinecraftWidgetPanel<S, Button>(screen, parent, x, y, width, height) {
|
||||||
constructor(screen: MatteryScreen<*>, parent: EditablePanel?, label: Component) : this(screen, parent, x = 0f, label = label)
|
constructor(screen: S, parent: EditablePanel<*>?, label: Component) : this(screen, parent, x = 0f, label = label)
|
||||||
constructor(
|
constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
@ -72,16 +73,16 @@ open class ButtonPanel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("PropertyName")
|
@Suppress("PropertyName")
|
||||||
abstract class SquareButtonPanel(
|
abstract class SquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float,
|
width: Float,
|
||||||
height: Float,
|
height: Float,
|
||||||
val skinElement: (() -> SkinElement)? = null,
|
val skinElement: (() -> SkinElement)? = null,
|
||||||
val onPress: ((clickButton: Int) -> Unit)? = null,
|
val onPress: ((clickButton: Int) -> Unit)? = null,
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
protected var pressed = false
|
protected var pressed = false
|
||||||
|
|
||||||
protected open fun click(clickButton: Int) {
|
protected open fun click(clickButton: Int) {
|
||||||
@ -144,9 +145,9 @@ abstract class SquareButtonPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class EnumSquareButtonPanel<T : Enum<T>>(
|
abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float,
|
width: Float,
|
||||||
@ -155,13 +156,13 @@ abstract class EnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
val prop: KMutableProperty0<T>,
|
val prop: KMutableProperty0<T>,
|
||||||
val defaultValue: T,
|
val defaultValue: T,
|
||||||
val onChange: ((newValue: T) -> Unit)? = null,
|
val onChange: ((newValue: T) -> Unit)? = null,
|
||||||
) : SquareButtonPanel(screen, parent, x, y, width, height, null, null) {
|
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, null, null) {
|
||||||
private var building = true
|
private var building = true
|
||||||
|
|
||||||
protected val enumMapping = EnumMap<T, Pair<SkinElement, UVWindingOrder>>(enum)
|
protected val enumMapping = EnumMap<T, Pair<SkinElement, UVWindingOrder>>(enum)
|
||||||
protected val tooltipMapping = EnumMap<T, Component>(enum)
|
protected val tooltipMapping = EnumMap<T, Component>(enum)
|
||||||
|
|
||||||
fun addTooltip(value: T, component: Component): EnumSquareButtonPanel<T> {
|
fun addTooltip(value: T, component: Component): EnumSquareButtonPanel<S, T> {
|
||||||
check(tooltipMapping.put(value, component) == null) { "Already has mapping for $value" }
|
check(tooltipMapping.put(value, component) == null) { "Already has mapping for $value" }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@ -197,19 +198,19 @@ abstract class EnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
return missing
|
return missing
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<T> {
|
fun add(value: T, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<S, T> {
|
||||||
return add(value, skinElement to winding)
|
return add(value, skinElement to winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, skinElement: SkinElement, component: Component, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<T> {
|
fun add(value: T, skinElement: SkinElement, component: Component, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<S, T> {
|
||||||
return add(value, component, skinElement to winding)
|
return add(value, component, skinElement to winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, component: Component, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<T> {
|
fun add(value: T, component: Component, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<S, T> {
|
||||||
return add(value, component, skinElement to winding)
|
return add(value, component, skinElement to winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, pair: Pair<SkinElement, UVWindingOrder>): EnumSquareButtonPanel<T> {
|
fun add(value: T, pair: Pair<SkinElement, UVWindingOrder>): EnumSquareButtonPanel<S, T> {
|
||||||
check(building) { "Not building" }
|
check(building) { "Not building" }
|
||||||
check(enumMapping.put(value, pair) == null) { "Already has mapping for $value" }
|
check(enumMapping.put(value, pair) == null) { "Already has mapping for $value" }
|
||||||
|
|
||||||
@ -220,12 +221,12 @@ abstract class EnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, component: Component, pair: Pair<SkinElement, UVWindingOrder>): EnumSquareButtonPanel<T> {
|
fun add(value: T, component: Component, pair: Pair<SkinElement, UVWindingOrder>): EnumSquareButtonPanel<S, T> {
|
||||||
addTooltip(value, component)
|
addTooltip(value, component)
|
||||||
return add(value, pair)
|
return add(value, pair)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun finish(): EnumSquareButtonPanel<T> {
|
fun finish(): EnumSquareButtonPanel<S, T> {
|
||||||
check(building) { "Not building" }
|
check(building) { "Not building" }
|
||||||
check(isFullyDefined()) {
|
check(isFullyDefined()) {
|
||||||
"Not all enums having their mapping defined, missing are: ${missingValues.joinToString(", ")}"
|
"Not all enums having their mapping defined, missing are: ${missingValues.joinToString(", ")}"
|
||||||
@ -313,19 +314,19 @@ abstract class EnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class LargeSquareButtonPanel(
|
open class LargeSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
height: Float = SIZE,
|
height: Float = SIZE,
|
||||||
skinElement: (() -> SkinElement)? = null,
|
skinElement: (() -> SkinElement)? = null,
|
||||||
onPress: ((clickButton: Int) -> Unit)? = null,
|
onPress: ((clickButton: Int) -> Unit)? = null,
|
||||||
) : SquareButtonPanel(screen, parent, x, y, width, height, skinElement, onPress) {
|
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, skinElement, onPress) {
|
||||||
constructor(
|
constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
@ -342,9 +343,10 @@ open class LargeSquareButtonPanel(
|
|||||||
const val SIZE = 18f
|
const val SIZE = 18f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
open class LargeEnumSquareButtonPanel<T : Enum<T>>(
|
|
||||||
screen: MatteryScreen<*>,
|
open class LargeEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
||||||
parent: EditablePanel?,
|
screen: S,
|
||||||
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
@ -353,7 +355,7 @@ open class LargeEnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
prop: KMutableProperty0<T>,
|
prop: KMutableProperty0<T>,
|
||||||
defaultValue: T,
|
defaultValue: T,
|
||||||
onChange: ((newValue: T) -> Unit)? = null,
|
onChange: ((newValue: T) -> Unit)? = null,
|
||||||
) : EnumSquareButtonPanel<T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
) : EnumSquareButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
||||||
final override val IDLE = Widgets18.BUTTON_IDLE
|
final override val IDLE = Widgets18.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
||||||
@ -363,16 +365,16 @@ open class LargeEnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class SmallSquareButtonPanel(
|
open class SmallSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
height: Float = SIZE,
|
height: Float = SIZE,
|
||||||
skinElement: (() -> SkinElement)? = null,
|
skinElement: (() -> SkinElement)? = null,
|
||||||
lambdaOnPress: ((clickButton: Int) -> Unit)? = null,
|
lambdaOnPress: ((clickButton: Int) -> Unit)? = null,
|
||||||
) : SquareButtonPanel(screen, parent, x, y, width, height, skinElement, lambdaOnPress) {
|
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, skinElement, lambdaOnPress) {
|
||||||
final override val IDLE = Widgets8.BUTTON_IDLE
|
final override val IDLE = Widgets8.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||||
@ -382,9 +384,9 @@ open class SmallSquareButtonPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class SmallEnumSquareButtonPanel<T : Enum<T>>(
|
open class SmallEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
@ -393,7 +395,7 @@ open class SmallEnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
prop: KMutableProperty0<T>,
|
prop: KMutableProperty0<T>,
|
||||||
defaultValue: T,
|
defaultValue: T,
|
||||||
lambdaOnChange: ((newValue: T) -> Unit)? = null,
|
lambdaOnChange: ((newValue: T) -> Unit)? = null,
|
||||||
) : EnumSquareButtonPanel<T>(screen, parent, x, y, width, height, enum, prop, defaultValue, lambdaOnChange) {
|
) : EnumSquareButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, lambdaOnChange) {
|
||||||
final override val IDLE = Widgets8.BUTTON_IDLE
|
final override val IDLE = Widgets8.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.client.render.SkinElement
|
import ru.dbotthepony.mc.otm.client.render.SkinElement
|
||||||
@ -9,16 +10,14 @@ import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
|||||||
import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxPanel.Companion.REGULAR_DIMENSIONS
|
import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxPanel.Companion.REGULAR_DIMENSIONS
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.BooleanPlayerInputWidget
|
import ru.dbotthepony.mc.otm.menu.widget.BooleanPlayerInputWidget
|
||||||
|
|
||||||
open class CheckBoxPanel(
|
open class CheckBoxPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = REGULAR_DIMENSIONS,
|
width: Float = REGULAR_DIMENSIONS,
|
||||||
height: Float = REGULAR_DIMENSIONS
|
height: Float = REGULAR_DIMENSIONS
|
||||||
) : EditablePanel(
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
screen, parent, x, y, width, height
|
|
||||||
) {
|
|
||||||
open var checked = false
|
open var checked = false
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
@ -56,15 +55,15 @@ open class CheckBoxPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class CheckBoxInputPanel(
|
open class CheckBoxInputPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
val widget: BooleanPlayerInputWidget,
|
val widget: BooleanPlayerInputWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = REGULAR_DIMENSIONS + 120f,
|
width: Float = REGULAR_DIMENSIONS + 120f,
|
||||||
height: Float = REGULAR_DIMENSIONS
|
height: Float = REGULAR_DIMENSIONS
|
||||||
) : CheckBoxPanel(screen, parent, x, y, width, height) {
|
) : CheckBoxPanel<S>(screen, parent, x, y, width, height) {
|
||||||
override var checked: Boolean
|
override var checked: Boolean
|
||||||
get() = widget.value
|
get() = widget.value
|
||||||
set(value) {}
|
set(value) {}
|
||||||
@ -76,29 +75,29 @@ open class CheckBoxInputPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class CheckBoxLabelPanel(
|
open class CheckBoxLabelPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
text: Component,
|
text: Component,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = REGULAR_DIMENSIONS + 120f,
|
width: Float = REGULAR_DIMENSIONS + 120f,
|
||||||
height: Float = REGULAR_DIMENSIONS
|
height: Float = REGULAR_DIMENSIONS
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
val checkbox = CheckBoxPanel(screen, this, 0f, 0f, REGULAR_DIMENSIONS, REGULAR_DIMENSIONS)
|
val checkbox = CheckBoxPanel(screen, this, 0f, 0f, REGULAR_DIMENSIONS, REGULAR_DIMENSIONS)
|
||||||
val label = Label(screen, this, REGULAR_DIMENSIONS + 4f, 4f, text = text)
|
val label = Label(screen, this, REGULAR_DIMENSIONS + 4f, 4f, text = text)
|
||||||
}
|
}
|
||||||
|
|
||||||
open class CheckBoxLabelInputPanel(
|
open class CheckBoxLabelInputPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
widget: BooleanPlayerInputWidget,
|
widget: BooleanPlayerInputWidget,
|
||||||
text: Component,
|
text: Component,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = REGULAR_DIMENSIONS + 120f,
|
width: Float = REGULAR_DIMENSIONS + 120f,
|
||||||
height: Float = REGULAR_DIMENSIONS
|
height: Float = REGULAR_DIMENSIONS
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
val widget get() = checkbox.widget
|
val widget get() = checkbox.widget
|
||||||
val checkbox = CheckBoxInputPanel(screen, this, widget, 0f, 0f, REGULAR_DIMENSIONS, REGULAR_DIMENSIONS)
|
val checkbox = CheckBoxInputPanel(screen, this, widget, 0f, 0f, REGULAR_DIMENSIONS, REGULAR_DIMENSIONS)
|
||||||
val label = Label(screen, this, REGULAR_DIMENSIONS + 4f, 4f, text = text)
|
val label = Label(screen, this, REGULAR_DIMENSIONS + 4f, 4f, text = text)
|
||||||
|
@ -2,19 +2,20 @@ package ru.dbotthepony.mc.otm.client.screen.panels
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
open class DiscreteScrollBarPanel(
|
open class DiscreteScrollBarPanel<S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
val maxScroll: (panel: DiscreteScrollBarPanel) -> Int,
|
val maxScroll: (panel: DiscreteScrollBarPanel<S>) -> Int,
|
||||||
val scrollCallback: (panel: DiscreteScrollBarPanel, oldScroll: Int, newScroll: Int) -> Unit,
|
val scrollCallback: (panel: DiscreteScrollBarPanel<S>, oldScroll: Int, newScroll: Int) -> Unit,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
height: Float = 20f
|
height: Float = 20f
|
||||||
) : EditablePanel(screen, parent, x, y, width = ScrollBarConstants.WIDTH, height = height) {
|
) : EditablePanel<S>(screen, parent, x, y, width = ScrollBarConstants.WIDTH, height = height) {
|
||||||
open inner class Button : EditablePanel(screen, this@DiscreteScrollBarPanel, 1f, 1f, 12f, 15f) {
|
open inner class Button : EditablePanel<S>(screen, this@DiscreteScrollBarPanel, 1f, 1f, 12f, 15f) {
|
||||||
var isScrolling = false
|
var isScrolling = false
|
||||||
protected set
|
protected set
|
||||||
|
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
|
||||||
open class DraggableCanvasPanel @JvmOverloads constructor(
|
open class DraggableCanvasPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 10f,
|
width: Float = 10f,
|
||||||
height: Float = 10f
|
height: Float = 10f
|
||||||
) : EditablePanel(
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
screen, parent, x, y, width, height
|
|
||||||
) {
|
|
||||||
protected var dragging = false
|
protected var dragging = false
|
||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
import net.minecraft.client.gui.components.EditBox
|
import net.minecraft.client.gui.components.EditBox
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
|
||||||
|
|
||||||
open class EditBoxPanel(
|
open class EditBoxPanel<out S : Screen>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 0f,
|
width: Float = 0f,
|
||||||
height: Float = 20f,
|
height: Float = 20f,
|
||||||
val defaultText: Component = TextComponent("")
|
val defaultText: Component = TextComponent("")
|
||||||
) : MinecraftWidgetPanel<EditBox>(screen, parent, x, y, width, height) {
|
) : MinecraftWidgetPanel<S, EditBox>(screen, parent, x, y, width, height) {
|
||||||
override fun makeNew(): EditBox {
|
override fun makeNew(): EditBox {
|
||||||
return object : EditBox(font, 0, 0, width.toInt(), height.toInt().coerceAtMost(20), defaultText) {
|
return object : EditBox(font, 0, 0, width.toInt(), height.toInt().coerceAtMost(20), defaultText) {
|
||||||
override fun isHoveredOrFocused(): Boolean {
|
override fun isHoveredOrFocused(): Boolean {
|
||||||
@ -47,8 +47,8 @@ open class EditBoxPanel(
|
|||||||
widget?.setFocus(new)
|
widget?.setFocus(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, flag: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
super.mouseClickedInner(x, y, flag)
|
super.mouseClickedInner(x, y, button)
|
||||||
requestFocus()
|
requestFocus()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,12 @@ import com.mojang.blaze3d.vertex.PoseStack
|
|||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.gui.Font
|
import net.minecraft.client.gui.Font
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.inventory.Slot
|
import net.minecraft.world.inventory.Slot
|
||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
import ru.dbotthepony.mc.otm.client.render.popScissorRect
|
import ru.dbotthepony.mc.otm.client.render.popScissorRect
|
||||||
import ru.dbotthepony.mc.otm.client.render.pushScissorRect
|
import ru.dbotthepony.mc.otm.client.render.pushScissorRect
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
@ -40,9 +43,9 @@ interface ISlotPanel<S : Slot> {
|
|||||||
val slot: S
|
val slot: S
|
||||||
}
|
}
|
||||||
|
|
||||||
open class EditablePanel @JvmOverloads constructor(
|
open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
||||||
val screen: MatteryScreen<*>,
|
val screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
|
|
||||||
// относительно родителя
|
// относительно родителя
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -51,7 +54,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
width: Float = 10f,
|
width: Float = 10f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
) : GuiEventListener {
|
) : GuiEventListener {
|
||||||
var parent: EditablePanel? = null
|
var parent: EditablePanel<*>? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
if (field === value)
|
if (field === value)
|
||||||
return
|
return
|
||||||
@ -126,9 +129,8 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
var dockedHeight: Float = 0f
|
var dockedHeight: Float = 0f
|
||||||
private set
|
private set
|
||||||
|
|
||||||
@JvmField
|
protected val children = ArrayList<EditablePanel<*>>()
|
||||||
protected val children = ArrayList<EditablePanel>()
|
val childrenView: List<EditablePanel<*>> = Collections.unmodifiableList(children)
|
||||||
val childrenView: List<EditablePanel> = Collections.unmodifiableList(children)
|
|
||||||
|
|
||||||
var layoutInvalidated = true
|
var layoutInvalidated = true
|
||||||
private set
|
private set
|
||||||
@ -324,7 +326,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
accumulatedDepth += value
|
accumulatedDepth += value
|
||||||
}
|
}
|
||||||
|
|
||||||
val font: Font get() = screen.font
|
val font: Font get() = if (screen is MatteryScreen<*>) screen.font else minecraft.font
|
||||||
|
|
||||||
fun invalidateLayout() {
|
fun invalidateLayout() {
|
||||||
layoutInvalidated = true
|
layoutInvalidated = true
|
||||||
@ -348,14 +350,14 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
this.parent = parent
|
this.parent = parent
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onParent(child: EditablePanel) {
|
private fun onParent(child: EditablePanel<*>) {
|
||||||
if (children.contains(child)) throw IllegalStateException("Already containing $child")
|
if (children.contains(child)) throw IllegalStateException("Already containing $child")
|
||||||
children.add(child)
|
children.add(child)
|
||||||
layoutInvalidated = true
|
layoutInvalidated = true
|
||||||
updateVisible()
|
updateVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUnParent(child: EditablePanel) {
|
private fun onUnParent(child: EditablePanel<*>) {
|
||||||
val indexOf = children.indexOf(child)
|
val indexOf = children.indexOf(child)
|
||||||
if (indexOf == -1) throw IllegalStateException("Already not containing $child")
|
if (indexOf == -1) throw IllegalStateException("Already not containing $child")
|
||||||
children.removeAt(indexOf)
|
children.removeAt(indexOf)
|
||||||
@ -526,7 +528,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
listOf(tooltip),
|
listOf(tooltip),
|
||||||
mouse_x.toInt(),
|
mouse_x.toInt(),
|
||||||
mouse_y.toInt(),
|
mouse_y.toInt(),
|
||||||
screen.font
|
font
|
||||||
)
|
)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -536,7 +538,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
tooltipList,
|
tooltipList,
|
||||||
mouse_x.toInt(),
|
mouse_x.toInt(),
|
||||||
mouse_y.toInt(),
|
mouse_y.toInt(),
|
||||||
screen.font
|
font
|
||||||
)
|
)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -572,8 +574,8 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return ScreenPos((_x - pos.x).toFloat(), (_y - pos.y).toFloat())
|
return ScreenPos((_x - pos.x).toFloat(), (_y - pos.y).toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findRoot(): EditablePanel? {
|
fun findRoot(): EditablePanel<*>? {
|
||||||
var parent: EditablePanel? = this.parent ?: return null
|
var parent: EditablePanel<*>? = this.parent ?: return null
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
val parent2 = parent!!.parent
|
val parent2 = parent!!.parent
|
||||||
@ -586,7 +588,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findAbsoluteRoot(): EditablePanel {
|
fun findAbsoluteRoot(): EditablePanel<*> {
|
||||||
return findRoot() ?: this
|
return findRoot() ?: this
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +781,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findHierarchicalFocus(): EditablePanel? {
|
fun findHierarchicalFocus(): EditablePanel<*>? {
|
||||||
if (isFocused) {
|
if (isFocused) {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@ -876,20 +878,12 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
setSize(w, h)
|
setSize(w, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fetchChildren(): List<EditablePanel> {
|
fun fetchChildren(): List<EditablePanel<*>> {
|
||||||
return ImmutableList.copyOf(children)
|
return ImmutableList.copyOf(children)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getUndockedChildren(): List<EditablePanel> {
|
fun getUndockedChildren(): List<EditablePanel<*>> {
|
||||||
var count = 0
|
val list = LinkedList<EditablePanel<*>>()
|
||||||
|
|
||||||
for (child in children) {
|
|
||||||
if (child.dock == Dock.NONE) {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val list = ArrayList<EditablePanel>(count)
|
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.dock == Dock.NONE) {
|
if (child.dock == Dock.NONE) {
|
||||||
@ -900,7 +894,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
operator fun get(index: Int): EditablePanel? {
|
operator fun get(index: Int): EditablePanel<*>? {
|
||||||
if (index < 0 || index >= children.size) return null
|
if (index < 0 || index >= children.size) return null
|
||||||
return children[index]
|
return children[index]
|
||||||
}
|
}
|
||||||
@ -937,7 +931,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return pos.x <= x && pos.x + boundingWidth > x && pos.y <= y && pos.y + boundingHeight > y
|
return pos.x <= x && pos.x + boundingWidth > x && pos.y <= y && pos.y + boundingHeight > y
|
||||||
}
|
}
|
||||||
|
|
||||||
fun killFocusForEverythingExcept(except: EditablePanel) {
|
fun killFocusForEverythingExcept(except: EditablePanel<*>) {
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child !== except) {
|
if (child !== except) {
|
||||||
child.killFocusForEverythingExceptInner()
|
child.killFocusForEverythingExceptInner()
|
||||||
@ -974,7 +968,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (isTrappingMouseInput() || withinBounds(x, y)) {
|
if (isTrappingMouseInput() || withinBounds(x, y)) {
|
||||||
if (acceptMouseInput && parent == null) screen.popup(this)
|
if (acceptMouseInput && parent == null) popup()
|
||||||
return mouseClicked(x, y, button)
|
return mouseClicked(x, y, button)
|
||||||
} else if (withinExtendedBounds(x, y)) {
|
} else if (withinExtendedBounds(x, y)) {
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
@ -1181,12 +1175,12 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
protected open fun onRemoved() {}
|
protected open fun onRemoved() {}
|
||||||
|
|
||||||
fun remove() {
|
fun remove() {
|
||||||
if (isRemoved) {
|
if (isRemoved || screen !is MatteryScreen<*>) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
killFocus()
|
killFocus()
|
||||||
screen.removePanel(this)
|
screen.removePanel(this as EditablePanel<MatteryScreen<*>>)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
child.remove()
|
child.remove()
|
||||||
@ -1196,7 +1190,13 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
isRemoved = true
|
isRemoved = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun asGrid(): FlexGridPanel {
|
fun popup() {
|
||||||
|
if (screen is MatteryScreen<*>) {
|
||||||
|
screen.popup(this as EditablePanel<MatteryScreen<*>>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun asGrid(): FlexGridPanel<*> {
|
||||||
val grid = FlexGridPanel(screen, parent, x, y, width, height)
|
val grid = FlexGridPanel(screen, parent, x, y, width, height)
|
||||||
parent = grid
|
parent = grid
|
||||||
grid.dock = dock
|
grid.dock = dock
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
@ -22,16 +23,16 @@ private fun calculateScale(width: Float, height: Float): Int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class EntityRendererPanel(
|
class EntityRendererPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
val entity: LivingEntity,
|
val entity: LivingEntity,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = ENTITY_RECTANGLE.w,
|
width: Float = ENTITY_RECTANGLE.w,
|
||||||
height: Float = ENTITY_RECTANGLE.h,
|
height: Float = ENTITY_RECTANGLE.h,
|
||||||
var renderScale: Int = calculateScale(width, height)
|
var renderScale: Int = calculateScale(width, height)
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ExoSuitInventoryScreen.ENTITY_RECTANGLE.render(stack)
|
ExoSuitInventoryScreen.ENTITY_RECTANGLE.render(stack)
|
||||||
|
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
import ru.dbotthepony.mc.otm.container.ItemFilterNetworkSlot
|
import ru.dbotthepony.mc.otm.container.ItemFilterNetworkSlot
|
||||||
import ru.dbotthepony.mc.otm.container.ItemFilterSlotPacket
|
import ru.dbotthepony.mc.otm.container.ItemFilterSlotPacket
|
||||||
import ru.dbotthepony.mc.otm.network.MenuNetworkChannel
|
import ru.dbotthepony.mc.otm.network.MenuNetworkChannel
|
||||||
|
|
||||||
open class FilterSlotPanel(
|
open class FilterSlotPanel<out S : MatteryScreen<*>> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
val slot: ItemFilterNetworkSlot,
|
val slot: ItemFilterNetworkSlot,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = SIZE,
|
width: Float = SIZE,
|
||||||
height: Float = SIZE
|
height: Float = SIZE
|
||||||
) : AbstractSlotPanel(screen, parent, x, y, width, height) {
|
) : AbstractSlotPanel<S>(screen, parent, x, y, width, height) {
|
||||||
override fun getItemStack(): ItemStack {
|
override fun getItemStack(): ItemStack {
|
||||||
return slot.get()
|
return slot.get()
|
||||||
}
|
}
|
||||||
|
@ -5,29 +5,31 @@ import com.mojang.blaze3d.vertex.PoseStack
|
|||||||
import net.minecraft.client.gui.narration.NarratableEntry
|
import net.minecraft.client.gui.narration.NarratableEntry
|
||||||
import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
|
import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
|
||||||
import net.minecraft.client.gui.narration.NarrationElementOutput
|
import net.minecraft.client.gui.narration.NarrationElementOutput
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import org.lwjgl.opengl.GL30
|
import org.lwjgl.opengl.GL30
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.client.render.*
|
import ru.dbotthepony.mc.otm.client.render.*
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
|
||||||
open class FramePanel(
|
open class FramePanel<out S : Screen>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float,
|
x: Float,
|
||||||
y: Float,
|
y: Float,
|
||||||
width: Float,
|
width: Float,
|
||||||
height: Float,
|
height: Float,
|
||||||
protected var title: Component
|
protected var title: Component
|
||||||
) : EditablePanel(screen, parent, x, y, width, height), NarratableEntry {
|
) : EditablePanel<S>(screen, parent, x, y, width, height), NarratableEntry {
|
||||||
constructor(screen: MatteryScreen<*>, width: Float, height: Float, title: Component) : this(screen, null, 0f, 0f, width, height, title)
|
constructor(screen: S, width: Float, height: Float, title: Component) : this(screen, null, 0f, 0f, width, height, title)
|
||||||
|
|
||||||
open inner class Tab(
|
open inner class Tab(
|
||||||
var onOpen: Runnable? = null,
|
var onOpen: Runnable? = null,
|
||||||
var onClose: Runnable? = null,
|
var onClose: Runnable? = null,
|
||||||
var activeIcon: SkinElement? = null,
|
var activeIcon: SkinElement? = null,
|
||||||
var inactiveIcon: SkinElement? = null,
|
var inactiveIcon: SkinElement? = null,
|
||||||
) : EditablePanel(this@FramePanel.screen, this@FramePanel, 0f, 0f, 28f, 28f) {
|
) : EditablePanel<S>(this@FramePanel.screen, this@FramePanel, 0f, 0f, 28f, 28f) {
|
||||||
var isActive = tabs.isEmpty()
|
var isActive = tabs.isEmpty()
|
||||||
var initial = false
|
var initial = false
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ open class FramePanel(
|
|||||||
tabs.add(this)
|
tabs.add(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showHidePanels(input: List<EditablePanel>) {
|
fun showHidePanels(input: List<EditablePanel<*>>) {
|
||||||
onOpen = Runnable {
|
onOpen = Runnable {
|
||||||
for (child in input) {
|
for (child in input) {
|
||||||
child.visible = true
|
child.visible = true
|
||||||
@ -120,7 +122,7 @@ open class FramePanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected val tabs = ArrayList<Tab>()
|
protected val tabs: java.util.ArrayList<Tab> = ArrayList()
|
||||||
|
|
||||||
override fun performLayout() {
|
override fun performLayout() {
|
||||||
for ((i, tab) in tabs.withIndex()) {
|
for ((i, tab) in tabs.withIndex()) {
|
||||||
@ -173,7 +175,7 @@ open class FramePanel(
|
|||||||
|
|
||||||
// title
|
// title
|
||||||
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
||||||
screen.font.draw(stack, title, 8f, 5f, 4210752)
|
font.draw(stack, title, 8f, 5f, 4210752)
|
||||||
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,9 +190,9 @@ open class FramePanel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun padded(
|
fun <S : Screen> padded(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float,
|
x: Float,
|
||||||
y: Float,
|
y: Float,
|
||||||
width: Float,
|
width: Float,
|
||||||
@ -198,9 +200,9 @@ open class FramePanel(
|
|||||||
title: Component
|
title: Component
|
||||||
) = FramePanel(screen, parent, x, y, width + PADDING * 2, height + PADDING_TOP + PADDING, title)
|
) = FramePanel(screen, parent, x, y, width + PADDING * 2, height + PADDING_TOP + PADDING, title)
|
||||||
|
|
||||||
fun padded(
|
fun <S : Screen> padded(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
width: Float,
|
width: Float,
|
||||||
height: Float,
|
height: Float,
|
||||||
title: Component
|
title: Component
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
|
||||||
open class GridPanel(
|
open class GridPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float,
|
width: Float,
|
||||||
height: Float,
|
height: Float,
|
||||||
protected var columns: Int,
|
protected var columns: Int,
|
||||||
protected var rows: Int
|
protected var rows: Int
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
override fun performLayout() {
|
override fun performLayout() {
|
||||||
var currentX = 0f
|
var currentX = 0f
|
||||||
var currentY = 0f
|
var currentY = 0f
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||||
import ru.dbotthepony.mc.otm.core.RGBAColor
|
import ru.dbotthepony.mc.otm.core.RGBAColor
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
|
||||||
open class Label @JvmOverloads constructor(
|
open class Label<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 100f,
|
width: Float = 100f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
var text: Component = TextComponent("Label"),
|
var text: Component = TextComponent("Label"),
|
||||||
var shadow: Boolean = false
|
var shadow: Boolean = false
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
constructor(screen: MatteryScreen<*>, parent: EditablePanel?, text: Component, shadow: Boolean = false) : this(screen, parent, x = 0f, text = text, shadow = shadow)
|
constructor(screen: S, parent: EditablePanel<*>?, text: Component, shadow: Boolean = false) : this(screen, parent, x = 0f, text = text, shadow = shadow)
|
||||||
|
|
||||||
var shadowX = 0.75f
|
var shadowX = 0.75f
|
||||||
var shadowY = 0.75f
|
var shadowY = 0.75f
|
||||||
|
@ -3,17 +3,19 @@ package ru.dbotthepony.mc.otm.client.screen.panels
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.client.gui.components.AbstractWidget
|
import net.minecraft.client.gui.components.AbstractWidget
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.GL11
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
|
||||||
abstract class MinecraftWidgetPanel<T : AbstractWidget>(
|
abstract class MinecraftWidgetPanel<out S : Screen, T : AbstractWidget>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float,
|
x: Float,
|
||||||
y: Float,
|
y: Float,
|
||||||
width: Float,
|
width: Float,
|
||||||
height: Float
|
height: Float
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
var widget: T? = null
|
var widget: T? = null
|
||||||
protected set
|
protected set
|
||||||
|
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels
|
package ru.dbotthepony.mc.otm.client.screen.panels
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.NumberPlayerInputWidget
|
import ru.dbotthepony.mc.otm.menu.widget.NumberPlayerInputWidget
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
open class NumberInputPanel(
|
open class NumberInputPanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
val inputWidget: NumberPlayerInputWidget,
|
val inputWidget: NumberPlayerInputWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 0f,
|
width: Float = 0f,
|
||||||
height: Float = 20f,
|
height: Float = 20f,
|
||||||
defaultText: Component = TextComponent("")
|
defaultText: Component = TextComponent("")
|
||||||
) : EditBoxPanel(screen, parent, x, y, width, height, defaultText) {
|
) : EditBoxPanel<S>(screen, parent, x, y, width, height, defaultText) {
|
||||||
protected var nextUpdateFromServer = 0L
|
protected var nextUpdateFromServer = 0L
|
||||||
protected var inputStr = ""
|
protected var inputStr = ""
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.gui.GuiComponent
|
import net.minecraft.client.gui.GuiComponent
|
||||||
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||||
import net.minecraft.world.inventory.Slot
|
import net.minecraft.world.inventory.Slot
|
||||||
@ -18,16 +19,16 @@ import ru.dbotthepony.mc.otm.client.render.setDrawColor
|
|||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
import javax.annotation.Nonnull
|
import javax.annotation.Nonnull
|
||||||
|
|
||||||
open class SlotPanel<T : Slot>(
|
open class SlotPanel<out S : MatteryScreen<*>, T : Slot> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
final override val slot: T,
|
final override val slot: T,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = AbstractSlotPanel.SIZE,
|
width: Float = SIZE,
|
||||||
height: Float = AbstractSlotPanel.SIZE,
|
height: Float = SIZE,
|
||||||
noItemIcon: SkinElement? = null
|
noItemIcon: SkinElement? = null
|
||||||
) : AbstractSlotPanel(screen, parent, x, y, width, height, noItemIcon), ISlotPanel<T> {
|
) : AbstractSlotPanel<S>(screen, parent, x, y, width, height, noItemIcon), ISlotPanel<T> {
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
screen.returnSlot = slot
|
screen.returnSlot = slot
|
||||||
return true
|
return true
|
||||||
@ -114,9 +115,9 @@ open class SlotPanel<T : Slot>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T : Slot> BatterySlotPanel(
|
fun <S : MatteryScreen<*>, T : Slot> BatterySlotPanel(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
slot: T,
|
slot: T,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
@ -124,9 +125,9 @@ fun <T : Slot> BatterySlotPanel(
|
|||||||
height: Float = AbstractSlotPanel.SIZE,
|
height: Float = AbstractSlotPanel.SIZE,
|
||||||
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.BATTERY_SLOT_BACKGROUND)
|
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.BATTERY_SLOT_BACKGROUND)
|
||||||
|
|
||||||
fun <T : Slot> EquipmentBatterySlotPanel(
|
fun <S : MatteryScreen<*>, T : Slot> EquipmentBatterySlotPanel(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
slot: T,
|
slot: T,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
@ -134,9 +135,9 @@ fun <T : Slot> EquipmentBatterySlotPanel(
|
|||||||
height: Float = AbstractSlotPanel.SIZE,
|
height: Float = AbstractSlotPanel.SIZE,
|
||||||
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.EQUIPMENT_BATTERY_SLOT_BACKGROUND)
|
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.EQUIPMENT_BATTERY_SLOT_BACKGROUND)
|
||||||
|
|
||||||
fun <T : Slot> PatternSlotPanel(
|
fun <S : MatteryScreen<*>, T : Slot> PatternSlotPanel(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
slot: T,
|
slot: T,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
@ -144,9 +145,9 @@ fun <T : Slot> PatternSlotPanel(
|
|||||||
height: Float = AbstractSlotPanel.SIZE,
|
height: Float = AbstractSlotPanel.SIZE,
|
||||||
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.PATTERN_SLOT_BACKGROUND)
|
) = SlotPanel(screen, parent, slot, x, y, width, height, Widgets18.PATTERN_SLOT_BACKGROUND)
|
||||||
|
|
||||||
fun <T : Slot> MatterCapacitorSlotPanel(
|
fun <S : MatteryScreen<*>, T : Slot> MatterCapacitorSlotPanel(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel?,
|
parent: EditablePanel<*>?,
|
||||||
slot: T,
|
slot: T,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.widget
|
package ru.dbotthepony.mc.otm.client.screen.widget
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
import ru.dbotthepony.mc.otm.client.render.element
|
import ru.dbotthepony.mc.otm.client.render.element
|
||||||
@ -8,15 +9,15 @@ import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
|||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||||
|
|
||||||
open class HorizontalPowerGaugePanel(
|
open class HorizontalPowerGaugePanel<out S : Screen>(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
widget: LevelGaugeWidget,
|
widget: LevelGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = GAUGE_BACKGROUND.w,
|
width: Float = GAUGE_BACKGROUND.w,
|
||||||
height: Float = GAUGE_BACKGROUND.h
|
height: Float = GAUGE_BACKGROUND.h
|
||||||
) : PowerGaugePanel(screen, parent, widget, x, y, width, height) {
|
) : PowerGaugePanel<S>(screen, parent, widget, x, y, width, height) {
|
||||||
var flop = false
|
var flop = false
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
@ -55,9 +56,9 @@ open class HorizontalPowerGaugePanel(
|
|||||||
/**
|
/**
|
||||||
* Shortcut to [HorizontalPowerGaugePanel] with doubled height
|
* Shortcut to [HorizontalPowerGaugePanel] with doubled height
|
||||||
*/
|
*/
|
||||||
fun TallHorizontalPowerGaugePanel(
|
fun <S : Screen> TallHorizontalPowerGaugePanel(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
widget: LevelGaugeWidget,
|
widget: LevelGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.BufferUploader
|
|||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat
|
import com.mojang.blaze3d.vertex.VertexFormat
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.GL11
|
||||||
@ -19,13 +20,13 @@ import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
|||||||
import kotlin.math.cos
|
import kotlin.math.cos
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
|
||||||
open class MatterGaugePanel(
|
open class MatterGaugePanel<S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
val widget: LevelGaugeWidget,
|
val widget: LevelGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f
|
y: Float = 0f
|
||||||
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
|
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
|
||||||
init {
|
init {
|
||||||
scissor = true
|
scissor = true
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.widget
|
package ru.dbotthepony.mc.otm.client.screen.widget
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
@ -10,13 +11,13 @@ import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
|||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||||
|
|
||||||
open class PatternGaugePanel(
|
open class PatternGaugePanel<S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
val widget: LevelGaugeWidget,
|
val widget: LevelGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f
|
y: Float = 0f
|
||||||
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
|
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
|
||||||
init {
|
init {
|
||||||
scissor = true
|
scissor = true
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.widget
|
package ru.dbotthepony.mc.otm.client.screen.widget
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.client.render.*
|
import ru.dbotthepony.mc.otm.client.render.*
|
||||||
@ -9,15 +10,15 @@ import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
|||||||
import ru.dbotthepony.mc.otm.core.formatPowerLevel
|
import ru.dbotthepony.mc.otm.core.formatPowerLevel
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||||
|
|
||||||
open class PowerGaugePanel(
|
open class PowerGaugePanel<out S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
val widget: LevelGaugeWidget,
|
val widget: LevelGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = GAUGE_BACKGROUND.w,
|
width: Float = GAUGE_BACKGROUND.w,
|
||||||
height: Float = GAUGE_BACKGROUND.h
|
height: Float = GAUGE_BACKGROUND.h
|
||||||
) : EditablePanel(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
init {
|
init {
|
||||||
scissor = true
|
scissor = true
|
||||||
}
|
}
|
||||||
@ -72,9 +73,9 @@ open class PowerGaugePanel(
|
|||||||
/**
|
/**
|
||||||
* Shortcut to [PowerGaugePanel] with doubled width
|
* Shortcut to [PowerGaugePanel] with doubled width
|
||||||
*/
|
*/
|
||||||
fun WidePowerGaugePanel(
|
fun <S : Screen> WidePowerGaugePanel(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
widget: LevelGaugeWidget,
|
widget: LevelGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.widget
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
@ -12,13 +13,13 @@ import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
|||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
||||||
|
|
||||||
open class ProgressGaugePanel(
|
open class ProgressGaugePanel<S : Screen> @JvmOverloads constructor(
|
||||||
screen: MatteryScreen<*>,
|
screen: S,
|
||||||
parent: EditablePanel? = null,
|
parent: EditablePanel<*>? = null,
|
||||||
val widget: ProgressGaugeWidget,
|
val widget: ProgressGaugeWidget,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f
|
y: Float = 0f
|
||||||
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
|
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
|
||||||
init {
|
init {
|
||||||
scissor = true
|
scissor = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user