0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 09:16:20 +02:00

Fix SettingsWindow sometimes opening at the wrong position

This commit is contained in:
Alexander01998 2021-09-22 08:46:54 +02:00
parent 25af63b7b1
commit 523a0949d2

View File

@ -9,6 +9,7 @@ package net.wurstclient.clickgui;
import java.util.stream.Stream;
import net.minecraft.util.math.MathHelper;
import net.wurstclient.Feature;
import net.wurstclient.WurstClient;
import net.wurstclient.settings.Setting;
@ -24,6 +25,7 @@ public final class SettingsWindow extends Window
setClosable(true);
setMinimizable(false);
setMaxHeight(187);
pack();
setInitialPosition(parent, buttonY);
@ -41,6 +43,9 @@ public final class SettingsWindow extends Window
if(y + getHeight() > mcWindow.getScaledHeight())
y -= getHeight() - 14;
x = MathHelper.clamp(x, 0, mcWindow.getScaledWidth());
y = MathHelper.clamp(y, 0, mcWindow.getScaledHeight());
setX(x);
setY(y);
}