| 32 | import net.minecraft.client.util.math.MatrixStack; |
| 33 | |
| 34 | public class Alt { |
| 35 | |
| 36 | private YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) new YggdrasilAuthenticationService(((MinecraftClientAccessor) MinecraftClient.getInstance()).getProxy(), "").createUserAuthentication(Agent.MINECRAFT); |
| 37 | private String email, password, username; |
| 38 | private int x, y, id; |
| 39 | private boolean selected; |
| 40 | private UUID uuid; |
| 41 | |
| 42 | public Alt(String username, String password, int id) { |
| 43 | this.email = username; |
| 44 | this.password = password; |
| 45 | this.id = id; |
| 46 | } |
| 47 | |
| 48 | public void login() throws AuthenticationException { |
| 49 | auth.setUsername(email); |
| 50 | auth.setPassword(password); |
| 51 | auth.logIn(); |
| 52 | this.username = auth.getSelectedProfile().getName(); |
| 53 | this.uuid = auth.getSelectedProfile().getId(); |
| 54 | setSession(new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(), auth.getAuthenticatedToken(), Optional.empty(), Optional.empty(), AccountType.MOJANG)); |
| 55 | setUsername(auth.getSelectedProfile().getName()); |
| 56 | } |
| 57 | |
| 58 | protected void setSession(Session session) { |
| 59 | ((MinecraftClientAccessor) MinecraftClient.getInstance()).setSession(session); |
| 60 | MinecraftClient.getInstance().getSessionProperties().clear(); |
| 61 | } |
| 62 | |
| 63 | public void drawFace(MatrixStack matrices, int x, int y) { |
| 64 | RenderUtils.drawFace(matrices, x, y, 4, RenderUtils.getPlayerSkin(uuid)); |
| 65 | } |
| 66 | |
| 67 | public boolean hoveredAlt(double mouseX, double mouseY) { |
| 68 | return mouseX >= x && mouseX <= x + 230 && mouseY >= y && mouseY <= y + 30; |
| 69 | } |
| 70 | |
| 71 | public int getX() { |
| 72 | return x; |
| 73 | } |
| 74 | |
| 75 | public int getY() { |
| 76 | return y; |
| 77 | } |
| 78 | |
| 79 | public void setX(int x) { |
| 80 | this.x = x; |
| 81 | } |
| 82 | |
| 83 | public void setY(int y) { |
| 84 | this.y = y; |
| 85 | } |
| 86 | |
| 87 | public YggdrasilUserAuthentication getAuth() { |
| 88 | return auth; |
| 89 | } |
| 90 | |
| 91 | public String getEmail() { |
nothing calls this directly
no test coverage detected