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

项目:Backmemed    文件:GuiScreenAddServer.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 2)
        {
            this.serverData.setResourceMode(ServerData.ServerResourceMode.values()[(this.serverData.getResourceMode().ordinal() + 1) % ServerData.ServerResourceMode.values().length]);
            this.serverResourcePacks.displayString = I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText();
        }
        else if (button.id == 1)
        {
            this.parentScreen.confirmClicked(false, 0);
        }
        else if (button.id == 0)
        {
            this.serverData.serverName = this.serverNameField.getText();
            this.serverData.serverIP = this.serverIPField.getText();
            this.parentScreen.confirmClicked(true, 0);
        }
    }
}
项目:DecompiledMinecraft    文件:GuiScreenAddServer.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 2)
        {
            this.serverData.setResourceMode(ServerData.ServerResourceMode.values()[(this.serverData.getResourceMode().ordinal() + 1) % ServerData.ServerResourceMode.values().length]);
            this.serverResourcePacks.displayString = I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText();
        }
        else if (button.id == 1)
        {
            this.parentScreen.confirmClicked(false, 0);
        }
        else if (button.id == 0)
        {
            this.serverData.serverName = this.serverNameField.getText();
            this.serverData.serverIP = this.serverIPField.getText();
            this.parentScreen.confirmClicked(true, 0);
        }
    }
}
项目:Wurst-MC-1.12-OF    文件:ServerHook.java   
public static int getProtocolVersion()
{
    if(WurstClient.INSTANCE.options.mc112x_compatibility == 2)
        return 340;
    else if(WurstClient.INSTANCE.options.mc112x_compatibility == 1)
        return 338;

    NavigableMap<Integer, String> protocols = WMinecraft.PROTOCOLS;

    // use default if using Wurst-Bot
    if(WurstBot.isEnabled())
        return protocols.lastKey();

    ServerData server = lastServer.getServerData();

    // use default if ping failed
    if(!server.pinged || server.pingToServer < 0)
        return protocols.lastKey();

    // use default if server protocol is not supported
    if(!protocols.containsKey(server.version))
        return protocols.lastKey();

    // use server protocol
    return server.version;
}
项目:Wurst-MC-1.12    文件:ServerHook.java   
public static int getProtocolVersion()
{
    if(WurstClient.INSTANCE.options.mc112x_compatibility == 2)
        return 340;
    else if(WurstClient.INSTANCE.options.mc112x_compatibility == 1)
        return 338;

    NavigableMap<Integer, String> protocols = WMinecraft.PROTOCOLS;

    // use default if using Wurst-Bot
    if(WurstBot.isEnabled())
        return protocols.lastKey();

    ServerData server = lastServer.getServerData();

    // use default if ping failed
    if(!server.pinged || server.pingToServer < 0)
        return protocols.lastKey();

    // use default if server protocol is not supported
    if(!protocols.containsKey(server.version))
        return protocols.lastKey();

    // use server protocol
    return server.version;
}
项目:Wurst-MC-1.12    文件:JoinCmd.java   
@Override
public void execute(String[] args) throws CmdError
{
    if(args.length != 1)
        syntaxError();

    Minecraft mc = Minecraft.getMinecraft();

    mc.addScheduledTask(() -> {

        mc.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(), mc,
            new ServerData("", args[0], false)));

        System.out.println(
            "Joined " + args[0] + " as " + mc.session.getUsername());
    });
}
项目:BaseClient    文件:GuiScreenAddServer.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 2)
        {
            this.serverData.setResourceMode(ServerData.ServerResourceMode.values()[(this.serverData.getResourceMode().ordinal() + 1) % ServerData.ServerResourceMode.values().length]);
            this.serverResourcePacks.displayString = I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText();
        }
        else if (button.id == 1)
        {
            this.parentScreen.confirmClicked(false, 0);
        }
        else if (button.id == 0)
        {
            this.serverData.serverName = this.serverNameField.getText();
            this.serverData.serverIP = this.serverIPField.getText();
            this.parentScreen.confirmClicked(true, 0);
        }
    }
}
项目:CustomWorldGen    文件:GuiScreenAddServer.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 2)
        {
            this.serverData.setResourceMode(ServerData.ServerResourceMode.values()[(this.serverData.getResourceMode().ordinal() + 1) % ServerData.ServerResourceMode.values().length]);
            this.serverResourcePacks.displayString = I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText();
        }
        else if (button.id == 1)
        {
            this.parentScreen.confirmClicked(false, 0);
        }
        else if (button.id == 0)
        {
            this.serverData.serverName = this.serverNameField.getText();
            this.serverData.serverIP = this.serverIPField.getText();
            this.parentScreen.confirmClicked(true, 0);
        }
    }
}
项目:ServerObserver    文件:GuiHandler.java   
public ServerData get(final GuiMultiplayer mpgui) {
    final String targetServerIP = Config.getConfig().targetServerIP.get();
    if (mpgui!=this.mpgui_cache||!StringUtils.equals(this.targetIP_cache, targetServerIP)) {
        this.target = getServerData(mpgui, getTarget(mpgui, this.targetIP_cache = targetServerIP));
        this.mpgui_cache = mpgui;
    }
    return this.target;
}
项目:CreeperHostGui    文件:CreeperHostServerSelectionList.java   
public void replaceList(List list)
{
    if (ourList == list)
        return;
    ourList = list;
    ourList.add(new CreeperHostEntry(ourParent, new ServerData("", "127.0.0.1", false), true));
}
项目:CreeperHostGui    文件:CreeperHostEntry.java   
protected CreeperHostEntry(GuiMultiplayer p_i45048_1_, ServerData serverIn)
{
    super(p_i45048_1_, serverIn);
    ourMP = p_i45048_1_;
    serverIcon = Config.getInstance().isServerHostMenuImage() ? CreeperHost.instance.getImplementation().getMenuIcon() : new ResourceLocation("creeperhost", "textures/nobrandmp.png");
    cross = new String(Character.toChars(10006));
    stringWidth = this.mc.fontRendererObj.getStringWidth(cross);
}
项目:ServerObserver    文件:GuiHandler.java   
private int getTarget(final GuiMultiplayer mpgui, final String serverIP) {
    final int count = this.compat.countServers(mpgui);
    for (int i = 0; i<count; i++) {
        final ServerData serverData = this.compat.getServerData(mpgui, i);
        if (StringUtils.equals(serverIP, serverData.serverIP))
            return i;
    }
    return -1;
}
项目:DecompiledMinecraft    文件:GuiMultiplayer.java   
public void connectToSelected()
{
    GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k());

    if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
    {
        this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData());
    }
    else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected)
    {
        LanServerDetector.LanServer lanserverdetector$lanserver = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getLanServer();
        this.connectToServer(new ServerData(lanserverdetector$lanserver.getServerMotd(), lanserverdetector$lanserver.getServerIpPort(), true));
    }
}
项目:Backmemed    文件:ServerListEntryNormal.java   
protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData serverIn)
{
    this.owner = p_i45048_1_;
    this.server = serverIn;
    this.mc = Minecraft.getMinecraft();
    this.serverIcon = new ResourceLocation("servers/" + serverIn.serverIP + "/icon");
    this.icon = (DynamicTexture)this.mc.getTextureManager().getTexture(this.serverIcon);
}
项目:Wurst-MC-1.12-OF    文件:ServerHook.java   
public static void updateLastServerFromDirectConnect(
    GuiMultiplayer guiMultiplayer, ServerData serverData)
{
    currentServerIP = serverData.serverIP;
    if(!currentServerIP.contains(":"))
        currentServerIP += ":25565";

    lastServer = new ServerListEntryNormal(guiMultiplayer, serverData);
}
项目:Wurst-MC-1.12    文件:ServerHook.java   
public static void updateLastServerFromDirectConnect(
    GuiMultiplayer guiMultiplayer, ServerData serverData)
{
    currentServerIP = serverData.serverIP;
    if(!currentServerIP.contains(":"))
        currentServerIP += ":25565";

    lastServer = new ServerListEntryNormal(guiMultiplayer, serverData);
}
项目:SerenityCE    文件:Volkswagen.java   
private String getServerIP() {
    ServerData serverData = mc.getCurrentServerData();

    if (serverData == null) {
        return null;
    }

    return serverData.serverIP;
}
项目:Wurst-MC-1.12    文件:WurstServerPinger.java   
public void ping(final String ip, final int port)
{
    server = new ServerData("", ip + ":" + port, false);
    new Thread("Wurst Server Connector #" + threadNumber.incrementAndGet())
    {
        @Override
        public void run()
        {
            ServerPinger pinger = new ServerPinger();
            try
            {
                logger.info("Pinging " + ip + ":" + port + "...");
                pinger.ping(server);
                logger.info("Ping successful: " + ip + ":" + port);
            }catch(UnknownHostException e)
            {
                logger.info("Unknown host: " + ip + ":" + port);
                failed = true;
            }catch(Exception e2)
            {
                logger.info("Ping failed: " + ip + ":" + port);
                failed = true;
            }
            pinger.clearPendingNetworks();
            done = true;
        }
    }.start();
}
项目:ServerObserver    文件:GuiHandler.java   
public void set(final ServerData serverData) {
    if (serverData==null) {
        setIP(null);
        this.target = null;
        Config.getConfig().save();
    } else {
        setIP(serverData.serverIP);
        this.target = serverData;
    }
}
项目:BaseClient    文件:ServerListEntryNormal.java   
protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData p_i45048_2_)
{
    this.field_148303_c = p_i45048_1_;
    this.field_148301_e = p_i45048_2_;
    this.mc = Minecraft.getMinecraft();
    this.field_148306_i = new ResourceLocation("servers/" + p_i45048_2_.serverIP + "/icon");
    this.field_148305_h = (DynamicTexture)this.mc.getTextureManager().getTexture(this.field_148306_i);
}
项目:BaseClient    文件:GuiMultiplayer.java   
public void connectToSelected()
{
    GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k());

    if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
    {
        this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData());
    }
    else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected)
    {
        LanServerDetector.LanServer lanserverdetector$lanserver = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getLanServer();
        this.connectToServer(new ServerData(lanserverdetector$lanserver.getServerMotd(), lanserverdetector$lanserver.getServerIpPort(), true));
    }
}
项目:CustomWorldGen    文件:ServerListEntryNormal.java   
protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData serverIn)
{
    this.owner = p_i45048_1_;
    this.server = serverIn;
    this.mc = Minecraft.getMinecraft();
    this.serverIcon = new ResourceLocation("servers/" + serverIn.serverIP + "/icon");
    this.icon = (DynamicTexture)this.mc.getTextureManager().getTexture(this.serverIcon);
}
项目:CustomWorldGen    文件:GuiMultiplayer.java   
public void connectToSelected()
{
    GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.getSelected() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.getSelected());

    if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
    {
        this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData());
    }
    else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected)
    {
        LanServerInfo lanserverinfo = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getServerData();
        this.connectToServer(new ServerData(lanserverinfo.getServerMotd(), lanserverinfo.getServerIpPort(), true));
    }
}
项目:BaseClient    文件:ServerListEntryNormal.java   
protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData p_i45048_2_)
{
    this.field_148303_c = p_i45048_1_;
    this.field_148301_e = p_i45048_2_;
    this.mc = Minecraft.getMinecraft();
    this.field_148306_i = new ResourceLocation("servers/" + p_i45048_2_.serverIP + "/icon");
    this.field_148305_h = (DynamicTexture)this.mc.getTextureManager().getTexture(this.field_148306_i);
}
项目:SerenityCE    文件:Waypoints.java   
private void setupNew() {
    ServerData sd = mc.getCurrentServerData();
    if (sd != null) {
        this.config = new JSONConfiguration(String.format("/waypoints/%s.json", sd.serverIP.replace(":", "_")));
        this.load();
    } else {
        waypoints = new ArrayList<>();
    }
}
项目:BaseClient    文件:GuiMultiplayer.java   
public void connectToSelected()
{
    GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k());

    if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
    {
        this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData());
    }
    else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected)
    {
        LanServerDetector.LanServer lanserverdetector$lanserver = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getLanServer();
        this.connectToServer(new ServerData(lanserverdetector$lanserver.getServerMotd(), lanserverdetector$lanserver.getServerIpPort(), true));
    }
}
项目:EMC    文件:IMinecraft.java   
public synchronized static IServerData getCurrentServer() {
    if (Minecraft.getMinecraft().getCurrentServerData() == null) {
        return null;
    }
    if (iServerCache != null && Minecraft.getMinecraft().getCurrentServerData() != null) {
        if (iServerCache.serverIP.equals(Minecraft.getMinecraft().getCurrentServerData().serverIP)) {
            return iServerCache;
        }
    }
    ServerData sd = Minecraft.getMinecraft().getCurrentServerData();
    iServerCache = new IServerData(sd.serverName, sd.serverIP, sd.isOnLAN());
    iServerCache.gameVersion = sd.gameVersion;
    return iServerCache;
}
项目:CustomWorldGen    文件:FMLClientHandler.java   
public void connectToServer(GuiScreen guiMultiplayer, ServerData serverEntry)
{
    ExtendedServerListData extendedData = serverDataTag.get(serverEntry);
    if (extendedData != null && extendedData.isBlocked)
    {
        showGuiScreen(new GuiAccessDenied(guiMultiplayer, serverEntry));
    }
    else
    {
        showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry));
    }
}
项目:Backmemed    文件:GuiMultiplayer.java   
public void connectToSelected()
{
    GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.getSelected() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.getSelected());

    if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
    {
        this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData());
    }
    else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected)
    {
        LanServerInfo lanserverinfo = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getServerData();
        this.connectToServer(new ServerData(lanserverinfo.getServerMotd(), lanserverinfo.getServerIpPort(), true));
    }
}
项目:ServerObserver    文件:GuiHandler.java   
private ServerData getServerData(final GuiMultiplayer mpgui, final int index) {
    if (index<0)
        return null;
    final IGuiListEntry guilistextended$iguilistentry = this.compat.getListEntry(mpgui, index);
    if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
        return this.compat.getServerData((ServerListEntryNormal) guilistextended$iguilistentry);
    return null;
}
项目:ServerObserver    文件:Compat.java   
@Override
public void connectToServer(final GuiMultiplayer mpgui, final ServerData serverData) {
    mpgui.func_146791_a(serverData);
}
项目:ClientAPI    文件:ServerEvent.java   
/**
 * @return Server being connected/disconnected to/from
 */
