use of net.minecraft.client.gui.screen.MultiplayerScreen in project ModernUI by BloCamLimb.
the class IngameMenuHome method confirmExit.
private void confirmExit(int callback) {
if (minecraft.world == null || callback != ConfirmCallback.CONFIRM) {
return;
}
boolean singleplayer = minecraft.isIntegratedServerRunning();
boolean realmsConnected = minecraft.isConnectedToRealms();
minecraft.world.sendQuittingDisconnectingPacket();
if (singleplayer) {
minecraft.unloadWorld(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
} else {
minecraft.unloadWorld();
}
if (singleplayer) {
minecraft.displayGuiScreen(new MainMenuScreen());
} else if (realmsConnected) {
RealmsBridgeScreen realmsBridge = new RealmsBridgeScreen();
realmsBridge.func_231394_a_(new MainMenuScreen());
} else {
minecraft.displayGuiScreen(new MultiplayerScreen(new MainMenuScreen()));
}
}
use of net.minecraft.client.gui.screen.MultiplayerScreen in project VariousOddities by Lyinginbedmon.
the class AbstractParalysisScreen method init.
public void init() {
this.minecraft.keyboardListener.enableRepeatEvents(true);
this.addButton(new Button(this.width / 2 - 102, this.height / 4 + 24 + -16, 204, 20, new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".paralysed.resignation"), (button2) -> {
PacketHandler.sendToServer(new PacketParalysisResignation());
}));
this.addButton(new Button(this.width / 2 - 102, this.height / 4 + 48 + -16, 98, 20, new TranslationTextComponent("gui.advancements"), (button2) -> {
this.minecraft.displayGuiScreen(new AdvancementsScreen(this.minecraft.player.connection.getAdvancementManager()));
}));
this.addButton(new Button(this.width / 2 + 4, this.height / 4 + 48 + -16, 98, 20, new TranslationTextComponent("gui.stats"), (button2) -> {
this.minecraft.displayGuiScreen(new StatsScreen(this, this.minecraft.player.getStats()));
}));
String s = SharedConstants.getVersion().isStable() ? "https://aka.ms/javafeedback?ref=game" : "https://aka.ms/snapshotfeedback?ref=game";
this.addButton(new Button(this.width / 2 - 102, this.height / 4 + 72 + -16, 98, 20, new TranslationTextComponent("menu.sendFeedback"), (button2) -> {
this.minecraft.displayGuiScreen(new ConfirmOpenLinkScreen((open) -> {
if (open)
Util.getOSType().openURI(s);
this.minecraft.displayGuiScreen(this);
}, s, true));
}));
this.addButton(new Button(this.width / 2 + 4, this.height / 4 + 72 + -16, 98, 20, new TranslationTextComponent("menu.reportBugs"), (button2) -> {
this.minecraft.displayGuiScreen(new ConfirmOpenLinkScreen((open) -> {
if (open)
Util.getOSType().openURI("https://aka.ms/snapshotbugs?ref=game");
this.minecraft.displayGuiScreen(this);
}, "https://aka.ms/snapshotbugs?ref=game", true));
}));
this.addButton(new Button(this.width / 2 - 102, this.height / 4 + 96 + -16, 98, 20, new TranslationTextComponent("menu.options"), (button2) -> {
this.minecraft.displayGuiScreen(new OptionsScreen(this, this.minecraft.gameSettings));
}));
Button button = this.addButton(new Button(this.width / 2 + 4, this.height / 4 + 96 + -16, 98, 20, new TranslationTextComponent("menu.shareToLan"), (button2) -> {
this.minecraft.displayGuiScreen(new ShareToLanScreen(this));
}));
button.active = this.minecraft.isSingleplayer() && !this.minecraft.getIntegratedServer().getPublic();
Button button1 = this.addButton(new Button(this.width / 2 - 102, this.height / 4 + 120 + -16, 204, 20, new TranslationTextComponent("menu.returnToMenu"), (button2) -> {
boolean flag = this.minecraft.isIntegratedServerRunning();
boolean flag1 = this.minecraft.isConnectedToRealms();
button2.active = false;
this.minecraft.world.sendQuittingDisconnectingPacket();
if (flag)
this.minecraft.unloadWorld(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
else
this.minecraft.unloadWorld();
if (flag)
this.minecraft.displayGuiScreen(new MainMenuScreen());
else if (flag1) {
RealmsBridgeScreen realmsbridgescreen = new RealmsBridgeScreen();
realmsbridgescreen.func_231394_a_(new MainMenuScreen());
} else
this.minecraft.displayGuiScreen(new MultiplayerScreen(new MainMenuScreen()));
}));
if (!this.minecraft.isIntegratedServerRunning())
button1.setMessage(new TranslationTextComponent("menu.disconnect"));
}
Aggregations