Search in sources :

Example 16 with ButtonWidget

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);
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) TextFieldWidget(net.minecraft.client.gui.widget.TextFieldWidget) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget)

Example 17 with ButtonWidget

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());
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) ConfigListWidget(org.moon.moonfix.config.widgets.ConfigListWidget) Screen(net.minecraft.client.gui.screen.Screen) InputUtil(net.minecraft.client.util.InputUtil) MatrixStack(net.minecraft.client.util.math.MatrixStack) TranslatableText(net.minecraft.text.TranslatableText) Config(org.moon.moonfix.config.ConfigManager.Config) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) KeyBinding(net.minecraft.client.option.KeyBinding) ConfigListWidget(org.moon.moonfix.config.widgets.ConfigListWidget) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget)

Example 18 with ButtonWidget

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)));
}
Also used : PuzzleOptionListWidget(net.puzzlemc.gui.screen.widget.PuzzleOptionListWidget) Objects(java.util.Objects) List(java.util.List) Screen(net.minecraft.client.gui.screen.Screen) ScreenTexts(net.minecraft.client.gui.screen.ScreenTexts) MatrixStack(net.minecraft.client.util.math.MatrixStack) TranslatableText(net.minecraft.text.TranslatableText) PuzzleWidget(net.puzzlemc.gui.screen.widget.PuzzleWidget) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) PuzzleOptionListWidget(net.puzzlemc.gui.screen.widget.PuzzleOptionListWidget) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget)

Example 19 with ButtonWidget

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();
}
Also used : Wrapper(me.dustin.jex.helper.misc.Wrapper) Render2DHelper(me.dustin.jex.helper.render.Render2DHelper) LiteralText(net.minecraft.text.LiteralText) MatrixStack(net.minecraft.client.util.math.MatrixStack) FontHelper(me.dustin.jex.helper.render.font.FontHelper) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) GuiPasswordField(me.dustin.jex.gui.account.impl.GuiPasswordField) UUID(java.util.UUID) AltFile(me.dustin.jex.file.impl.AltFile) Screen(net.minecraft.client.gui.screen.Screen) TextFieldWidget(net.minecraft.client.gui.widget.TextFieldWidget) ConfigManager(me.dustin.jex.file.core.ConfigManager) MinecraftAccount(me.dustin.jex.gui.account.account.MinecraftAccount) MinecraftAccountManager(me.dustin.jex.helper.network.login.minecraft.MinecraftAccountManager) MinecraftAccount(me.dustin.jex.gui.account.account.MinecraftAccount) TextFieldWidget(net.minecraft.client.gui.widget.TextFieldWidget) GuiPasswordField(me.dustin.jex.gui.account.impl.GuiPasswordField) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) LiteralText(net.minecraft.text.LiteralText)

Example 20 with ButtonWidget

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();
}
Also used : Wrapper(me.dustin.jex.helper.misc.Wrapper) Render2DHelper(me.dustin.jex.helper.render.Render2DHelper) LiteralText(net.minecraft.text.LiteralText) MouseHelper(me.dustin.jex.helper.misc.MouseHelper) Scrollbar(me.dustin.jex.helper.render.Scrollbar) MatrixStack(net.minecraft.client.util.math.MatrixStack) FontHelper(me.dustin.jex.helper.render.font.FontHelper) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) ArrayList(java.util.ArrayList) TitleScreen(net.minecraft.client.gui.screen.TitleScreen) Screen(net.minecraft.client.gui.screen.Screen) JexChangelog(me.dustin.jex.gui.changelog.changelog.JexChangelog) AccountButton(me.dustin.jex.gui.account.impl.AccountButton) ColorHelper(me.dustin.jex.helper.math.ColorHelper) Text(net.minecraft.text.Text) JexClient(me.dustin.jex.JexClient) Scissor(me.dustin.jex.helper.render.Scissor) JexChangelog(me.dustin.jex.gui.changelog.changelog.JexChangelog) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) Scrollbar(me.dustin.jex.helper.render.Scrollbar) LiteralText(net.minecraft.text.LiteralText) TitleScreen(net.minecraft.client.gui.screen.TitleScreen)

Aggregations

ButtonWidget (net.minecraft.client.gui.widget.ButtonWidget)116 Screen (net.minecraft.client.gui.screen.Screen)86 MatrixStack (net.minecraft.client.util.math.MatrixStack)72 LiteralText (net.minecraft.text.LiteralText)69 TranslatableText (net.minecraft.text.TranslatableText)56 MinecraftClient (net.minecraft.client.MinecraftClient)44 TextFieldWidget (net.minecraft.client.gui.widget.TextFieldWidget)43 Text (net.minecraft.text.Text)32 GLFW (org.lwjgl.glfw.GLFW)27 Inject (org.spongepowered.asm.mixin.injection.Inject)25 EnvType (net.fabricmc.api.EnvType)21 Environment (net.fabricmc.api.Environment)21 ScreenTexts (net.minecraft.client.gui.screen.ScreenTexts)21 ConfirmScreen (net.minecraft.client.gui.screen.ConfirmScreen)20 Mixin (org.spongepowered.asm.mixin.Mixin)19 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)18 ArrayList (java.util.ArrayList)18 List (java.util.List)18 At (org.spongepowered.asm.mixin.injection.At)18 CallbackInfo (org.spongepowered.asm.mixin.injection.callback.CallbackInfo)18