Java 类net.minecraft.client.gui.ServerListEntryLanDetected 实例源码

项目:morecommands    文件:PatchEntityPlayerSP.java   
@Override
public void connectToSelected() {
    ServerSelectionList selector = ReflectionHelper.get(ObfuscatedField.GuiMultiplayer_serverListSelector, serverListSelector, this);

    if (selector == null) {
        PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(PatchList.PATCH_ENTITYPLAYERSP, false);
        super.connectToSelected();

        return;
    }

    GuiListExtended.IGuiListEntry entry = selector.getSelected() < 0 ? null : selector.getListEntry(selector.getSelected());

       if (entry instanceof ServerListEntryNormal)
        this.connectToServer(((ServerListEntryNormal) entry).getServerData());
       else if (entry instanceof ServerListEntryLanDetected) {
        LanServerInfo lanserverinfo = ((ServerListEntryLanDetected) entry).getServerData();
        this.connectToServer(new ServerData(lanserverinfo.getServerMotd(), lanserverinfo.getServerIpPort(), true));
       }
   }