Skip to content

Commit 16f3dd5

Browse files
committed
AltManager Tweaks
1 parent 84d1849 commit 16f3dd5

File tree

6 files changed

+681
-37
lines changed

6 files changed

+681
-37
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2014-2026 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.altmanager.screens;
9+
10+
import org.lwjgl.glfw.GLFW;
11+
12+
import net.minecraft.client.gui.GuiGraphics;
13+
import net.minecraft.client.gui.components.Button;
14+
import net.minecraft.client.gui.components.Renderable;
15+
import net.minecraft.client.gui.screens.Screen;
16+
import net.minecraft.client.input.KeyEvent;
17+
import net.minecraft.client.input.MouseButtonEvent;
18+
import net.minecraft.network.chat.Component;
19+
20+
public final class AltLoginFailedScreen extends Screen
21+
{
22+
private static final int RED = 0xFFFF5555;
23+
24+
private final Screen nextScreen;
25+
private final String titleText;
26+
private final String detailText;
27+
28+
public AltLoginFailedScreen(Screen nextScreen, String detailText)
29+
{
30+
super(Component.literal("Login failed"));
31+
this.nextScreen = nextScreen;
32+
titleText = "Login failed";
33+
this.detailText = detailText == null || detailText.isBlank()
34+
? "Unknown error" : detailText;
35+
}
36+
37+
@Override
38+
protected void init()
39+
{
40+
addRenderableWidget(Button
41+
.builder(Component.literal("Continue"),
42+
b -> minecraft.setScreen(nextScreen))
43+
.bounds(width / 2 - 100, height / 2 + 48, 200, 20).build());
44+
}
45+
46+
@Override
47+
public void render(GuiGraphics context, int mouseX, int mouseY,
48+
float partialTicks)
49+
{
50+
context.drawCenteredString(font, titleText, width / 2, height / 2 - 34,
51+
RED);
52+
context.drawCenteredString(font, detailText, width / 2, height / 2 - 20,
53+
RED);
54+
55+
for(Renderable drawable : renderables)
56+
drawable.render(context, mouseX, mouseY, partialTicks);
57+
}
58+
59+
@Override
60+
public boolean keyPressed(KeyEvent context)
61+
{
62+
if(context.key() == GLFW.GLFW_KEY_ENTER
63+
|| context.key() == GLFW.GLFW_KEY_ESCAPE)
64+
{
65+
onClose();
66+
return true;
67+
}
68+
69+
return super.keyPressed(context);
70+
}
71+
72+
@Override
73+
public boolean mouseClicked(MouseButtonEvent context, boolean doubleClick)
74+
{
75+
if(context.button() == GLFW.GLFW_MOUSE_BUTTON_4)
76+
{
77+
onClose();
78+
return true;
79+
}
80+
81+
return super.mouseClicked(context, doubleClick);
82+
}
83+
84+
@Override
85+
public void onClose()
86+
{
87+
minecraft.setScreen(nextScreen);
88+
}
89+
90+
@Override
91+
public boolean isPauseScreen()
92+
{
93+
return false;
94+
}
95+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright (c) 2014-2026 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.altmanager.screens;
9+
10+
import org.lwjgl.glfw.GLFW;
11+
12+
import net.minecraft.client.gui.GuiGraphics;
13+
import net.minecraft.client.gui.components.Button;
14+
import net.minecraft.client.gui.components.Renderable;
15+
import net.minecraft.client.gui.screens.Screen;
16+
import net.minecraft.client.input.KeyEvent;
17+
import net.minecraft.client.input.MouseButtonEvent;
18+
import net.minecraft.network.chat.Component;
19+
20+
public final class AltLoginSuccessScreen extends Screen
21+
{
22+
private static final int GREEN = 0xFF55FF55;
23+
24+
private final Screen nextScreen;
25+
private final String playerName;
26+
27+
public AltLoginSuccessScreen(Screen nextScreen, String playerName)
28+
{
29+
super(Component.literal("Login successful"));
30+
this.nextScreen = nextScreen;
31+
this.playerName =
32+
playerName == null || playerName.isBlank() ? "Player" : playerName;
33+
}
34+
35+
@Override
36+
protected void init()
37+
{
38+
addRenderableWidget(Button
39+
.builder(Component.literal("Continue"),
40+
b -> minecraft.setScreen(nextScreen))
41+
.bounds(width / 2 - 100, height / 2 + 48, 200, 20).build());
42+
}
43+
44+
@Override
45+
public void render(GuiGraphics context, int mouseX, int mouseY,
46+
float partialTicks)
47+
{
48+
context.drawCenteredString(font, "Login successful", width / 2,
49+
height / 2 - 34, GREEN);
50+
context.drawCenteredString(font, playerName, width / 2, height / 2 - 20,
51+
GREEN);
52+
53+
for(Renderable drawable : renderables)
54+
drawable.render(context, mouseX, mouseY, partialTicks);
55+
}
56+
57+
@Override
58+
public boolean keyPressed(KeyEvent context)
59+
{
60+
if(context.key() == GLFW.GLFW_KEY_ENTER
61+
|| context.key() == GLFW.GLFW_KEY_ESCAPE)
62+
{
63+
onClose();
64+
return true;
65+
}
66+
67+
return super.keyPressed(context);
68+
}
69+
70+
@Override
71+
public boolean mouseClicked(MouseButtonEvent context, boolean doubleClick)
72+
{
73+
if(context.button() == GLFW.GLFW_MOUSE_BUTTON_4)
74+
{
75+
onClose();
76+
return true;
77+
}
78+
79+
return super.mouseClicked(context, doubleClick);
80+
}
81+
82+
@Override
83+
public void onClose()
84+
{
85+
minecraft.setScreen(nextScreen);
86+
}
87+
88+
@Override
89+
public boolean isPauseScreen()
90+
{
91+
return false;
92+
}
93+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* Copyright (c) 2014-2026 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.altmanager.screens;
9+
10+
import org.lwjgl.glfw.GLFW;
11+
12+
import net.minecraft.client.gui.GuiGraphics;
13+
import net.minecraft.client.gui.components.Button;
14+
import net.minecraft.client.gui.components.Renderable;
15+
import net.minecraft.client.gui.screens.Screen;
16+
import net.minecraft.client.input.KeyEvent;
17+
import net.minecraft.client.input.MouseButtonEvent;
18+
import net.minecraft.network.chat.Component;
19+
20+
public final class AltLogoutResultScreen extends Screen
21+
{
22+
private static final int GREEN = 0xFF55FF55;
23+
private static final int RED = 0xFFFF5555;
24+
25+
private final Screen nextScreen;
26+
private final boolean restored;
27+
private final String accountName;
28+
29+
public AltLogoutResultScreen(Screen nextScreen, boolean restored,
30+
String accountName)
31+
{
32+
super(Component.literal("Logout"));
33+
this.nextScreen = nextScreen;
34+
this.restored = restored;
35+
this.accountName = accountName == null || accountName.isBlank()
36+
? "Unknown" : accountName;
37+
}
38+
39+
@Override
40+
protected void init()
41+
{
42+
addRenderableWidget(Button
43+
.builder(Component.literal("Continue"),
44+
b -> minecraft.setScreen(nextScreen))
45+
.bounds(width / 2 - 100, height / 2 + 48, 200, 20).build());
46+
}
47+
48+
@Override
49+
public void render(GuiGraphics context, int mouseX, int mouseY,
50+
float partialTicks)
51+
{
52+
if(restored)
53+
{
54+
context.drawCenteredString(font, "Logged out of alt session",
55+
width / 2, height / 2 - 34, GREEN);
56+
context.drawCenteredString(font, "Current account: " + accountName,
57+
width / 2, height / 2 - 20, GREEN);
58+
}else
59+
{
60+
context.drawCenteredString(font, "Logout verification failed",
61+
width / 2, height / 2 - 34, RED);
62+
context.drawCenteredString(font, "Current account: " + accountName,
63+
width / 2, height / 2 - 20, RED);
64+
}
65+
66+
for(Renderable drawable : renderables)
67+
drawable.render(context, mouseX, mouseY, partialTicks);
68+
}
69+
70+
@Override
71+
public boolean keyPressed(KeyEvent context)
72+
{
73+
if(context.key() == GLFW.GLFW_KEY_ENTER
74+
|| context.key() == GLFW.GLFW_KEY_ESCAPE)
75+
{
76+
onClose();
77+
return true;
78+
}
79+
80+
return super.keyPressed(context);
81+
}
82+
83+
@Override
84+
public boolean mouseClicked(MouseButtonEvent context, boolean doubleClick)
85+
{
86+
if(context.button() == GLFW.GLFW_MOUSE_BUTTON_4)
87+
{
88+
onClose();
89+
return true;
90+
}
91+
92+
return super.mouseClicked(context, doubleClick);
93+
}
94+
95+
@Override
96+
public void onClose()
97+
{
98+
minecraft.setScreen(nextScreen);
99+
}
100+
101+
@Override
102+
public boolean isPauseScreen()
103+
{
104+
return false;
105+
}
106+
}

0 commit comments

Comments
 (0)