Java Code Examples for net.minecraft.client.Minecraft#loadWorld()

The following examples show how to use net.minecraft.client.Minecraft#loadWorld() . 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: DisconnectCommand.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void exec(String input) {
    if (!this.clamp(input, 1, 1)) {
        this.printUsage();
        return;
    }

    final Minecraft mc = Minecraft.getMinecraft();

    boolean flag = mc.isIntegratedServerRunning();
    boolean flag1 = mc.isConnectedToRealms();
    mc.world.sendQuittingDisconnectingPacket();
    mc.loadWorld(null);

    if (flag) {
        mc.displayGuiScreen(new GuiMainMenu());
    }
    else if (flag1) {
        RealmsBridge realmsbridge = new RealmsBridge();
        realmsbridge.switchToRealms(new GuiMainMenu());
    } else {
        mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
    }
}
 
Example 2
Source File: QCraftProxyClient.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public void travelToServer( LostLuggage.Address address )
{
    // Disconnect from current server
    Minecraft minecraft = Minecraft.getMinecraft();
    minecraft.theWorld.sendQuittingDisconnectingPacket();
    minecraft.loadWorld((WorldClient)null);
    minecraft.displayGuiScreen( new GuiTravelStandby( address ) );
}