use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class JexTitleScreen method initWidgetsNormal.
private void initWidgetsNormal(int y) {
JexTitleScreen titleScreen = this;
this.addDrawableChild(new ButtonWidget(2, y, 200, 20, new TranslatableText("menu.singleplayer"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new SelectWorldScreen(titleScreen));
}));
this.addDrawableChild(new ButtonWidget(2, y + 24, 175, 20, new TranslatableText("menu.multiplayer"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new MultiplayerScreen(titleScreen));
}));
this.addDrawableChild(new ButtonWidget(2, y + 24 * 2, 150, 20, new TranslatableText("menu.online"), button -> {
titleScreen.switchToRealms();
}));
this.addDrawableChild(new ButtonWidget(2, y + 24 * 3, 125, 20, new TranslatableText("menu.options"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new OptionsScreen(titleScreen, Wrapper.INSTANCE.getOptions()));
}));
this.addDrawableChild(new ButtonWidget(2, y + 24 * 4, 100, 20, new TranslatableText("menu.quit"), button -> {
Wrapper.INSTANCE.getMinecraft().scheduleStop();
}));
this.addDrawableChild(new ButtonWidget(2, height - 22, 100, 20, new TranslatableText("Changelog"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new ChangelogScreen());
}));
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class ProxyScreen method init.
@Override
protected void init() {
this.addDrawableChild(proxyTypeButton = new ButtonWidget(width / 2 - 100, height / 2 - 60, 200, 20, new LiteralText("Proxy: SOCKS5"), button -> {
this.socks5 = !this.socks5;
proxyTypeButton.setMessage(new LiteralText("Proxy: " + (socks5 ? "SOCKS5" : "SOCKS4")));
}));
String currentProxyString = "";
if (ProxyHelper.INSTANCE.isConnectedToProxy()) {
ProxyHelper.ClientProxy proxy = ProxyHelper.INSTANCE.getProxy();
currentProxyString = proxy.host() + ":" + proxy.port();
}
this.addSelectableChild(proxyField = new TextFieldWidget(Wrapper.INSTANCE.getTextRenderer(), width / 2 - 100, height / 2 - 25, 200, 20, new LiteralText(currentProxyString)));
this.addDrawableChild(connectButton = new ButtonWidget(width / 2 - 100, height / 2, 200, 20, new LiteralText("Connect to Proxy"), button -> {
HostAndPort hostAndPort = HostAndPort.fromString(proxyField.getText());
ProxyHelper.INSTANCE.connectToProxy(this.socks5 ? ProxyHelper.SocksType.FIVE : ProxyHelper.SocksType.FOUR, hostAndPort.getHost(), hostAndPort.getPort());
Wrapper.INSTANCE.getMinecraft().setScreen(new MultiplayerScreen(new TitleScreen()));
}));
this.addDrawableChild(disconnectButton = new ButtonWidget(width / 2 - 100, height / 2 + 25, 200, 20, new LiteralText("Disconnect from Proxy"), button -> {
ProxyHelper.INSTANCE.disconnectFromProxy();
}));
this.addDrawableChild(new ButtonWidget(width / 2 - 100, height / 2 + 50, 200, 20, new LiteralText("Close"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new MultiplayerScreen(new TitleScreen()));
}));
super.init();
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class TheAlteningScreen method init.
@Override
protected void init() {
apiKeyWidget = new TextFieldWidget(Wrapper.INSTANCE.getTextRenderer(), width / 2 - 150, 12, 200, 20, new LiteralText(""));
tokenWidget = new TextFieldWidget(Wrapper.INSTANCE.getTextRenderer(), width / 2 - 150, 365, 200, 20, new LiteralText(""));
if (!TheAlteningHelper.INSTANCE.getApiKey().isEmpty()) {
apiKeyWidget.setText(TheAlteningHelper.INSTANCE.getApiKey().substring(0, 4) + "****-****-****");
updateAPIKey();
}
setApiKeyButton = new ButtonWidget(width / 2 + 52, 12, 98, 20, new LiteralText("Set API Key"), button -> {
TheAlteningHelper.INSTANCE.setApiKey(this.apiKeyWidget.getText());
apiKeyWidget.setText(TheAlteningHelper.INSTANCE.getApiKey().substring(0, 4) + "****-****-****");
updateAPIKey();
ConfigManager.INSTANCE.get(ClientSettingsFile.class).write();
});
loginButton = new ButtonWidget(width / 2 - 152, 330, 150, 20, new LiteralText("Login to Selected"), button -> {
if (getSelected() != null) {
TheAlteningHelper.INSTANCE.login(getSelected().getAccount(), session -> {
if (session != null) {
JexClient.INSTANCE.getLogger().info("Logged in to TheAltening account named " + session.getUsername());
Wrapper.INSTANCE.getIMinecraft().setSession(session);
logInStatus = "Logged in to TheAltening account named \247b" + session.getUsername();
} else {
logInStatus = "Unable to login";
}
});
}
});
loginGeneratedButton = new ButtonWidget(width / 2 + 2, 330, 150, 20, new LiteralText("Login to Generated"), button -> {
if (generatedAccount != null) {
TheAlteningHelper.INSTANCE.login(generatedAccount, session -> {
if (session != null) {
JexClient.INSTANCE.getLogger().info("Logged in to TheAltening account named " + session.getUsername());
Wrapper.INSTANCE.getIMinecraft().setSession(session);
logInStatus = "Logged in to TheAltening account named \247b" + session.getUsername();
} else {
logInStatus = "Unable to login";
}
});
}
});
loginTokenButton = new ButtonWidget(width / 2 + 52, 365, 100, 20, new LiteralText("Login With Token"), button -> {
TheAlteningHelper.INSTANCE.login(this.tokenWidget.getText(), session -> {
if (session != null) {
JexClient.INSTANCE.getLogger().info("Logged in to TheAltening account named " + session.getUsername());
Wrapper.INSTANCE.getIMinecraft().setSession(session);
tokenStatus = "Logged in to TheAltening account named \247b" + session.getUsername();
} else {
tokenStatus = Formatting.RED + "Invalid Token";
}
this.tokenWidget.setText("");
});
});
generateButton = new ButtonWidget(width / 2 - 152, 305, 150, 20, new LiteralText("Generate"), button -> generatedAccount = TheAlteningHelper.INSTANCE.generateAccount());
favoriteGeneratedButton = new ButtonWidget(width / 2 + 2, 305, 75, 20, new LiteralText("Favorite"), button -> {
if (generatedAccount != null) {
if (TheAlteningHelper.INSTANCE.favoriteAcc(generatedAccount)) {
this.favoriteAccounts.add(generatedAccount);
String s = "\247b" + generatedAccount.username + " \247rfavorited.";
this.updateAPIKey();
this.logInStatus = s;
generatedAccount = null;
}
}
});
privateGeneratedButton = new ButtonWidget(width / 2 + 77, 305, 75, 20, new LiteralText("Private"), button -> {
if (generatedAccount != null) {
if (TheAlteningHelper.INSTANCE.privateAcc(generatedAccount)) {
this.privateAccounts.add(generatedAccount);
String s = "\247b" + generatedAccount.username + " \247rprivated.";
this.updateAPIKey();
this.logInStatus = s;
generatedAccount = null;
}
}
});
getTokenButton = new ButtonWidget(width - 127, 2, 125, 20, new LiteralText("Get Free Token"), button -> {
WebHelper.INSTANCE.openLink("https://thealtening.com/free/free-minecraft-alts");
});
signUpButton = new ButtonWidget(width - 127, 25, 125, 20, new LiteralText("Sign Up For TheAltening"), button -> {
WebHelper.INSTANCE.openLink("https://thealtening.com/?i=wohc9");
});
ButtonWidget cancelButton = new ButtonWidget(width / 2 - 100, height - 22, 200, 20, new LiteralText("Cancel"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(parent);
});
if (TheAlteningHelper.INSTANCE.isConnectedToAltening())
logInStatus = "Logged in to TheAltening account named \247b" + Wrapper.INSTANCE.getMinecraft().getSession().getUsername();
this.addSelectableChild(apiKeyWidget);
this.addSelectableChild(tokenWidget);
this.addDrawableChild(setApiKeyButton);
this.addDrawableChild(generateButton);
this.addDrawableChild(loginButton);
this.addDrawableChild(loginGeneratedButton);
this.addDrawableChild(loginTokenButton);
this.addDrawableChild(getTokenButton);
this.addDrawableChild(signUpButton);
this.addDrawableChild(favoriteGeneratedButton);
this.addDrawableChild(privateGeneratedButton);
this.addDrawableChild(cancelButton);
super.init();
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class XraySelectScreen method init.
@Override
protected void init() {
float allowedLeftX = Render2DHelper.INSTANCE.getScaledWidth() / 2 - 200;
float notAllowedLeftX = Render2DHelper.INSTANCE.getScaledWidth() / 2 + 2;
float startY = Render2DHelper.INSTANCE.getScaledHeight() / 2 - 125;
float buttonWidth = 198;
loadBlocks();
searchField = new TextFieldWidget(Wrapper.INSTANCE.getTextRenderer(), (int) allowedLeftX, (int) startY - 25, 350, 20, new LiteralText(""));
searchField.setVisible(true);
searchField.setEditable(true);
searchButton = new ButtonWidget(Render2DHelper.INSTANCE.getScaledWidth() / 2 + 155, (int) startY - 25, 45, 20, new LiteralText("Search"), button -> {
if (searchField.getText().isEmpty())
loadBlocks();
else
loadBlocks(searchField.getText());
});
removeXrayButton = new ButtonWidget((int) allowedLeftX, (int) startY + 255, (int) buttonWidth, 20, new LiteralText("Remove From Xray"), button -> {
getSelectedAllowed().forEach(blockButton -> {
Xray.blockList.remove(blockButton.getBlock());
allowedBlocks.remove(blockButton);
notAllowedBlocks.add(blockButton);
});
if (searchField.getText().isEmpty())
loadBlocks();
else
loadBlocks(searchField.getText());
ConfigManager.INSTANCE.get(XrayFile.class).write();
if (Wrapper.INSTANCE.getMinecraft().worldRenderer != null && Feature.get(Xray.class).getState())
Wrapper.INSTANCE.getMinecraft().worldRenderer.reload();
});
addXrayButton = new ButtonWidget((int) notAllowedLeftX, (int) startY + 255, (int) buttonWidth, 20, new LiteralText("Add To Xray"), button -> {
getSelectedNotAllowed().forEach(blockButton -> {
Xray.blockList.add(blockButton.getBlock());
allowedBlocks.add(blockButton);
notAllowedBlocks.remove(blockButton);
});
if (searchField.getText().isEmpty())
loadBlocks();
else
loadBlocks(searchField.getText());
ConfigManager.INSTANCE.get(XrayFile.class).write();
if (Wrapper.INSTANCE.getMinecraft().worldRenderer != null && Feature.get(Xray.class).getState())
Wrapper.INSTANCE.getMinecraft().worldRenderer.reload();
});
doneButton = new ButtonWidget((int) (Render2DHelper.INSTANCE.getScaledWidth() / 2 - 100), height - 22, 200, 20, new LiteralText("Done"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new JexOptionsScreen());
});
this.addSelectableChild(searchField);
this.addDrawableChild(searchButton);
this.addDrawableChild(addXrayButton);
this.addDrawableChild(removeXrayButton);
this.addDrawableChild(doneButton);
super.init();
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class JexPersonalizationScreen method init.
@Override
protected void init() {
float midX = width / 2.f;
setCapeButton = new ButtonWidget((int) midX - 255 + 2, 215, 250, 20, new LiteralText("Set Cape"), button -> {
if (fileBrowser.getSelectedFiles().isEmpty() || fileBrowser.getSelectedFiles().get(0).isDirectory())
return;
File cape = fileBrowser.getSelectedFiles().get(0);
setCape = cape.getPath();
Cape.setPersonalCape(cape);
ConfigManager.INSTANCE.get(ClientSettingsFile.class).write();
});
prevHatButton = new ButtonWidget((int) midX + 8, 137, 40, 20, new LiteralText("<"), button -> {
selectedHat--;
if (selectedHat < -1)
selectedHat = Hat.HatType.values().length - 1;
});
nextHatButton = new ButtonWidget((int) midX + 88, 137, 40, 20, new LiteralText(">"), button -> {
selectedHat++;
if (selectedHat > Hat.HatType.values().length - 1)
selectedHat = -1;
});
setHatButton = new ButtonWidget((int) midX + 8, 170, 120, 20, new LiteralText("Set Hat"), button -> {
String uuid = Wrapper.INSTANCE.getMinecraft().getSession().getUuid().replace("-", "");
if (selectedHat == -1) {
Hat.clearHat(uuid);
} else {
Hat.HatType hatType = Hat.HatType.values()[selectedHat];
Hat.setHat(uuid, hatType.name());
setHat = hatType.name();
}
ConfigManager.INSTANCE.get(ClientSettingsFile.class).write();
});
fileBrowser = new FileBrowser(LAST_PATH, midX - 255 + 2, 15, 250, 200, doubleClickListener, ".png", ".jpg");
fileBrowser.setMultiSelect(false);
this.addDrawableChild(setCapeButton);
this.addDrawableChild(prevHatButton);
this.addDrawableChild(nextHatButton);
this.addDrawableChild(setHatButton);
super.init();
}
Aggregations