use of net.minecraft.client.gui.widget.ButtonWidget in project Biome-Makeover by Lemonszz.
the class DirectionalDataScreen method init.
@Override
protected void init() {
this.client.keyboard.setRepeatEvents(true);
this.buttonDone = this.addButton(new ButtonWidget(this.width / 2 - 4 - 150, 210, 150, 20, ScreenTexts.DONE, (buttonWidget) -> {
this.done();
}));
this.buttonCancel = this.addButton(new ButtonWidget(this.width / 2 + 4, 210, 150, 20, ScreenTexts.CANCEL, (buttonWidget) -> {
this.cancel();
}));
this.inputMetadata = new TextFieldWidget(this.textRenderer, this.width / 2 - 152, 120, 308, 20, new TranslatableText("structure_block.custom_data"));
this.inputMetadata.setMaxLength(128);
this.inputMetadata.setText(initialMeta);
this.children.add(this.inputMetadata);
}
use of net.minecraft.client.gui.widget.ButtonWidget in project Moonfix by Kingdom-of-Moon.
the class ConfigScreen method init.
@Override
protected void init() {
super.init();
this.addDrawableChild(new ButtonWidget(this.width / 2 - 154, this.height - 29, 150, 20, new TranslatableText("gui.cancel"), (buttonWidgetx) -> {
ConfigManager.discardConfig();
this.client.setScreen(parentScreen);
}));
this.addDrawableChild(new ButtonWidget(this.width / 2 + 4, this.height - 29, 150, 20, new TranslatableText("gui.done"), (buttonWidgetx) -> {
ConfigManager.applyConfig();
ConfigManager.saveConfig();
this.client.setScreen(parentScreen);
}));
this.configListWidget = new ConfigListWidget(this, this.client);
this.addSelectableChild(this.configListWidget);
// generate configs...
configListWidget.addEntries(Config.values());
}
use of net.minecraft.client.gui.widget.ButtonWidget in project Puzzle by PuzzleMC.
the class AbstractPuzzleOptionsPage method init.
@Override
protected void init() {
this.list = new PuzzleOptionListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
list.addAll(options);
this.addSelectableChild(this.list);
super.init();
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height - 28, 200, 20, ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)));
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class AddAccountScreen method init.
@Override
public void init() {
Wrapper.INSTANCE.getMinecraft().keyboard.setRepeatEvents(true);
username = new TextFieldWidget(Wrapper.INSTANCE.getTextRenderer(), (Render2DHelper.INSTANCE.getScaledWidth() / 2) - 100, 12, 200, 20, new LiteralText("Username"));
email = new TextFieldWidget(Wrapper.INSTANCE.getTextRenderer(), (Render2DHelper.INSTANCE.getScaledWidth() / 2) - 100, 47, 200, 20, new LiteralText("Email"));
password = new GuiPasswordField(Wrapper.INSTANCE.getTextRenderer(), (Render2DHelper.INSTANCE.getScaledWidth() / 2) - 100, 82, 200, 20, new LiteralText("Password"));
username.setTextFieldFocused(true);
username.setMaxLength(16);
this.email.setMaxLength(100);
this.password.setMaxLength(250);
if (editingAccount != null) {
username.setText(editingAccount.getUsername());
email.setText(editingAccount.getEmail());
password.setText(editingAccount.getPassword());
}
this.children().clear();
username.setFocusUnlocked(true);
email.setFocusUnlocked(true);
this.addSelectableChild(username);
this.addSelectableChild(email);
this.addSelectableChild(password);
this.addDrawableChild(new ButtonWidget((Render2DHelper.INSTANCE.getScaledWidth() / 2) - 60, Render2DHelper.INSTANCE.getScaledHeight() - 54, 120, 20, new LiteralText("Cancel"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(parent);
}));
this.addDrawableChild(new ButtonWidget((Render2DHelper.INSTANCE.getScaledWidth() / 2) - 60, Render2DHelper.INSTANCE.getScaledHeight() - 75, 120, 20, editingAccount == null ? new LiteralText("Add") : new LiteralText("Save"), button -> {
if (isMicrosoft) {
MinecraftAccount.MicrosoftAccount microsoftAccount = new MinecraftAccount.MicrosoftAccount(username.getText(), email.getText(), password.getText(), "", "", UUID.randomUUID().toString());
MinecraftAccountManager.INSTANCE.getAccounts().add(microsoftAccount);
} else {
MinecraftAccount.MojangAccount account;
if (email.getText().equalsIgnoreCase("") || password.getText().equalsIgnoreCase("")) {
account = new MinecraftAccount.MojangAccount(username.getText());
} else {
account = new MinecraftAccount.MojangAccount(username.getText(), email.getText(), password.getText());
}
if (editingAccount != null) {
editingAccount.setUsername(account.getUsername());
editingAccount.setEmail(account.getEmail());
editingAccount.setPassword(account.getPassword());
} else
MinecraftAccountManager.INSTANCE.getAccounts().add(account);
}
ConfigManager.INSTANCE.get(AltFile.class).write();
Wrapper.INSTANCE.getMinecraft().setScreen(parent);
}));
if (editingAccount == null)
this.addDrawableChild(new ButtonWidget((Render2DHelper.INSTANCE.getScaledWidth() / 2) - 60, Render2DHelper.INSTANCE.getScaledHeight() - 105, 120, 20, new LiteralText("\2476Mojang Account"), button -> {
isMicrosoft = !isMicrosoft;
button.setMessage(new LiteralText(isMicrosoft ? "\247aMicrosoft Account" : "\2476Mojang Account"));
}));
super.init();
}
use of net.minecraft.client.gui.widget.ButtonWidget in project JexClient by DustinRepo.
the class ChangelogScreen method init.
@Override
protected void init() {
int height = 10;
for (JexChangelog changelog : changelogs) {
changelog.setY(height);
height += changelog.getContentHeight() + 5;
}
scrollbar = new Scrollbar(Render2DHelper.INSTANCE.getScaledWidth() - 15, 10, 9, 0, Render2DHelper.INSTANCE.getScaledHeight() - 45, height - 15, 0xff696969);
this.addDrawableChild(new ButtonWidget(width / 2 - 40, this.height - 22, 80, 20, new LiteralText("Back"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new TitleScreen());
}));
super.init();
}
Aggregations