From db53f4906e180aa28633ccd02e7f550eee1f4028 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 12 Feb 2024 17:45:03 +0000 Subject: [PATCH] Fixed tribe selection gui not scrolling to the correct position when opening --- .../unicopia/client/gui/TribeSelectionScreen.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java index 32c7dabb..6264eff9 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/TribeSelectionScreen.java @@ -71,10 +71,7 @@ public class TribeSelectionScreen extends GameGui implements HidesHud { addOption(race, top); } - if (SELECTION == -1) { - SELECTION = options.size() / 2; - } - scroll(SELECTION, false); + scroll(SELECTION == -1 ? options.size() / 2 : SELECTION, false); } private void addOption(Race race, int y) { @@ -167,11 +164,12 @@ public class TribeSelectionScreen extends GameGui implements HidesHud { } private void scroll(int target, boolean animate) { - if (target == SELECTION) { + SELECTION = target; + target *= 4; + if (targetScroll == target) { return; } - SELECTION = target; - targetScroll = SELECTION * 4; + targetScroll = target; if (!animate) { scrollPosition = targetScroll; prevScrollPosition = scrollPosition;