improve PlayerSelector rendering consistency
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m23s

This commit is contained in:
Daniella / Tove 2024-06-25 22:06:16 +02:00
parent 65f43ebb4a
commit 060c73ee2b
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -73,7 +73,7 @@ public class PlayerSelector extends Feature {
public void text(RenderGameOverlayEvent.Text e) {
ScaledResolution sr = new ScaledResolution(mc);
int x = sr.getScaledWidth() / 5;
int y = sr.getScaledHeight() / 2;
int y = sr.getScaledHeight() / 2 - 5 * mc.fontRenderer.FONT_HEIGHT;
if(display.isEmpty())
return;
@ -87,6 +87,7 @@ public class PlayerSelector extends Feature {
}
private void renderList(int x, int y) {
y += -Math.min(cursor - 5, 0) * mc.fontRenderer.FONT_HEIGHT;
for (int i = Math.max(0, cursor - 5); i < Math.min(display.size(), cursor + 6); i++) {
NetworkPlayerInfo playerInfo = display.get(i);
boolean selected = cursor == i;
@ -103,6 +104,7 @@ public class PlayerSelector extends Feature {
mode = Mode.LIST;
mc.fontRenderer.drawStringWithShadow(" Select with enter", x, y, 0xffffffff);
y += mc.fontRenderer.FONT_HEIGHT;
y += -Math.min(optionCursor - 5, 0) * mc.fontRenderer.FONT_HEIGHT;
for (int i = Math.max(0, optionCursor - 5); i < Math.min(options.size(), optionCursor + 6); i++) {
PlayerSelectOption option = options.get(i);