fix gui button rendering

This commit is contained in:
James Seibel
2025-06-19 07:32:21 -05:00
parent e02f56f4ef
commit 92e403823b
@@ -44,6 +44,8 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
#endif
import net.minecraft.client.renderer.RenderPipelines;
/**
* Creates a button with a texture on it (and a background) that works with all mc versions
*
@@ -172,9 +174,15 @@ public class TexturedButtonWidget extends Button
{
#if MC_VER < MC_1_21_3
matrices.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
#elif MC_VER < MC_1_21_6
matrices.blitSprite(
RenderType::guiTextured,
SPRITES.get(this.active, this.isHoveredOrFocused()),
this.getX(), this.getY(),
this.getWidth(), this.getHeight());
#else
matrices.blitSprite(
RenderType::guiTextured,
RenderPipelines.GUI_TEXTURED,
SPRITES.get(this.active, this.isHoveredOrFocused()),
this.getX(), this.getY(),
this.getWidth(), this.getHeight());
@@ -196,7 +204,7 @@ public class TexturedButtonWidget extends Button
#if MC_VER < MC_1_21_3
matrices.blit(this.textureResourceLocation, this.getX(), this.getY(), this.u, this.v + (this.hoveredVOffset * i), this.width, this.height, this.textureWidth, this.textureHeight);
#else
#elif MC_VER < MC_1_21_6
matrices.blit(
RenderType::guiTextured,
this.textureResourceLocation,
@@ -204,6 +212,14 @@ public class TexturedButtonWidget extends Button
this.u, this.v + (this.hoveredVOffset * i),
this.width, this.height,
this.textureWidth, this.textureHeight);
#else
matrices.blit(
RenderPipelines.GUI_TEXTURED,
this.textureResourceLocation,
this.getX(), this.getY(),
this.u, this.v + (this.hoveredVOffset * i),
this.width, this.height,
this.textureWidth, this.textureHeight);
#endif
}