Skip to content

Commit

Permalink
Adjust text scrolling to account for buttons' icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Jul 20, 2023
1 parent c6f4ec8 commit 1248e3f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.tooltip.TooltipPositioner;
Expand Down Expand Up @@ -243,6 +244,13 @@ protected void renderBackground(DrawContext context, MinecraftClient mc, int mou

}

@Override
public void drawMessage(DrawContext context, TextRenderer textRenderer, int color) {
Bounds bounds = getBounds();
int left = getStyle().getIcon().getBounds().right();
drawScrollableText(context, textRenderer, getMessage(), bounds.left + left, bounds.top, bounds.right() - 2, bounds.bottom(), color);
}

protected int getTextureY() {
int i = 1;
if (!active) {
Expand Down

0 comments on commit 1248e3f

Please sign in to comment.