net.minecraft.text.LiteralText Java Examples

The following examples show how to use net.minecraft.text.LiteralText. 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: MixinKeyboard.java    From Sandbox with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Inject(method = "processF3", at = @At("HEAD"), cancellable = true)
public void processF3(int button, CallbackInfoReturnable<Boolean> b) {
    if (button == 81) {
        this.debugWarn("debug.help.message");
        ChatHud chat = this.client.inGameHud.getChatHud();
        chat.addMessage(new TranslatableText("debug.reload_chunks.help"));
        chat.addMessage(new TranslatableText("debug.show_hitboxes.help"));
        chat.addMessage(new TranslatableText("debug.copy_location.help"));
        chat.addMessage(new TranslatableText("debug.clear_chat.help"));
        chat.addMessage(new TranslatableText("debug.cycle_renderdistance.help"));
        chat.addMessage(new TranslatableText("debug.chunk_boundaries.help"));
        chat.addMessage(new TranslatableText("debug.advanced_tooltips.help"));
        chat.addMessage(new TranslatableText("debug.inspect.help"));
        chat.addMessage(new TranslatableText("debug.creative_spectator.help"));
        chat.addMessage(new TranslatableText("debug.pause_focus.help"));
        chat.addMessage(new TranslatableText("debug.help.help"));
        chat.addMessage(new TranslatableText("debug.reload_resourcepacks.help"));
        chat.addMessage(new TranslatableText("debug.pause.help"));
        chat.addMessage(new LiteralText("Test"));
        b.setReturnValue(true);
    }
}
 
Example #2
Source File: WurstOptionsScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
public WurstOptionsButton(int xOffset, int yOffset,
	Supplier<String> messageSupplier, String tooltip,
	PressAction pressAction)
{
	super(WurstOptionsScreen.this.width / 2 + xOffset,
		WurstOptionsScreen.this.height / 4 - 16 + yOffset, 100, 20,
		new LiteralText(messageSupplier.get()), pressAction);
	
	this.messageSupplier = messageSupplier;
	
	if(tooltip.isEmpty())
		this.tooltip = Arrays.asList(new LiteralText[0]);
	else
	{
		String[] lines = tooltip.split("\n");
		
		LiteralText[] lines2 = new LiteralText[lines.length];
		for(int i = 0; i < lines.length; i++)
			lines2[i] = new LiteralText(lines[i]);
		
		this.tooltip = Arrays.asList(lines2);
	}
	
	addButton(this);
}
 
Example #3
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 #4
Source File: DisconnectedScreenMixin.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void tick()
{
	AutoReconnectHack autoReconnect =
		WurstClient.INSTANCE.getHax().autoReconnectHack;
	
	if(!autoReconnect.isEnabled())
	{
		autoReconnectButton.setMessage(new LiteralText("AutoReconnect"));
		return;
	}
	
	autoReconnectButton.setMessage(new LiteralText("AutoReconnect ("
		+ (int)Math.ceil(autoReconnectTimer / 20.0) + ")"));
	
	if(autoReconnectTimer > 0)
	{
		autoReconnectTimer--;
		return;
	}
	
	LastServerRememberer.reconnect(parent);
}
 
Example #5
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 #6
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 #7
Source File: KeybindProfilesScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY,
	float partialTicks)
{
	renderBackground(matrixStack);
	listGui.render(matrixStack, mouseX, mouseY, partialTicks);
	
	drawCenteredString(matrixStack, client.textRenderer, "Keybind Profiles",
		width / 2, 12, 0xffffff);
	
	super.render(matrixStack, mouseX, mouseY, partialTicks);
	
	if(loadButton.isHovered() && !loadButton.active)
		renderTooltip(matrixStack,
			Arrays.asList(new LiteralText("You must first select a file.")),
			mouseX, mouseY);
}
 
Example #8
Source File: SelectFileScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY,
	float partialTicks)
{
	renderBackground(matrixStack);
	listGui.render(matrixStack, mouseX, mouseY, partialTicks);
	
	drawCenteredString(matrixStack, client.textRenderer, setting.getName(),
		width / 2, 12, 0xffffff);
	
	super.render(matrixStack, mouseX, mouseY, partialTicks);
	
	if(doneButton.isHovered() && !doneButton.active)
		renderTooltip(matrixStack,
			Arrays.asList(new LiteralText("You must first select a file.")),
			mouseX, mouseY);
}
 
