diff --git a/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java b/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java index 0620ffb5cbe..3c2874a6471 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java @@ -207,7 +207,7 @@ private Style findTextLine(final int mouseX, final int mouseY) { if (!isMouseOver(mouseX, mouseY)) return null; - double offset = (mouseY - top) + border + scrollDistance + 1; + double offset = (mouseY - top - PADDING - border) + scrollDistance; if (logoPath != null) { offset -= 50; } @@ -215,12 +215,12 @@ private Style findTextLine(final int mouseX, final int mouseY) { return null; int lineIdx = (int) (offset / font.lineHeight); - if (lineIdx >= lines.size() || lineIdx < 1) + if (lineIdx >= lines.size() || lineIdx < 0) return null; - FormattedCharSequence line = lines.get(lineIdx - 1); + FormattedCharSequence line = lines.get(lineIdx); if (line != null) { - return font.getSplitter().componentStyleAtWidth(line, mouseX - left - border); + return font.getSplitter().componentStyleAtWidth(line, mouseX - left - border - 1); } return null; }