net.minecraft.client.gui.GuiConfirmOpenLink Java Examples

The following examples show how to use net.minecraft.client.gui.GuiConfirmOpenLink. 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: GuiProblemScreen.java    From VanillaFix with MIT License 6 votes vote down vote up
@Override
protected void actionPerformed(GuiButton button) {
    if (button.id == 1) {
        try {
            if (hasteLink == null) {
                hasteLink = HasteUpload.uploadToHaste(ModConfig.crashes.hasteURL, "mccrash", report.getCompleteReport());
            }
            ReflectionHelper.findField(GuiScreen.class, "clickedLinkURI", "field_175286_t").set(this, new URI(hasteLink));
            mc.displayGuiScreen(new GuiConfirmOpenLink(this, hasteLink, 31102009, false));
        } catch (Throwable e) {
            log.error("Exception when crash menu button clicked:", e);
            button.displayString = I18n.format("vanillafix.gui.failed");
            button.enabled = false;
        }
    }
}
 
Example #2
Source File: PageBase.java    From OpenModsLib with MIT License 6 votes vote down vote up
protected BaseComponent createActionButton(int x, int y, final String link, Icon icon, String text, final IConfirmListener listener) {
	EmptyComposite result = new EmptyComposite(x, y, 50, 8);

	GuiComponentLabel label = new GuiComponentLabel(15, 2, TranslationUtils.translateToLocal(text));
	label.setScale(BookScaleConfig.getPageContentScale());
	result.addComponent(label);

	GuiComponentSprite image = new GuiComponentSprite(0, 0, icon);
	result.addComponent(image);

	result.setListener((IMouseDownListener)(component, clickX, clickY, button) -> {
		final Minecraft mc = Minecraft.getMinecraft();
		if (mc.gameSettings.chatLinksPrompt) {
			final GuiScreen prevGui = mc.currentScreen;
			mc.displayGuiScreen(new GuiConfirmOpenLink((response, id) -> {
				if (response) listener.onConfirm();
				mc.displayGuiScreen(prevGui);
			}, link, 0, false));
		} else {
			listener.onConfirm();
		}
	});

	return result;
}
 
Example #3
Source File: GuiNEIOptionList.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void actionPerformed(String ident, Object... params) {
    if (ident.equals("patreon")) {
        GuiConfirmOpenLink gui = new GuiConfirmOpenLink(this, "patreon.com/cb", 0, true);
        gui.disableSecurityWarning();
        mc.displayGuiScreen(gui);
    } else {
        super.actionPerformed(ident, params);
    }
}
 
Example #4
Source File: GuiNEIOptionList.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void actionPerformed(String ident, Object... params) {
    if (ident.equals("patreon")) {
        GuiConfirmOpenLink gui = new GuiConfirmOpenLink(this, "patreon.com/cb", 0, true);
        gui.disableSecurityWarning();
        mc.displayGuiScreen(gui);
    } else
        super.actionPerformed(ident, params);
}
 
Example #5
Source File: LocatedString.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean onMouseClick(GuiWiki gui, int x, int y){
    if(linkAddress != null) {
        if(getMouseSpace().contains(x, y)) {
            if(linkAddress.contains("www") || linkAddress.startsWith("http://") || linkAddress.startsWith("https://")) {
                parentGui = Minecraft.getMinecraft().currentScreen;
                Minecraft.getMinecraft().displayGuiScreen(new GuiConfirmOpenLink(this, linkAddress, 0, false));
            } else {
                gui.setCurrentFile(linkAddress);
            }
            return true;
        }
    }
    return false;
}
 
Example #6
Source File: XrayModMainGui.java    From MinecraftX-RAY with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected void actionPerformed(GuiButton currentButton) {
	if (currentButton.enabled) {
		if (currentButton.id == 0) {
			this.mc.displayGuiScreen(this.parentScreen);
		}
		if (currentButton.id == 1) {
			this.mc.displayGuiScreen(new XrayModChooserGui());
		}
		if (currentButton.id == 2) {
			UyjuliansXrayModMain.getModInstance().loadBlockList(this.profileNameTextBox.getText());
			this.mc.renderGlobal.loadRenderers();
			this.mc.displayGuiScreen(this.parentScreen);
		}
		if (currentButton.id == 3) {
			try {
				URI currentURI = new URI("http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1287646-q");
                if (this.mc.gameSettings.chatLinksPrompt)
                {
                    this.clickedURI = currentURI;
                    this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, "http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1287646-q", 0, false));
                }
                else
                {
                    this.OpenURI(currentURI);
                }
			} 
			catch (URISyntaxException e) {
				e.printStackTrace();
			}
		}
		if (currentButton.id == 4) {
			XrayModMainGui newGuiObj = new XrayModMainGui(this, mc.gameSettings);
			newGuiObj.chooseScreen = 1;
			this.mc.displayGuiScreen(newGuiObj);
		}
		if (currentButton.id == 5) {
			if ((this.configKeyTextBox.getText().length() > 0) && (this.configValueTextBox.getText().length() > 0)) {
				XrayModConfiguration.setProperty(this.configKeyTextBox.getText(), this.configValueTextBox.getText());
			}
			this.mc.displayGuiScreen(this.parentScreen);
		}
		
	}
}