net.minecraft.client.gui.widget.ButtonWidget Java Examples

The following examples show how to use net.minecraft.client.gui.widget.ButtonWidget. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatsScreenMixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Inject(at = {@At("TAIL")}, method = {"createButtons()V"})
private void onCreateButtons(CallbackInfo ci)
{
	ButtonWidget toggleWurstButton = new ButtonWidget(width / 2 - 152,
		height - 28, 150, 20, new LiteralText(""), this::toggleWurst);
	
	updateWurstButtonText(toggleWurstButton);
	addButton(toggleWurstButton);
	
	for(AbstractButtonWidget button : buttons)
	{
		if(!button.getMessage().getString()
			.equals(I18n.translate("gui.done")))
			continue;
		
		button.x = width / 2 + 2;
		button.setWidth(150);
	}
}
 
Example #2
Source File: TitleScreenMixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Inject(at = {@At("RETURN")}, method = {"initWidgetsNormal(II)V"})
private void onInitWidgetsNormal(int y, int spacingY, CallbackInfo ci)
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	addButton(new ButtonWidget(width / 2 + 2, y + spacingY * 2, 98, 20,
		new LiteralText("Alt Manager"),
		b -> client.openScreen(new AltManagerScreen(this,
			WurstClient.INSTANCE.getAltManager()))));
	
	for(AbstractButtonWidget button : buttons)
	{
		if(!button.getMessage().getString()
			.equals(I18n.translate("menu.online")))
			continue;
		
		button.setWidth(98);
	}
}
 
Example #3
Source File: KeybindProfilesScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	listGui = new ListGui(client, this,
		WurstClient.INSTANCE.getKeybinds().listProfiles());
	
	addButton(new ButtonWidget(8, 8, 100, 20,
		new LiteralText("Open Folder"), b -> openFolder()));
	
	addButton(new ButtonWidget(width / 2 - 154, height - 48, 100, 20,
		new LiteralText("New Profile"), b -> client.openScreen(
			new EnterProfileNameScreen(this, this::newProfile))));
	
	loadButton = addButton(new ButtonWidget(width / 2 - 50, height - 48,
		100, 20, new LiteralText("Load"), b -> loadSelected()));
	
	addButton(new ButtonWidget(width / 2 + 54, height - 48, 100, 20,
		new LiteralText("Cancel"), b -> openPrevScreen()));
}
 
Example #4
Source File: EnterProfileNameScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	
	valueField =
		new TextFieldWidget(tr, x1, y1, 200, 20, new LiteralText(""));
	valueField.setText("");
	valueField.setSelectionStart(0);
	
	children.add(valueField);
	setInitialFocus(valueField);
	valueField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example #5
Source File: KeybindEditorScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	addButton(new ButtonWidget(width / 2 - 100, 60, 200, 20,
		new LiteralText("Change Key"),
		b -> client.openScreen(new PressAKeyScreen(this))));
	
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 72, 200, 20,
		new LiteralText("Save"), b -> save()));
	
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 96, 200, 20,
		new LiteralText("Cancel"), b -> client.openScreen(prevScreen)));
	
	commandField = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
		200, 20, new LiteralText(""));
	commandField.setMaxLength(65536);
	children.add(commandField);
	setInitialFocus(commandField);
	commandField.setSelected(true);
	
	if(oldCommands != null)
		commandField.setText(oldCommands);
}
 
Example #6
Source File: DisconnectedScreenMixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Inject(at = {@At("TAIL")}, method = {"init()V"})
private void onInit(CallbackInfo ci)
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	int backButtonX = width / 2 - 100;
	int backButtonY =
		Math.min(height / 2 + reasonHeight / 2 + 9, height - 30);
	
	addButton(new ButtonWidget(backButtonX, backButtonY + 24, 200, 20,
		new LiteralText("Reconnect"),
		b -> LastServerRememberer.reconnect(parent)));
	
	autoReconnectButton =
		addButton(new ButtonWidget(backButtonX, backButtonY + 48, 200, 20,
			new LiteralText("AutoReconnect"), b -> pressAutoReconnect()));
	
	if(WurstClient.INSTANCE.getHax().autoReconnectHack.isEnabled())
		autoReconnectTimer = 100;
}
 
Example #7
Source File: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	String valueString = setting.getBlockName();
	
	blockField =
		new TextFieldWidget(tr, x1, y1, 178, 18, new LiteralText(""));
	blockField.setText(valueString);
	blockField.setSelectionStart(0);
	
	children.add(blockField);
	setInitialFocus(blockField);
	blockField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example #8
