get rid of useless skinElement in SquareButtonPanel
This commit is contained in:
parent
a4a8eb57ee
commit
780f3b3814
@ -5,6 +5,7 @@ import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
||||
import net.minecraftforge.client.event.MovementInputUpdateEvent
|
||||
import net.minecraftforge.client.event.ScreenEvent
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||
import ru.dbotthepony.mc.otm.client.screen.ExoSuitInventoryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.LargeSquareButtonPanel
|
||||
@ -56,6 +57,7 @@ object ClientEventHandler {
|
||||
x = screen.guiLeft + screen.xSize + 2f,
|
||||
y = screen.guiTop.toFloat(),
|
||||
skinElement = Widgets18.RETURN_ARROW_LEFT,
|
||||
skinElementWinding = UVWindingOrder.FLOP,
|
||||
onPress = {
|
||||
shouldOpenVanillaInventory = false
|
||||
val mouseX = minecraft.mouseHandler.xpos()
|
||||
|
@ -14,7 +14,6 @@ import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets8
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.TallHorizontalPowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.core.maxScrollDivision
|
||||
import ru.dbotthepony.mc.otm.core.formatReadableNumber
|
||||
@ -130,7 +129,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
||||
enum = ItemMonitorPlayerSettings.RefillSource::class.java,
|
||||
prop = menu.settings::refillSource,
|
||||
defaultValue = ItemMonitorPlayerSettings.RefillSource.SYSTEM,
|
||||
lambdaOnChange = { menu.sendSettingsToServer() })
|
||||
onChange = { menu.sendSettingsToServer() })
|
||||
|
||||
refillPriority.mainTooltip = TranslatableComponent("otm.gui.item_monitor.refill_source.desc")
|
||||
refillPriority.add(ItemMonitorPlayerSettings.RefillSource.SYSTEM, ItemMonitorPlayerSettings.RefillSource.SYSTEM.component, Widgets8.WHITE_ARROW_DOWN, UVWindingOrder.FLIP)
|
||||
@ -152,7 +151,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
||||
enum = ItemMonitorPlayerSettings.ResultTarget::class.java,
|
||||
prop = menu.settings::resultTarget,
|
||||
defaultValue = ItemMonitorPlayerSettings.ResultTarget.MIXED,
|
||||
lambdaOnChange = { menu.sendSettingsToServer() })
|
||||
onChange = { menu.sendSettingsToServer() })
|
||||
|
||||
resultTarget.mainTooltip = TranslatableComponent("otm.gui.item_monitor.result_target.desc")
|
||||
resultTarget.add(ItemMonitorPlayerSettings.ResultTarget.MIXED, ItemMonitorPlayerSettings.ResultTarget.MIXED.component, Widgets8.ARROW_SIDEWAYS)
|
||||
@ -163,7 +162,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
||||
enum = ItemMonitorPlayerSettings.Amount::class.java,
|
||||
prop = menu.settings::craftingAmount,
|
||||
defaultValue = ItemMonitorPlayerSettings.Amount.STACK,
|
||||
lambdaOnChange = { menu.sendSettingsToServer() })
|
||||
onChange = { menu.sendSettingsToServer() })
|
||||
|
||||
craftingAmount.mainTooltip = TranslatableComponent("otm.gui.item_monitor.amount.desc")
|
||||
craftingAmount.add(ItemMonitorPlayerSettings.Amount.ONE, ItemMonitorPlayerSettings.Amount.ONE.component, Widgets8.ONE)
|
||||
|
@ -10,7 +10,6 @@ import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import ru.dbotthepony.mc.otm.client.render.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.core.next
|
||||
import ru.dbotthepony.mc.otm.core.prev
|
||||
import java.util.*
|
||||
@ -80,7 +79,6 @@ abstract class SquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||
y: Float = 0f,
|
||||
width: Float,
|
||||
height: Float,
|
||||
val skinElement: (() -> SkinElement)? = null,
|
||||
val onPress: ((clickButton: Int) -> Unit)? = null,
|
||||
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||
protected var pressed = false
|
||||
@ -113,8 +111,6 @@ abstract class SquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||
} else {
|
||||
IDLE.render(stack, 0f, 0f, width, height)
|
||||
}
|
||||
|
||||
skinElement?.invoke()?.render(stack, 0f, 0f, width, height)
|
||||
}
|
||||
|
||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||
@ -156,7 +152,7 @@ abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enu
|
||||
val prop: KMutableProperty0<T>,
|
||||
val defaultValue: T,
|
||||
val onChange: ((newValue: T) -> Unit)? = null,
|
||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, null, null) {
|
||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, null) {
|
||||
private var building = true
|
||||
|
||||
protected val enumMapping = EnumMap<T, Pair<SkinElement, UVWindingOrder>>(enum)
|
||||
@ -321,24 +317,24 @@ open class LargeSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||
y: Float = 0f,
|
||||
width: Float = SIZE,
|
||||
height: Float = SIZE,
|
||||
skinElement: (() -> SkinElement)? = null,
|
||||
onPress: ((clickButton: Int) -> Unit)? = null,
|
||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, skinElement, onPress) {
|
||||
constructor(
|
||||
screen: S,
|
||||
parent: EditablePanel<*>?,
|
||||
x: Float = 0f,
|
||||
y: Float = 0f,
|
||||
width: Float = SIZE,
|
||||
height: Float = SIZE,
|
||||
skinElement: SkinElement,
|
||||
onPress: ((clickButton: Int) -> Unit)? = null,
|
||||
) : this(screen, parent, x, y, width, height, { skinElement }, onPress)
|
||||
|
||||
val skinElement: SkinElement? = null,
|
||||
val skinElementWinding: UVWindingOrder? = null,
|
||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, onPress) {
|
||||
final override val IDLE = Widgets18.BUTTON_IDLE
|
||||
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
||||
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
||||
|
||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
||||
|
||||
if (skinElementWinding != null) {
|
||||
skinElement?.render(stack, x, y, width, height, skinElementWinding)
|
||||
} else {
|
||||
skinElement?.render(stack, x, y, width, height)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SIZE = 18f
|
||||
}
|
||||
@ -372,13 +368,24 @@ open class SmallSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||
y: Float = 0f,
|
||||
width: Float = SIZE,
|
||||
height: Float = SIZE,
|
||||
skinElement: (() -> SkinElement)? = null,
|
||||
lambdaOnPress: ((clickButton: Int) -> Unit)? = null,
|
||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, skinElement, lambdaOnPress) {
|
||||
onPress: ((clickButton: Int) -> Unit)? = null,
|
||||
val skinElement: SkinElement? = null,
|
||||
val skinElementWinding: UVWindingOrder? = null,
|
||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, onPress) {
|
||||
final override val IDLE = Widgets8.BUTTON_IDLE
|
||||
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||
|
||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
||||
|
||||
if (skinElementWinding != null) {
|
||||
skinElement?.render(stack, x, y, width, height, skinElementWinding)
|
||||
} else {
|
||||
skinElement?.render(stack, x, y, width, height)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SIZE = 8f
|
||||
}
|
||||
@ -394,8 +401,8 @@ open class SmallEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : En
|
||||
enum: Class<T>,
|
||||
prop: KMutableProperty0<T>,
|
||||
defaultValue: T,
|
||||
lambdaOnChange: ((newValue: T) -> Unit)? = null,
|
||||
) : EnumSquareButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, lambdaOnChange) {
|
||||
onChange: ((newValue: T) -> Unit)? = null,
|
||||
) : EnumSquareButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
||||
final override val IDLE = Widgets8.BUTTON_IDLE
|
||||
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||
|
Loading…
Reference in New Issue
Block a user