The bug
The refresh button in the multiplayer server menu always takes you up top of the menu.
How to reproduce
Open your server list and scroll down.
Press the
Refresh
button.
→ ❌ It opens a new multiplayer menu and therefore the slider position resets
Code analysis
The following is based on yarn 1.15.2 names.
The reason for this issue is quite simple, as the server list refresh button opens a new multiplayer screen and that causes the servers to refresh. A fix for this issue would be to track the position of the bar and set the bar to that when refreshing. Very basic example:
private void refresh() {
this.minecraft.openScreen(new MultiplayerScreen(this.parent));
//sets slider position
this.setSlider(previousSliderZ);
//resets it to 0 after being set with the now old value
this.previousSliderZ = 0;
}
Where the setSlider instance, sets the slider to the given z (vertical) and the int (or double) previousSliderZ would be the previous z position of the slider. In theory, should work.
Yeah this one's been around since multiplayer began, they really need to fix it.