Skip to content

Commit

Permalink
fix banner picker
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Nov 15, 2024
1 parent fe540c4 commit ba4f54d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,18 +505,18 @@ public PatternButton(int x, int y, int height, Holder<BannerPattern> pattern)
@Override
public void renderWidget(final GuiGraphics stack, int mx, int my, float p_renderButton_3_)
{
this.visible = scrollRow * PATTERN_COLUMNS <= this.index && this.index < PATTERN_COLUMNS * (scrollRow + PATTERN_ROWS);
boolean isVisible = scrollRow * PATTERN_COLUMNS <= this.index && this.index < PATTERN_COLUMNS * (scrollRow + PATTERN_ROWS);
this.active = activeLayer != 0;

if (!this.active || !this.visible) return;
if (!this.active || !this.visible || !isVisible) return;

int position = Math.floorDiv(this.index - scrollRow*PATTERN_COLUMNS, PATTERN_COLUMNS);
this.setY(center(WindowBannerPicker.this.height, PATTERN_ROWS, PATTERN_HEIGHT, position, PATTERN_MARGIN));
this.isHovered = mx >= this.getX() && my >= this.getY() && mx < this.getX() + this.width && my < this.getY() + this.height;

super.renderWidget(stack, mx, my, p_renderButton_3_);

if (this.visible)
if (isVisible)
{
if (this.isHovered && this.active)
stack.fill(this.getX(), this.getY(), this.getX()+this.width, this.getY()+this.height, 0xDDFFFFFF);
Expand Down

0 comments on commit ba4f54d

Please sign in to comment.