Java 类net.minecraft.client.multiplayer.ServerList 实例源码

项目:CreeperHostGui    文件:ServerSelectionListPublic.java   
@Override
public void func_148195_a(ServerList serverList)
{
    ourList.clear();

    if (serverList instanceof ServerListPublic)
    {
        ServerListPublic pub = (ServerListPublic) serverList;
        for (int i = 0; i < pub.countServers(); ++i)
        {
            ourList.add(new ServerListEntryPublic(ourParent, new ServerListEntryNormalPubConstructor(ourParent, pub.getServerData(i))));
        }
    }

    sort();
}
项目:CreeperHostGui    文件:GuiMultiplayerPublic.java   
private void setServerList(ServerList serverList)
{
    ourSavedServerList = serverList;
    if (savedServerListField == null)
    {
        savedServerListField = ReflectionHelper.findField(GuiMultiplayer.class, "field_146804_i", "savedServerList");
        savedServerListField.setAccessible(true);
    }

    try
    {
        savedServerListField.set(this, serverList);
    }
    catch (IllegalAccessException e)
    {
        CreeperHost.logger.error("Unable to set server list", e);
    }
}
项目:CreeperHostGui    文件:ServerSelectionListPublic.java   
@Override
public void updateOnlineServers(ServerList serverList)
{
    ourList.clear();

    if (serverList instanceof ServerListPublic)
    {
        ServerListPublic pub = (ServerListPublic) serverList;
        for (int i = 0; i < pub.countServers(); ++i)
        {
            ourList.add(new ServerListEntryPublic(ourParent, new ServerListEntryNormalPubConstructor(ourParent, pub.getServerData(i))));
        }
    }

    sort();
}
项目:RuneCraftery    文件:GuiMultiplayer.java   
public void func_73866_w_() {
   Keyboard.enableRepeatEvents(true);
   this.field_73887_h.clear();
   if(!this.field_74024_A) {
      this.field_74024_A = true;
      this.field_74030_m = new ServerList(this.field_73882_e);
      this.field_74030_m.func_78853_a();
      this.field_74041_x = new LanServerList();

      try {
         this.field_74040_y = new ThreadLanServerFind(this.field_74041_x);
         this.field_74040_y.start();
      } catch (Exception var2) {
         this.field_73882_e.func_98033_al().func_98236_b("Unable to start LAN server detection: " + var2.getMessage());
      }

      this.field_74022_d = new GuiSlotServer(this);
   } else {
      this.field_74022_d.func_77207_a(this.field_73880_f, this.field_73881_g, 32, this.field_73881_g - 64);
   }

   this.func_74016_g();
}
项目:DecompiledMinecraft    文件:ServerSelectionList.java   
public void func_148195_a(ServerList p_148195_1_)
{
    this.field_148198_l.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.field_148198_l.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i)));
    }
}
项目:DecompiledMinecraft    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.initialized)
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.func_148195_a(this.savedServerList);
    }
    else
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }

    this.createButtons();
}
项目:BaseClient    文件:ServerSelectionList.java   
public void func_148195_a(ServerList p_148195_1_)
{
    this.field_148198_l.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.field_148198_l.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i)));
    }
}
项目:BaseClient    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.initialized)
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.func_148195_a(this.savedServerList);
    }
    else
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }

    this.createButtons();
}
项目:BaseClient    文件:ServerSelectionList.java   
public void func_148195_a(ServerList p_148195_1_)
{
    this.field_148198_l.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.field_148198_l.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i)));
    }
}
项目:BaseClient    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.initialized)
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.func_148195_a(this.savedServerList);
    }
    else
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }

    this.createButtons();
}
项目:Backmemed    文件:ServerSelectionList.java   
public void updateOnlineServers(ServerList p_148195_1_)
{
    this.serverListInternet.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.serverListInternet.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i)));
    }
}
项目:Backmemed    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (this.initialized)
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }
    else
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            LOGGER.warn("Unable to start LAN server detection: {}", new Object[] {exception.getMessage()});
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.updateOnlineServers(this.savedServerList);
    }

    this.createButtons();
}
项目:CustomWorldGen    文件:ServerSelectionList.java   
public void updateOnlineServers(ServerList p_148195_1_)
{
    this.serverListInternet.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.serverListInternet.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i)));
    }
}
项目:CustomWorldGen    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (this.initialized)
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }
    else
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            LOGGER.warn("Unable to start LAN server detection: {}", new Object[] {exception.getMessage()});
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.updateOnlineServers(this.savedServerList);
    }

    this.createButtons();
}
项目:Coherence    文件:CoherenceSSL.java   
public void updateServerList(ServerList serverList)
{
    this.slenList.clear();

    for (int i = 0; i < serverList.countServers(); ++i)
    {
        this.slenList.add(new CoherenceSLEN(this.owner, serverList.getServerData(i)));
    }
}
项目:Coherence    文件:UiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.initialized)
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverListSelector = new CoherenceSSL(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.updateServerList(this.savedServerList);
    }
    else
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }

    this.createButtons();
}
项目:Wars-Mod    文件:ClientProxy.java   
private void addServerToList(){
    ArrayList serverip = new ArrayList<String>();
    try {
        URL targetURL = new URL("http://thefireplace.bitnamiapp.com/warsmodserverip.txt");
        InputStream in = targetURL.openStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String dona;
        while ((dona = reader.readLine()) != null) {
            dona = dona.trim();
            serverip.add(dona);
        }
        in.close();
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }
    if(serverip.isEmpty())
        return;
    if(serverip.get(0).equals(""))
        return;
    // Automatically adds official server to servers list
    ServerList list = new ServerList(Minecraft.getMinecraft());
    list.loadServerList();
    boolean found = false;
    for (int i = 0; i < list.countServers(); i++) {
        ServerData data = list.getServerData(i);
        if (data.serverName.equals("Wars Mod Battle Server") && data.serverIP.equals(serverip.get(0))) {
            found = true;
            break;
        }
    }
    if (!found) {
        list.addServerData(new ServerData("Wars Mod Battle Server", (String)serverip.get(0), false));
    }
    list.saveServerList();
}
项目:Resilience-Client-Source    文件:ServerSelectionList.java   
public void func_148195_a(ServerList p_148195_1_)
{
    this.field_148198_l.clear();

    for (int var2 = 0; var2 < p_148195_1_.countServers(); ++var2)
    {
        this.field_148198_l.add(new ServerListEntryNormal(this.field_148200_k, p_148195_1_.getServerData(var2)));
    }
}
项目:Resilience-Client-Source    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.field_146801_C)
    {
        this.field_146801_C = true;
        this.field_146804_i = new ServerList(this.mc);
        this.field_146804_i.loadServerList();
        this.field_146799_A = new LanServerDetector.LanServerList();

        try
        {
            this.field_146800_B = new LanServerDetector.ThreadLanServerFind(this.field_146799_A);
            this.field_146800_B.start();
        }
        catch (Exception var2)
        {
            logger.warn("Unable to start LAN server detection: " + var2.getMessage());
        }

        this.field_146803_h = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.field_146803_h.func_148195_a(this.field_146804_i);
    }
    else
    {
        this.field_146803_h.func_148122_a(this.width, this.height, 32, this.height - 64);
    }

    this.func_146794_g();
}
项目:ExpandedRailsMod    文件:ServerSelectionList.java   
public void updateOnlineServers(ServerList p_148195_1_)
{
    this.serverListInternet.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.serverListInternet.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i)));
    }
}
项目:ExpandedRailsMod    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (this.initialized)
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }
    else
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            LOGGER.warn("Unable to start LAN server detection: {}", new Object[] {exception.getMessage()});
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.updateOnlineServers(this.savedServerList);
    }

    this.createButtons();
}
项目:Cauldron    文件:ServerSelectionList.java   
public void func_148195_a(ServerList p_148195_1_)
{
    this.field_148198_l.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.field_148198_l.add(new ServerListEntryNormal(this.field_148200_k, p_148195_1_.getServerData(i)));
    }
}
项目:Cauldron    文件:GuiMultiplayer.java   
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.field_146801_C)
    {
        this.field_146801_C = true;
        this.field_146804_i = new ServerList(this.mc);
        this.field_146804_i.loadServerList();
        this.field_146799_A = new LanServerDetector.LanServerList();

        try
        {
            this.field_146800_B = new LanServerDetector.ThreadLanServerFind(this.field_146799_A);
            this.field_146800_B.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.field_146803_h = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.field_146803_h.func_148195_a(this.field_146804_i);
    }
    else
    {
        this.field_146803_h.func_148122_a(this.width, this.height, 32, this.height - 64);
    }

    this.func_146794_g();
}
项目:Cauldron    文件:ServerSelectionList.java   
public void func_148195_a(ServerList p_148195_1_)
{
    this.field_148198_l.clear();

    for (int i = 0; i < p_148195_1_.countServers(); ++i)
    {
        this.field_148198_l.add(new ServerListEntryNormal(this.field_148200_k, p_148195_1_.getServerData(i)));
    }
}
项目:Cauldron    文件:GuiMultiplayer.java   
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.field_146801_C)
    {
        this.field_146801_C = true;
        this.field_146804_i = new ServerList(this.mc);
        this.field_146804_i.loadServerList();
        this.field_146799_A = new LanServerDetector.LanServerList();

        try
        {
            this.field_146800_B = new LanServerDetector.ThreadLanServerFind(this.field_146799_A);
            this.field_146800_B.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.field_146803_h = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.field_146803_h.func_148195_a(this.field_146804_i);
    }
    else
    {
        this.field_146803_h.func_148122_a(this.width, this.height, 32, this.height - 64);
    }

    this.func_146794_g();
}
项目:RuneCraftery    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.field_74024_A)
    {
        this.field_74024_A = true;
        this.internetServerList = new ServerList(this.mc);
        this.internetServerList.loadServerList();
        this.localNetworkServerList = new LanServerList();

        try
        {
            this.localServerFindThread = new ThreadLanServerFind(this.localNetworkServerList);
            this.localServerFindThread.start();
        }
        catch (Exception exception)
        {
            this.mc.getLogAgent().logWarning("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverSlotContainer = new GuiSlotServer(this);
    }
    else
    {
        this.serverSlotContainer.func_77207_a(this.width, this.height, 32, this.height - 64);
    }

    this.initGuiControls();
}
项目:BetterNutritionMod    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.field_74024_A)
    {
        this.field_74024_A = true;
        this.internetServerList = new ServerList(this.mc);
        this.internetServerList.loadServerList();
        this.localNetworkServerList = new LanServerList();

        try
        {
            this.localServerFindThread = new ThreadLanServerFind(this.localNetworkServerList);
            this.localServerFindThread.start();
        }
        catch (Exception exception)
        {
            this.mc.getLogAgent().logWarning("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverSlotContainer = new GuiSlotServer(this);
    }
    else
    {
        this.serverSlotContainer.func_77207_a(this.width, this.height, 32, this.height - 64);
    }

    this.initGuiControls();
}
项目:CreeperHostGui    文件:CreeperHostServerSelectionList.java   
@Override
public void func_148195_a(ServerList p_148195_1_)
{
    super.func_148195_a(p_148195_1_);
    ourList.add(new CreeperHostEntry(ourParent, new ServerData("", "127.0.0.1", false), true));
}
项目:CreeperHostGui    文件:CreeperHostServerSelectionList.java   
@Override
public void updateOnlineServers(ServerList p_148195_1_)
{
    super.updateOnlineServers(p_148195_1_);
    ourList.add(new CreeperHostEntry(ourParent, new ServerData("", "127.0.0.1", false), true));
}
项目:DecompiledMinecraft    文件:GuiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}
项目:BaseClient    文件:GuiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}
项目:BaseClient    文件:GuiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}
项目:Backmemed    文件:GuiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleResourcePack(SPacketResourcePackSend packetIn)
{
    final String s = packetIn.getURL();
    final String s1 = packetIn.getHash();

    if (this.validateResourcePackUrl(s))
    {
        if (s.startsWith("level://"))
        {
            String s2 = s.substring("level://".length());
            File file1 = new File(this.gameController.mcDataDir, "saves");
            File file2 = new File(file1, s2);

            if (file2.isFile())
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), this.createDownloadCallback());
            }
            else
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
            }
        }
        else
        {
            ServerData serverdata = this.gameController.getCurrentServerData();

            if (serverdata != null && serverdata.getResourceMode() == ServerData.ServerResourceMode.ENABLED)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), this.createDownloadCallback());
            }
            else if (serverdata != null && serverdata.getResourceMode() != ServerData.ServerResourceMode.PROMPT)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
            }
            else
            {
                this.gameController.addScheduledTask(new Runnable()
                {
                    public void run()
                    {
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                        {
                            public void confirmClicked(boolean result, int id)
                            {
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
                                ServerData serverdata1 = NetHandlerPlayClient.this.gameController.getCurrentServerData();

                                if (result)
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.ENABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), NetHandlerPlayClient.this.createDownloadCallback());
                                }
                                else
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.DISABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
                                }

                                ServerList.saveSingleServer(serverdata1);
                                NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                            }
                        }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
                    }
                });
            }
        }
    }
}
项目:CustomWorldGen    文件:GuiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}
项目:Coherence    文件:UiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf var2 = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int var3 = var2.readInt();
            GuiScreen var4 = this.gameController.currentScreen;

            if (var4 != null && var4 instanceof GuiMerchant && var3 == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant var5 = ((GuiMerchant)var4).func_147035_g();
                MerchantRecipeList var6 = MerchantRecipeList.func_151390_b(new PacketBuffer(var2));
                var5.setRecipes(var6);
            }
        }
        catch (IOException var7)
        {
            logger.error("Couldn\'t load trade info", var7);
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String var8 = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.gameSettings.serverTextures)
        {
            if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_147408_b())
            {
                this.gameController.getResourcePackRepository().func_148526_a(var8);
            }
            else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_147410_c())
            {
                this.gameController.displayGuiScreen(new GuiYesNo(new GuiScreen()
                {
                    private static final String __OBFID = "CL_00000879";
                    public void confirmClicked(boolean par1, int par2)
                    {
                        this.mc = Minecraft.getMinecraft();

                        if (this.mc.func_147104_D() != null)
                        {
                            this.mc.func_147104_D().setAcceptsTextures(par1);
                            ServerList.func_147414_b(this.mc.func_147104_D());
                        }

                        if (par1)
                        {
                            this.mc.getResourcePackRepository().func_148526_a(var8);
                        }

                        this.mc.displayGuiScreen((GuiScreen)null);
                    }
                }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
            }
        }
    }
}
项目:Resilience-Client-Source    文件:GuiMultiplayer.java   
public ServerList func_146795_p()
{
    return this.field_146804_i;
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handleResourcePack(SPacketResourcePackSend packetIn)
{
    final String s = packetIn.getURL();
    final String s1 = packetIn.getHash();

    if (this.func_189688_b(s))
    {
        if (s.startsWith("level://"))
        {
            String s2 = s.substring("level://".length());
            File file1 = new File(this.gameController.mcDataDir, "saves");
            File file2 = new File(file1, s2);

            if (file2.isFile())
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), this.func_189686_f());
            }
            else
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
            }
        }
        else
        {
            ServerData serverdata = this.gameController.getCurrentServerData();

            if (serverdata != null && serverdata.getResourceMode() == ServerData.ServerResourceMode.ENABLED)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), this.func_189686_f());
            }
            else if (serverdata != null && serverdata.getResourceMode() != ServerData.ServerResourceMode.PROMPT)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
            }
            else
            {
                this.gameController.addScheduledTask(new Runnable()
                {
                    public void run()
                    {
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                        {
                            public void confirmClicked(boolean result, int id)
                            {
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
                                ServerData serverdata1 = NetHandlerPlayClient.this.gameController.getCurrentServerData();

                                if (result)
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.ENABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), NetHandlerPlayClient.this.func_189686_f());
                                }
                                else
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.DISABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
                                }

                                ServerList.saveSingleServer(serverdata1);
                                NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                            }
                        }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
                    }
                });
            }
        }
    }
}
项目:ExpandedRailsMod    文件:GuiMultiplayer.java   
public ServerList getServerList()
{
    return this.savedServerList;
}