Source File: ContainerScreen54Mixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void init()
{
	super.init();
	
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	if(autoSteal.areButtonsVisible())
	{
		addButton(new ButtonWidget(x + backgroundWidth - 108, y + 4, 50, 12,
			new LiteralText("Steal"), b -> steal()));
		
		addButton(new ButtonWidget(x + backgroundWidth - 56, y + 4, 50, 12,
			new LiteralText("Store"), b -> store()));
	}
	
	if(autoSteal.isEnabled())
		steal();
}
 
Example #9
Source File: EditSliderScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void init()
{
	int x1 = width / 2 - 100;
	int y1 = 60;
	int y2 = height / 3 * 2;
	
	TextRenderer tr = client.textRenderer;
	ValueDisplay vd = ValueDisplay.DECIMAL;
	String valueString = vd.getValueString(slider.getValue());
	
	valueField =
		new TextFieldWidget(tr, x1, y1, 200, 20, new LiteralText(""));
	valueField.setText(valueString);
	valueField.setSelectionStart(0);
	
	children.add(valueField);
	setInitialFocus(valueField);
	valueField.setSelected(true);
	
	doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
		b -> done());
	addButton(doneButton);
}
 
Example #10
Source File: MultiplayerScreenMixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Inject(at = {@At("TAIL")}, method = {"init()V"})
private void onInit(CallbackInfo ci)
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	lastServerButton = addButton(new ButtonWidget(width / 2 - 154, 10, 100,
		20, new LiteralText("Last Server"), b -> LastServerRememberer
			.joinLastServer((MultiplayerScreen)(Object)this)));
	
	addButton(new ButtonWidget(width / 2 + 154 + 4, height - 52, 100, 20,
		new LiteralText("Server Finder"), b -> client.openScreen(
			new ServerFinderScreen((MultiplayerScreen)(Object)this))));
	
	addButton(new ButtonWidget(width / 2 + 154 + 4, height - 28, 100, 20,
		new LiteralText("Clean Up"), b -> client.openScreen(
			new CleanUpScreen((MultiplayerScreen)(Object)this))));
}
 
Example #11
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void init() {
	super.init();
	reconnectTime = System.currentTimeMillis();
	addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 35, 200, 20, "Reconnect", (button) -> {
		if (server != null) minecraft.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), minecraft, server));
    }));
	addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 57, 200, 20,
			(getSettings().get(0).toToggle().state ? "§a" : "§c") + "AutoReconnect ["
					+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
					+ "]", (button) -> {
        getSettings().get(0).toToggle().state = !getSettings().get(0).toToggle().state;
        reconnectTime = System.currentTimeMillis();
    }));
}
 
Example #12
Source File: MixinServerScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
	addButton(new ButtonWidget(5, 7, 50, 18, "Scraper", button -> {
		minecraft.openScreen(new ServerScraperScreen((MultiplayerScreen) minecraft.currentScreen));
	}));
	addButton(new ButtonWidget(58, 7, 50, 18, "Cleanup", button -> {
		minecraft.openScreen(new CleanUpScreen((MultiplayerScreen) minecraft.currentScreen));
	}));
}
 
Example #13
Source File: MixinTitleScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
	if (BleachMainMenu.customTitleScreen) {
		MinecraftClient.getInstance().openScreen(new BleachMainMenu());
	} else {
		addButton(new ButtonWidget(width / 2 - 124, height / 4 + 96, 20, 20, "BH", button -> {
			BleachMainMenu.customTitleScreen = !BleachMainMenu.customTitleScreen;
			minecraft.openScreen(new TitleScreen(false));
		}));
	}
}
 
Example #14
Source File: MixinCreateWorldScreen.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Inject(at = @At("RETURN"), method = "method_19926")
private void onCustomizeButton(ButtonWidget widget, CallbackInfo info) {
	LevelGeneratorType generatorType = LevelGeneratorType.TYPES[this.generatorType];

	if (generatorType instanceof PatchworkLevelGeneratorType) {
		((IForgeWorldType) generatorType).onCustomizeButton(this.minecraft, (CreateWorldScreen) (Object) this);
	}
}
 
Example #15
Source File: SandboxTitleScreen.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initWidgetsNormal(int int_1, int int_2) {
    this.addButton(new ButtonWidget(this.width / 2 - 100, int_1, 200, 20, I18n.translate("menu.singleplayer"), (buttonWidget_1) -> {
        this.minecraft.openScreen(new SelectWorldScreen(this));
    }));
    this.addButton(new ButtonWidget(this.width / 2 - 100, int_1 + int_2, 200, 20, I18n.translate("menu.multiplayer"), (buttonWidget_1) -> {
        this.minecraft.openScreen(new MultiplayerScreen(this));
    }));
}
 
