Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
mc.displayGuiScreen(new GuiShareToLan(this))в мейн меню кидает еёв buttonList добавляй GuiButton, в actionperformed обрабатывай вот так
mc.displayGuiScreen(new GuiShareToLan(this))
public void initGui() {
this.viewportTexture = new DynamicTexture(256, 256);
this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
int i = this.height / 4 + 48;
addSingleplayerMultiplayerButtons(i, 24);
buttonList.add(
new GuiButton(1, width / 2-100 , i + 72 - 72 - 12, 200, 20, I18n.format("menu.singleplayer")));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 - 12, 200, 20, I18n.format("menu.settings", new Object[0])));
this.buttonList.add(new GuiButton(4, this.width / 2 - 100, i + 72 + 12, 200, 20, I18n.format("menu.quit", new Object[0])));
this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, i + 72 + 12));
this.buttonList.add(new GuiButton(6, width / 2-100 , i + 72 - 60 - 12, 200, 20, StatCollector.translateToLocal("menu.shareToLan")));
synchronized (this.field_104025_t) {
this.field_92023_s = this.fontRendererObj.getStringWidth(this.field_92025_p);
this.field_92024_r = this.fontRendererObj.getStringWidth(this.field_146972_A);
int j = Math.max(this.field_92023_s, this.field_92024_r);
this.field_92022_t = (this.width - j) / 2;
this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24;
this.field_92020_v = this.field_92022_t + j;
this.field_92019_w = this.field_92021_u + 24;
}
}
private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_) { this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_, I18n.format("menu.multiplayer", new Object[0]))); }
protected void actionperformed(GuiButton p_146284_1_) {
if (p_146284_1_.id == 0) {
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
if (p_146284_1_.id == 5) {
this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
}
if (p_146284_1_.id == 2) {
this.mc.displayGuiScreen(new GuiMultiplayer(this));
}
if (p_146284_1_.id == 4) {
this.mc.shutdown();
}
if (p_146284_1_.id == 1) {
this.mc.displayGuiScreen(new GuiSelectWorld(this));
}
if (p_146284_1_.id == 6) {
this.mc.displayGuiScreen(new GuiShareToLan(this));
}
}
Добавь в свою гуи кнопкуthis.buttonList.add(new GuiButton(6, width / 2-100 , i + 72 - 60 - 12, 200, 20, StatCollector.translateToLocal("menu.shareToLan")));
и обработай нажатиеthis.mc.displayGuiScreen(new GuiShareToLan(this));