Example #9
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 #10
Source File: Messenger.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static BaseText c(Object ... fields)
{
    BaseText message = new LiteralText("");
    BaseText previous_component = null;
    for (Object o: fields)
    {
        if (o instanceof BaseText)
        {
            message.append((BaseText)o);
            previous_component = (BaseText)o;
            continue;
        }
        String txt = o.toString();
        BaseText comp = _getChatComponentFromDesc(txt,previous_component);
        if (comp != previous_component) message.append(comp);
        previous_component = comp;
    }
    return message;
}
 
Example #11
Source File: MixinServerLoginNetworkHandler.java    From Sandbox with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Inject(method = "onQueryResponse", at = @At("HEAD"), cancellable = true)
public void onQueryResponse(LoginQueryResponseC2SPacket packet, CallbackInfo info) {
    if (SandboxConfig.velocity.get() && velocityId == ((CustomPayloadPacket.LoginQueryPacket) packet).getQueryId()) {
        PacketByteBuf buf = ((CustomPayloadPacket.LoginQueryPacket) packet).getBuffer();
        if (buf == null) {
            this.disconnect(new LiteralText("This server requires you to log in through a proxy"));
            info.cancel();
            return;
        }
        if (!VelocityUtil.checkIntegrity(buf)) {
            this.disconnect(new LiteralText("Unable to verify player details"));
            info.cancel();
            return;
        }

        ((ClientConnectionInternal) this.client).setSocketAddress(new InetSocketAddress(VelocityUtil.readAddress(buf), ((InetSocketAddress) this.client.getAddress()).getPort()));
        this.profile = VelocityUtil.createProfile(buf);
        velocityConn = true;
        acceptPlayer();
        info.cancel();
    }
}
 
Example #12
Source File: ChatTranslatorHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void translate(ChatInputEvent event)
{
	String incomingMsg = event.getComponent().getString();
	
	String translatorPrefix =
		"\u00a7a[\u00a7b" + langTo.getSelected().name + "\u00a7a]:\u00a7r ";
	
	if(incomingMsg.startsWith(ChatUtils.WURST_PREFIX)
		|| incomingMsg.startsWith(translatorPrefix))
		return;
	
	String translated = googleTranslate.translate(incomingMsg,
		langFrom.getSelected().value, langTo.getSelected().value);
	
	if(translated == null)
		return;
	
	Text translationMsg = new LiteralText(translatorPrefix)
		.append(new LiteralText(translated));
	
	MC.inGameHud.getChatHud().addMessage(translationMsg);
}
 
Example #13
Source File: RenameCmd.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void call(String[] args) throws CmdException
{
	if(!MC.player.abilities.creativeMode)
		throw new CmdError("Creative mode only.");
	
	if(args.length == 0)
		throw new CmdSyntaxError();
	
	String message = args[0];
	for(int i = 1; i < args.length; i++)
		message += " " + args[i];
	
	message = message.replace("$", "�").replace("��", "$");
	ItemStack item = MC.player.inventory.getMainHandStack();
	
	if(item == null)
		throw new CmdError("There is no item in your hand.");
	
	item.setCustomName(new LiteralText(message));
	ChatUtils.message("Renamed item to \"" + message + "�r\".");
}
 
Example #14
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 #15
Source File: Contributors.java    From the-hallow with MIT License 6 votes vote down vote up
private static Text makeDesc(Person person, Formatting formatting) {
	ContactInformation contact = person.getContact();
	Text ret = new LiteralText(person.getName()).formatted(formatting);
	contact.get("github").ifPresent(gh ->
		ret.append(Texts.bracketed(new TranslatableText("social.thehallow.github")
			.styled(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, gh))))
			.formatted(Formatting.BLACK)
		)
	);
	
	contact.get("minecraft").ifPresent(mc ->
		ret.append(Texts.bracketed(new TranslatableText("social.thehallow.minecraft")
			.styled(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://mcuuid.net/?q=" + mc))))
			.formatted(Formatting.GREEN)
		)
	);
	
	return ret;
}
 
Example #16
Source File: EditAltScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
public EditAltScreen(Screen prevScreen, AltManager altManager,
	Alt editedAlt)
{
	super(prevScreen, new LiteralText("Edit Alt"));
	this.altManager = altManager;
	this.editedAlt = editedAlt;
}
 
Example #17
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);
}
 
