Skip to content

Commit

Permalink
Fix scrollbar not rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Apr 29, 2024
1 parent d48b0b9 commit 9a6b5a1
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*/
public class WidgetScrollBar extends AbstractWidget {

private static final ResourceLocation SCROLLBUTTON = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
private static final ResourceLocation SCROLLER_SPRITE = new ResourceLocation("widget/scroller");
private static final ResourceLocation SCROLLER_DISABLED_SPRITE = new ResourceLocation("widget/scroller_disabled");
private static final int SCROLL_BUTTON_HEIGHT = 15;
private static final int SCROLL_BUTTON_WIDTH = 12;

Expand Down Expand Up @@ -124,12 +125,10 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
int scrollX = x;
int scrollMinY = y;
int scrollMaxY = scrollMinY + height;
guiGraphics.blit(
SCROLLBUTTON,
guiGraphics.blitSprite(
this.needsScrollBars() ? SCROLLER_SPRITE : SCROLLER_DISABLED_SPRITE,
scrollX,
scrollMinY + (int)((float)(scrollMaxY - scrollMinY - SCROLL_BUTTON_HEIGHT - 2) * this.currentScroll),
232 + (this.needsScrollBars() ? 0 : SCROLL_BUTTON_WIDTH),
0,
SCROLL_BUTTON_WIDTH,
SCROLL_BUTTON_HEIGHT
);
Expand Down

0 comments on commit 9a6b5a1

Please sign in to comment.