Mojira Archive
MC-12289

Refresh button in the multiplayer menu resets the position of the slider

The bug

The refresh button in the multiplayer server menu always takes you up top of the menu.

How to reproduce

  1. Open your server list and scroll down.
  2. 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.