Example #18
Source File: NavigatorRemoveKeybindScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onResize()
{
	// OK button
	removeButton = new ButtonWidget(width / 2 - 151, height - 65, 149, 18,
		new LiteralText("Remove"), b -> remove());
	removeButton.active = !selectedKey.isEmpty();
	addButton(removeButton);
	
	// cancel button
	addButton(new ButtonWidget(width / 2 + 2, height - 65, 149, 18,
		new LiteralText("Cancel"), b -> client.openScreen(parent)));
}
 
Example #19
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 #20
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 #21
Source File: AltManagerScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void pressDelete()
{
	LiteralText text =
		new LiteralText("Are you sure you want to remove this alt?");
	
	String altName = listGui.getSelectedAlt().getNameOrEmail();
	LiteralText message = new LiteralText(
		"\"" + altName + "\" will be lost forever! (A long time!)");
	
	ConfirmScreen screen = new ConfirmScreen(this::confirmRemove, text,
		message, new LiteralText("Delete"), new LiteralText("Cancel"));
	client.openScreen(screen);
}
 
Example #22
Source File: CmdRename.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCommand(String command, String[] args) throws Exception {
	if (!mc.player.abilities.creativeMode) {
		BleachLogger.errorMessage("Not In Creative Mode!");
		return;
	}
	
	ItemStack i = mc.player.inventory.getMainHandStack();
	
	String name = "";
	for (int j = 0; j < args.length; j++) name += args[j] += " ";
	
	i.setCustomName(new LiteralText(name.replace("&", "§").replace("§§", "&")));
	BleachLogger.infoMessage("Renamed Item");
}
 
Example #23
Source File: MixinAddServerScreen.java    From multiconnect with MIT License 5 votes vote down vote up
@Inject(method = "init", at = @At("RETURN"))
private void createButtons(CallbackInfo ci) {
    forceProtocolLabel = new TranslatableText("multiconnect.changeForcedProtocol").append(" ->");
    protocolSelector = new DropDownWidget<>(width - 80, 5, 70, 20, ConnectionMode.byValue(ServersExt.getInstance().getForcedProtocol(server.address)), mode -> new LiteralText(mode.getName()));
    ConnectionMode.populateDropDownWidget(protocolSelector);
    children.add(0, protocolSelector);
}
 
Example #24
Source File: Optifabric.java    From OptiFabric with Mozilla Public License 2.0 5 votes vote down vote up
public static void checkForErrors() {
	if (OptifabricError.hasError()) {
		ConfirmScreen confirmScreen = new ConfirmScreen(t -> {
			if (t) {
				Util.getOperatingSystem().open(OptifabricError.getErrorURL());
			} else {
				MinecraftClient.getInstance().scheduleStop();
			}
		}, new LiteralText(Formatting.RED + "There was an error loading OptiFabric!"), new LiteralText(OptifabricError.getError()), Formatting.GREEN + OptifabricError.getHelpButtonText(), Formatting.RED + "Close Game");

		MinecraftClient.getInstance().openScreen(confirmScreen);
	}
}
 
Example #25
Source File: PingCommand.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
{
    LiteralArgumentBuilder<ServerCommandSource> command = literal("ping").
            requires( (player) -> CarpetExtraSettings.commandPing).
                    executes( c ->
                    {
                        ServerPlayerEntity playerEntity = c.getSource().getPlayer();
                        int ping = playerEntity.pingMilliseconds;
                        playerEntity.sendMessage(new LiteralText("Your ping is: " + ping + " ms"));
                        return 1;
                    });
    
    dispatcher.register(command);
}
 
Example #26
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 #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: 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 #29
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
	super.render(matrix, mouseX, mouseY, delta);
	
	buttons.get(2).setMessage(new LiteralText((getSettings().get(0).toToggle().state ? "\u00a7aAutoReconnect ["
			+ ((reconnectTime + getSettings().get(1).toSlider().getValue() * 1000) - System.currentTimeMillis())
			+ "]" : "\u00a7cAutoReconnect [" + getSettings().get(1).toSlider().getValue() * 1000 + "]")));
	
	if (reconnectTime + getSettings().get(1).toSlider().getValue() * 1000 < System.currentTimeMillis() && getSettings().get(0).toToggle().state) {
		if (server != null) client.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), client, server));
		reconnectTime = System.currentTimeMillis();
	}
}
 
Example #30
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()));
}