net.minecraft.client.gui.GuiWorldSelection Java Examples

The following examples show how to use net.minecraft.client.gui.GuiWorldSelection. 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: ClientHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@SubscribeEvent
public void tickEvent(TickEvent.ClientTickEvent event) {
    if (event.phase == Phase.END) {
        return;
    }

    Minecraft mc = Minecraft.getMinecraft();
    if (mc.world != null) {
        if (loadWorld(mc.world)) {
            NEIClientConfig.setHasSMPCounterPart(false);
            NEIClientConfig.setInternalEnabled(false);

            if (!Minecraft.getMinecraft().isSingleplayer() && ClientUtils.inWorld())//wait for server to initiate in singleplayer
            {
                NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~'));
            }
        }

        if (!NEIClientConfig.isEnabled()) {
            return;
        }

        KeyManager.tickKeyStates();

        if (mc.currentScreen == null) {
            NEIController.processCreativeCycling(mc.player.inventory);
        }
    }

    GuiScreen gui = mc.currentScreen;
    if (gui != lastGui) {
        if (gui instanceof GuiMainMenu) {
            lastworld = null;
        } else if (gui instanceof GuiWorldSelection) {
            NEIClientConfig.reloadSaves();
        }
    }
    lastGui = gui;
}
 
Example #2
Source File: YUNoMakeGoodMap.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT) //Modders should never do this, im just lazy, and I KNOW what im doing.
public void onOpenGui(GuiOpenEvent e)
{
    //If we're opening the new world screen from the world selection, default to void world.
    if (e.getGui() instanceof GuiCreateWorld && Minecraft.getMinecraft().currentScreen instanceof GuiWorldSelection)
    {
        //Auto-select void world.
        GuiCreateWorld cw = (GuiCreateWorld)e.getGui();
        ReflectionHelper.setPrivateValue(GuiCreateWorld.class, cw, worldType.getId(),
                "field_146331_K", "selectedIndex");
    }
}