Make ForgeSlider use the new vanilla texture (#9406)

This commit is contained in:
matyrobbrt authored and GitHub committed 2023-03-20 14:16:35 -07:00
1 parent d0e2242043
commit c18eb23259
2 files changed
+7 -7

No files matched your search

@@ -229,16 +229,13 @@ public class ForgeSlider extends AbstractSliderButton
public void renderWidget(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick)
{
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
RenderSystem.setShaderTexture(0, SLIDER_LOCATION);
final Minecraft mc = Minecraft.getInstance();
final int bgYImage = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1);
ScreenUtils.blitWithBorder(poseStack, this.getX(), this.getY(), 0, 46 + bgYImage * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, 0);
ScreenUtils.blitWithBorder(poseStack, this.getX(), this.getY(), 0, getTextureY(), this.width, this.height, 200, 20, 2, 3, 2, 2, 0);
final int sliderYImage = (this.isHoveredOrFocused() ? 2 : 1) * 20;
ScreenUtils.blitWithBorder(poseStack, this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 0, 46 + sliderYImage, 8, this.height, 200, 20 , 2, 3, 2, 2, 0);
ScreenUtils.blitWithBorder(poseStack, this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 0, getHandleTextureY(), 8, this.height, 200, 20 , 2, 3, 2, 2, 0);
final FormattedText message = mc.font.ellipsize(getMessage(), this.width - 6);
drawCenteredString(poseStack, mc.font, Language.getInstance().getVisualOrder(message), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, getFGColor());
renderScrollingString(poseStack, mc.font, 2, getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
}
}