diff --git a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/widget/custom/CustomPressableWidget.kt b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/widget/custom/CustomPressableWidget.kt index a5803af4596..1cd2b15484b 100644 --- a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/widget/custom/CustomPressableWidget.kt +++ b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/screen/widget/custom/CustomPressableWidget.kt @@ -83,7 +83,7 @@ open class CustomPressableWidget(x: Int, y: Int, width: Int, height: Int, messag open fun renderBackground(context: DrawContext, x: Int, y: Int, width: Int, height: Int, mouseX: Int, mouseY: Int, delta: Float) { RenderSystem.enableBlend() RenderSystem.enableDepthTest() - context.drawNineSlice(textures.get(active, this.isSelected), x, y, width, height, ColorHelper.getWhite(this.alpha)) + context.drawNineSlice(textures.get(active, this.isSelected), x, y, width, height, this.alpha) } override fun renderWidget(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) { diff --git a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/util/RenderUtil.kt b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/util/RenderUtil.kt index 34cfeeaa047..2282a8d9403 100644 --- a/src/main/kotlin/me/fzzyhmstrs/fzzy_config/util/RenderUtil.kt +++ b/src/main/kotlin/me/fzzyhmstrs/fzzy_config/util/RenderUtil.kt @@ -100,6 +100,23 @@ object RenderUtil { this.drawTex(id, x, y, width, height, color) } + /** + * Extension function to replicate the nine-slice functionality drawGuiTexture from 1.20.2+. + * + * __in 1.20.2+ this is a compat method; maintained as-is to avoid needing to alter mod code elsewhere.__ + * @param id Identifier - The sprite identifier (1.20.2+ style) for the image. + * @param x Int - the x location of the texture + * @param y Int - the y location of the texture + * @param width Int - the width of the drawn texture + * @param height Int - the height of the drawn texture + * @param alpha Float - the texture transparency + * @author fzzyhmstrs + * @since 0.6.1 + */ + fun DrawContext.drawNineSlice(id: Identifier, x: Int, y: Int, width: Int, height: Int, alpha: Float) { + this.drawTex(id, x, y, width, height, alpha) + } + /** * Extension function to draw a texture, replacing drawtexture. Uses the [RenderLayer.getGuiTextured] method to fill in the function param * @param id Identifier - The sprite identifier for the image.