Example #16
Source File: SandboxTitleScreen.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void init() {
    if (this.splashText == null) {
        this.splashText = this.minecraft.getSplashTextLoader().get();
    }

    this.copyrightTextWidth = this.font.getStringWidth("Copyright Mojang AB. Do not distribute!");
    this.copyrightTextX = this.width - this.copyrightTextWidth - 2;
    int int_2 = this.height / 4 + 48;
    if (this.minecraft.isDemo()) {
        this.initWidgetsDemo(int_2, 24);
    } else {
        this.initWidgetsNormal(int_2, 24);
    }

    this.addButton(new TexturedButtonWidget(this.width / 2 - 124, int_2 + 72 + 12, 20, 20, 0, 106, 20, ButtonWidget.WIDGETS_LOCATION, 256, 256, (buttonWidget_1) -> {
        this.minecraft.openScreen(new LanguageOptionsScreen(this, this.minecraft.options, this.minecraft.getLanguageManager()));
    }, I18n.translate("narrator.button.language")));
    this.addButton(new ButtonWidget(this.width / 2 - 100, int_2 + 72 + 12, 98, 20, I18n.translate("menu.options"), (buttonWidget_1) -> {
        this.minecraft.openScreen(new SettingsScreen(this, this.minecraft.options));
    }));
    this.addButton(new ButtonWidget(this.width / 2 + 2, int_2 + 72 + 12, 98, 20, I18n.translate("menu.quit"), (buttonWidget_1) -> {
        this.minecraft.scheduleStop();
    }));
    this.addButton(new TexturedButtonWidget(this.width / 2 + 104, int_2 + 72 + 12, 20, 20, 0, 0, 20, ACCESSIBILITY_ICON_TEXTURE, 32, 64, (buttonWidget_1) -> {
        this.minecraft.openScreen(new AccessibilityScreen(this, this.minecraft.options));
    }, I18n.translate("narrator.button.accessibility")));
    if (this.warning != null) {
        this.warning.init(int_2);
    }

}
 
Example #17
Source File: AltManagerScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	listGui = new ListGui(client, this, altManager.getList());
	
	if(altManager.getList().isEmpty() && shouldAsk)
		client.openScreen(new ConfirmScreen(this::confirmGenerate,
			new LiteralText("Your alt list is empty."), new LiteralText(
				"Would you like some random alts to get started?")));
	
	addButton(useButton = new ButtonWidget(width / 2 - 154, height - 52,
		100, 20, new LiteralText("Use"), b -> pressUse()));
	
	addButton(new ButtonWidget(width / 2 - 50, height - 52, 100, 20,
		new LiteralText("Direct Login"),
		b -> client.openScreen(new DirectLoginScreen(this))));
	
	addButton(new ButtonWidget(width / 2 + 54, height - 52, 100, 20,
		new LiteralText("Add"),
		b -> client.openScreen(new AddAltScreen(this, altManager))));
	
	addButton(starButton = new ButtonWidget(width / 2 - 154, height - 28,
		75, 20, new LiteralText("Star"), b -> pressStar()));
	
	addButton(editButton = new ButtonWidget(width / 2 - 76, height - 28, 74,
		20, new LiteralText("Edit"), b -> pressEdit()));
	
	addButton(deleteButton = new ButtonWidget(width / 2 + 2, height - 28,
		74, 20, new LiteralText("Delete"), b -> pressDelete()));
	
	addButton(new ButtonWidget(width / 2 + 80, height - 28, 75, 20,
		new LiteralText("Cancel"), b -> client.openScreen(prevScreen)));
	
	addButton(new ButtonWidget(8, 8, 100, 20,
		new LiteralText("Import Alts"), b -> pressImportAlts()));
}
 
Example #18
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void init() {
	super.init();
	reconnectTime = System.currentTimeMillis();
	addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 35, 200, 20, new LiteralText("Reconnect"), (button) -> {
		if (server != null) client.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), client, server));
    }));
	addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 57, 200, 20,
			new LiteralText((getSettings().get(0).toToggle().state ? "\u00a7a" : "\u00a7c") + "AutoReconnect ["
					+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
					+ "]"), (button) -> {
        getSettings().get(0).toToggle().state = !getSettings().get(0).toToggle().state;
        reconnectTime = System.currentTimeMillis();
    }));
}
 
