diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinElement.kt index 2ffa6db23..cfbb58cca 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinElement.kt @@ -37,8 +37,17 @@ class SkinGrid( } } +fun ResourceLocation.element( + x: Float, + y: Float, + w: Float, + h: Float, + textureWidth: Float = 256f, + textureHeight: Float = 256f +) = SkinElement(this, x, y, w, h, textureWidth, textureHeight) + class SkinElement @JvmOverloads constructor( - val texture: ResourceLocation = RenderHelper.WIDGETS, + val texture: ResourceLocation, val image_x: Float, val image_y: Float, val rect_w: Float, @@ -217,21 +226,21 @@ class SkinElement @JvmOverloads constructor( ) = renderRawPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding) } -@JvmField val top_left_window_corner = SkinElement(image_x = 18f, image_y = 0f, rect_w = 6f, rect_h = 6f) -@JvmField val top_right_window_corner = SkinElement(image_x = 24f, image_y = 0f, rect_w = 6f, rect_h = 6f) -@JvmField val left_window_border = SkinElement(image_x = 18f, image_y = 4f, rect_w = 3f, rect_h = 5f) -@JvmField val right_window_border = SkinElement(image_x = 27f, image_y = 3f, rect_w = 3f, rect_h = 5f) -@JvmField val top_window_border = SkinElement(image_x = 22f, image_y = 0f, rect_w = 5f, rect_h = 3f) -@JvmField val window_background = SkinElement(image_x = 30f, image_y = 12f, rect_w = 6f, rect_h = 6f) -@JvmField val scroll_bar_top = SkinElement(image_x = 18f, image_y = 57f, rect_w = 14f, rect_h = 2f) -@JvmField val scroll_bar_bottom = SkinElement(image_x = 18f, image_y = 63f, rect_w = 14f, rect_h = 2f) -@JvmField val scroll_bar_body = SkinElement(image_x = 18f, image_y = 58f, rect_w = 14f, rect_h = 6f) -@JvmField val scroll_bar_button = SkinElement(image_x = 18f, image_y = 12f, rect_w = 12f, rect_h = 15f) -@JvmField val scroll_bar_button_hover = SkinElement(image_x = 18f, image_y = 27f, rect_w = 12f, rect_h = 15f) -@JvmField val scroll_bar_button_press = SkinElement(image_x = 18f, image_y = 42f, rect_w = 12f, rect_h = 15f) -@JvmField val tab_right_connection = SkinElement(image_x = 30f, image_y = 0f, rect_w = 3f, rect_h = 5f) -@JvmField val tab_left_connection = SkinElement(image_x = 33f, image_y = 0f, rect_w = 3f, rect_h = 5f) -@JvmField val tab_background = SkinElement(image_x = 30f, image_y = 6f, rect_w = 6f, rect_h = 6f) -@JvmField val bottom_left_window_corner = SkinElement(image_x = 18f, image_y = 6f, rect_w = 6f, rect_h = 6f) -@JvmField val bottom_right_window_corner = SkinElement(image_x = 24f, image_y = 6f, rect_w = 6f, rect_h = 6f) -@JvmField val bottom_window_border = SkinElement(image_x = 21f, image_y = 9f, rect_w = 5f, rect_h = 3f) +val top_left_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 0f, rect_w = 6f, rect_h = 6f) +val top_right_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 24f, image_y = 0f, rect_w = 6f, rect_h = 6f) +val left_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 4f, rect_w = 3f, rect_h = 5f) +val right_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 27f, image_y = 3f, rect_w = 3f, rect_h = 5f) +val top_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 22f, image_y = 0f, rect_w = 5f, rect_h = 3f) +val window_background = SkinElement(RenderHelper.WIDGETS, image_x = 30f, image_y = 12f, rect_w = 6f, rect_h = 6f) +val scroll_bar_top = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 57f, rect_w = 14f, rect_h = 2f) +val scroll_bar_bottom = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 63f, rect_w = 14f, rect_h = 2f) +val scroll_bar_body = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 58f, rect_w = 14f, rect_h = 6f) +val scroll_bar_button = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 12f, rect_w = 12f, rect_h = 15f) +val scroll_bar_button_hover = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 27f, rect_w = 12f, rect_h = 15f) +val scroll_bar_button_press = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 42f, rect_w = 12f, rect_h = 15f) +val tab_right_connection = SkinElement(RenderHelper.WIDGETS, image_x = 30f, image_y = 0f, rect_w = 3f, rect_h = 5f) +val tab_left_connection = SkinElement(RenderHelper.WIDGETS, image_x = 33f, image_y = 0f, rect_w = 3f, rect_h = 5f) +val tab_background = SkinElement(RenderHelper.WIDGETS, image_x = 30f, image_y = 6f, rect_w = 6f, rect_h = 6f) +val bottom_left_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 6f, rect_w = 6f, rect_h = 6f) +val bottom_right_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 24f, image_y = 6f, rect_w = 6f, rect_h = 6f) +val bottom_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 21f, image_y = 9f, rect_w = 5f, rect_h = 3f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt index 6bbd5e6d8..176dc79e7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt @@ -5,6 +5,7 @@ import net.minecraft.client.resources.sounds.SimpleSoundInstance import net.minecraft.network.chat.Component import net.minecraft.sounds.SoundEvents import ru.dbotthepony.mc.otm.client.minecraft +import ru.dbotthepony.mc.otm.client.render.RenderHelper import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxPanel.Companion.REGULAR_DIMENSIONS @@ -40,6 +41,7 @@ open class CheckBoxPanel( const val REGULAR_DIMENSIONS = 15f val CHECKBOX_UNCHECKED = SkinElement( + RenderHelper.WIDGETS, image_x = 18f, image_y = 65f, rect_w = REGULAR_DIMENSIONS, @@ -47,6 +49,7 @@ open class CheckBoxPanel( ) val CHECKBOX_CHECKED = SkinElement( + RenderHelper.WIDGETS, image_x = 18f, image_y = 80f, rect_w = REGULAR_DIMENSIONS, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/Gauges.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/Gauges.kt index 21bb0a8f8..daac45ef6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/Gauges.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/Gauges.kt @@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.ChatFormatting import net.minecraft.network.chat.Component import net.minecraft.network.chat.TranslatableComponent +import ru.dbotthepony.mc.otm.client.render.RenderHelper import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.render.UVWindingOrder @@ -47,8 +48,8 @@ open class PowerGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = SkinElement(image_x = 0f, image_y = 48f, rect_w = 9f, rect_h = 48f) - val GAUGE_FOREGROUND = SkinElement(image_x = 9f, image_y = 48f, rect_w = 9f, rect_h = 48f) + val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 48f, rect_w = 9f, rect_h = 48f) + val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 9f, image_y = 48f, rect_w = 9f, rect_h = 48f) } } @@ -86,8 +87,8 @@ open class MatterGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = SkinElement(image_x = 0f, image_y = 0f, rect_w = 9f, rect_h = 48f) - val GAUGE_FOREGROUND = SkinElement(image_x = 9f, image_y = 0f, rect_w = 9f, rect_h = 48f) + val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 0f, rect_w = 9f, rect_h = 48f) + val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 9f, image_y = 0f, rect_w = 9f, rect_h = 48f) } } @@ -125,8 +126,8 @@ open class PatternGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = SkinElement(image_x = 0f, image_y = 148f, rect_w = 9f, rect_h = 48f) - val GAUGE_FOREGROUND = SkinElement(image_x = 9f, image_y = 148f, rect_w = 9f, rect_h = 48f) + val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 148f, rect_w = 9f, rect_h = 48f) + val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 9f, image_y = 148f, rect_w = 9f, rect_h = 48f) } } @@ -196,7 +197,7 @@ open class ProgressGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = SkinElement(image_x = 0f, image_y = 132f, rect_w = 22f, rect_h = 16f) - val GAUGE_FOREGROUND = SkinElement(image_x = 22f, image_y = 132f, rect_w = 22f, rect_h = 16f) + val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 132f, rect_w = 22f, rect_h = 16f) + val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 22f, image_y = 132f, rect_w = 22f, rect_h = 16f) } }