public final ServerData getServerData() {
    return this.serverData;
}
项目:ClientAPI    文件:ServerEvent.java   
public Disconnect(EventState state, boolean forced, ServerData serverData) {
    super(serverData);
    this.state = state;
    this.forced = forced;
}
项目:CreeperHostGui    文件:CreeperHostServerHost.java   
@Override
public ServerData getServerEntry(Order order)
{
    return new ServerData(order.name + ".PlayAt.CH", order.name + ".playat.ch", false);
}
项目:CreeperHostGui    文件:ServerListNoEdit.java   
@Override
public void addServerData(ServerData p_78849_1_)
{
    servers.add(p_78849_1_ instanceof ServerDataPublic);
    super.addServerData(p_78849_1_);
}
项目:CreeperHostGui    文件:ServerListEntryNormalPubConstructor.java   
public ServerListEntryNormalPubConstructor(GuiMultiplayer p_i45048_1_, ServerData serverIn)
{
    super(p_i45048_1_, serverIn);
}
项目:CreeperHostGui    文件:ServerListPublic.java   
@Override
public void addServerData(ServerData server)
{
    this.servers.add((ServerDataPublic) server);
}
项目:CreeperHostGui    文件:ServerListPublic.java   
@Override
public void func_147413_a(int index, ServerData server)
{
}
项目:CreeperHostGui    文件:MockServerListEntryNormal.java   
protected MockServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData serverIn)
{
    super(p_i45048_1_, serverIn);
}
项目:ServerObserver    文件:Compat.java   
@Override
public boolean getPinged(final ServerData serverData) {
    return serverData.pinged;
}
项目: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));
}