Example #19
Source File: MixinTitleScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
	if (BleachMainMenu.customTitleScreen) {
		MinecraftClient.getInstance().openScreen(new BleachMainMenu());
	} else {
		addButton(new ButtonWidget(width / 2 - 124, height / 4 + 96, 20, 20, new LiteralText("BH"), button -> {
			BleachMainMenu.customTitleScreen = !BleachMainMenu.customTitleScreen;
			client.openScreen(new TitleScreen(false));
		}));
	}
}
 
Example #20
Source File: MixinServerScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
	addButton(new ButtonWidget(5, 7, 50, 18, new LiteralText("Scraper"), button -> {
		client.openScreen(new ServerScraperScreen((MultiplayerScreen) client.currentScreen));
	}));
	addButton(new ButtonWidget(58, 7, 50, 18, new LiteralText("Cleanup"), button -> {
		client.openScreen(new CleanUpScreen((MultiplayerScreen) client.currentScreen));
	}));
	addButton(new ButtonWidget(111, 7, 50, 18, new LiteralText("Protocol"), button -> {
		client.openScreen(new ProtocolScreen((MultiplayerScreen) client.currentScreen));
	}));
}
 
Example #21
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void init() {
	super.init();
	reconnectTime = System.currentTimeMillis();
	addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 35, 200, 20, "Reconnect", (button) -> {
		if (server != null) minecraft.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), minecraft, server));
    }));
	addButton(new ButtonWidget(width / 2 - 100, height / 2 + reasonH / 2 + 57, 200, 20,
			(getSettings().get(0).toToggle().state ? "§a" : "§c") + "AutoReconnect ["
					+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
					+ "]", (button) -> {
        getSettings().get(0).toToggle().state = !getSettings().get(0).toToggle().state;
        reconnectTime = System.currentTimeMillis();
    }));
}
 
Example #22
Source File: MixinTitleScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
	if (BleachMainMenu.customTitleScreen) {
		MinecraftClient.getInstance().openScreen(new BleachMainMenu());
	} else {
		addButton(new ButtonWidget(width / 2 - 124, height / 4 + 96, 20, 20, "BH", button -> {
			BleachMainMenu.customTitleScreen = !BleachMainMenu.customTitleScreen;
			minecraft.openScreen(new TitleScreen(false));
		}));
	}
}
 
Example #23
Source File: MixinServerScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
	addButton(new ButtonWidget(5, 7, 50, 18, "Scraper", button -> {
		minecraft.openScreen(new ServerScraperScreen((MultiplayerScreen) minecraft.currentScreen));
	}));
	addButton(new ButtonWidget(58, 7, 50, 18, "Cleanup", button -> {
		minecraft.openScreen(new CleanUpScreen((MultiplayerScreen) minecraft.currentScreen));
	}));
	addButton(new ButtonWidget(111, 7, 50, 18, "Protocol", button -> {
		minecraft.openScreen(new ProtocolScreen((MultiplayerScreen) minecraft.currentScreen));
	}));
}
 
Example #24
Source File: NavigatorNewKeybindScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onResize()
{
	// OK button
	okButton = new ButtonWidget(width / 2 - 151, height - 65, 149, 18,
		new LiteralText("OK"), b -> {
			if(choosingKey)
			{
				String newCommands = selectedCommand.getCommand();
				
				String oldCommands = WurstClient.INSTANCE.getKeybinds()
					.getCommands(selectedKey);
				if(oldCommands != null)
					newCommands = oldCommands + " ; " + newCommands;
				
				WurstClient.INSTANCE.getKeybinds().add(selectedKey,
					newCommands);
				
				WurstClient.INSTANCE.getNavigator()
					.addPreference(parent.getFeature().getName());
				WurstClient.MC.openScreen(parent);
			}else
			{
				choosingKey = true;
				okButton.active = false;
			}
		});
	okButton.active = selectedCommand != null;
	addButton(okButton);
	
	// cancel button
	addButton(new ButtonWidget(width / 2 + 2, height - 65, 149, 18,
		new LiteralText("Cancel"), b -> WurstClient.MC.openScreen(parent)));
}
 
Example #25
Source File: KeybindManagerScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	listGui = new ListGui(client, width, height, 36, height - 56, 30);
	
	addButton(addButton = new ButtonWidget(width / 2 - 102, height - 52,
		100, 20, new LiteralText("Add"),
		b -> client.openScreen(new KeybindEditorScreen(this))));
	
	addButton(editButton = new ButtonWidget(width / 2 + 2, height - 52, 100,
		20, new LiteralText("Edit"), b -> edit()));
	
	addButton(removeButton = new ButtonWidget(width / 2 - 102, height - 28,
		100, 20, new LiteralText("Remove"), b -> remove()));
	
	addButton(backButton = new ButtonWidget(width / 2 + 2, height - 28, 100,
		20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
	
	addButton(
		new ButtonWidget(8, 8, 100, 20, new LiteralText("Reset Keybinds"),
			b -> client.openScreen(new ConfirmScreen(confirmed -> {
				if(confirmed)
					WurstClient.INSTANCE.getKeybinds()
						.setKeybinds(KeybindList.DEFAULT_KEYBINDS);
				client.openScreen(this);
			}, new LiteralText(
				"Are you sure you want to reset your keybinds?"),
				new LiteralText("This cannot be undone!")))));
	
	addButton(new ButtonWidget(width - 108, 8, 100, 20,
		new LiteralText("Profiles..."),
		b -> client.openScreen(new KeybindProfilesScreen(this))));
}
 
Example #26
Source File: WurstOptionsScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	addButton(new ButtonWidget(width / 2 - 100, height / 4 + 144 - 16, 200,
		20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
	
	addSettingButtons();
	addManagerButtons();
	addLinkButtons();
}
 
Example #27
Source File: EditBlockListScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	listGui = new ListGui(client, this, blockList.getBlockNames());
	
	blockNameField = new TextFieldWidget(client.textRenderer,
		width / 2 - 152, height - 55, 150, 18, new LiteralText(""));
	children.add(blockNameField);
	
	addButton(addButton = new ButtonWidget(width / 2 - 2, height - 56, 30,
		20, new LiteralText("Add"), b -> {
			blockList.add(blockToAdd);
			blockNameField.setText("");
		}));
	
	addButton(removeButton = new ButtonWidget(width / 2 + 52, height - 56,
		100, 20, new LiteralText("Remove Selected"),
		b -> blockList.remove(listGui.selected)));
	
	addButton(new ButtonWidget(width - 108, 8, 100, 20,
		new LiteralText("Reset to Defaults"),
		b -> client.openScreen(new ConfirmScreen(b2 -> {
			if(b2)
				blockList.resetToDefaults();
			client.openScreen(EditBlockListScreen.this);
		}, new LiteralText("Reset to Defaults"),
			new LiteralText("Are you sure?")))));
	
	addButton(
		doneButton = new ButtonWidget(width / 2 - 100, height - 28, 200, 20,
			new LiteralText("Done"), b -> client.openScreen(prevScreen)));
}
 
Example #28
Source File: SelectFileScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	listGui = new ListGui(client, this, setting.listFiles());
	
	addButton(new ButtonWidget(8, 8, 100, 20,
		new LiteralText("Open Folder"), b -> openFolder()));
	addButton(new ButtonWidget(width - 108, 8, 100, 20,
		new LiteralText("Reset to Defaults"), b -> askToConfirmReset()));
	
	doneButton = addButton(new ButtonWidget(width / 2 - 102, height - 48,
		100, 20, new LiteralText("Done"), b -> done()));
	addButton(new ButtonWidget(width / 2 + 2, height - 48, 100, 20,
		new LiteralText("Cancel"), b -> openPrevScreen()));
}
 
Example #29
Source File: EditItemListScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init()
{
	listGui = new ListGui(client, this, itemList.getItemNames());
	
	itemNameField = new TextFieldWidget(client.textRenderer,
		width / 2 - 152, height - 55, 150, 18, new LiteralText(""));
	children.add(itemNameField);
	
	addButton(addButton = new ButtonWidget(width / 2 - 2, height - 56, 30,
		20, new LiteralText("Add"), b -> {
			itemList.add(itemToAdd);
			itemNameField.setText("");
		}));
	
	addButton(removeButton = new ButtonWidget(width / 2 + 52, height - 56,
		100, 20, new LiteralText("Remove Selected"),
		b -> itemList.remove(listGui.selected)));
	
	addButton(new ButtonWidget(width - 108, 8, 100, 20,
		new LiteralText("Reset to Defaults"),
		b -> client.openScreen(new ConfirmScreen(b2 -> {
			if(b2)
				itemList.resetToDefaults();
			client.openScreen(EditItemListScreen.this);
		}, new LiteralText("Reset to Defaults"),
			new LiteralText("Are you sure?")))));
	
	addButton(
		doneButton = new ButtonWidget(width / 2 - 100, height - 28, 200, 20,
			new LiteralText("Done"), b -> client.openScreen(prevScreen)));
}
 
Example #30
Source File: GameMenuScreenMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void addWurstOptionsButton()
{
	wurstOptionsButton = new ButtonWidget(width / 2 - 102, height / 4 + 56,
		204, 20, new LiteralText("            Options"),
		b -> openWurstOptions());
	
	addButton(wurstOptionsButton);
}