当前位置: 首页>>代码示例>>Java>>正文


Java ServerData类代码示例

本文整理汇总了Java中net.minecraft.client.multiplayer.ServerData的典型用法代码示例。如果您正苦于以下问题:Java ServerData类的具体用法?Java ServerData怎么用?Java ServerData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerData类属于net.minecraft.client.multiplayer包,在下文中一共展示了ServerData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
/**
 * 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);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:GuiScreenAddServer.java

示例2: getProtocolVersion

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12-OF,代码行数:27,代码来源:ServerHook.java

示例3: execute

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
@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());
	});
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:18,代码来源:JoinCmd.java

示例4: get

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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;
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:9,代码来源:GuiHandler.java

示例5: replaceList

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
public void replaceList(List list)
{
    if (ourList == list)
        return;
    ourList = list;
    ourList.add(new CreeperHostEntry(ourParent, new ServerData("", "127.0.0.1", false), true));
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:8,代码来源:CreeperHostServerSelectionList.java

示例6: CreeperHostEntry

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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);
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:9,代码来源:CreeperHostEntry.java

示例7: getTarget

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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;
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:10,代码来源:GuiHandler.java

示例8: connectToSelected

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:GuiMultiplayer.java

示例9: ServerListEntryNormal

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:ServerListEntryNormal.java

示例10: updateLastServerFromDirectConnect

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
public static void updateLastServerFromDirectConnect(
	GuiMultiplayer guiMultiplayer, ServerData serverData)
{
	currentServerIP = serverData.serverIP;
	if(!currentServerIP.contains(":"))
		currentServerIP += ":25565";
	
	lastServer = new ServerListEntryNormal(guiMultiplayer, serverData);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12-OF,代码行数:10,代码来源:ServerHook.java

示例11: getServerIP

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
private String getServerIP() {
    ServerData serverData = mc.getCurrentServerData();

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

    return serverData.serverIP;
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:10,代码来源:Volkswagen.java

示例12: ping

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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();
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:29,代码来源:WurstServerPinger.java

示例13: set

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
public void set(final ServerData serverData) {
	if (serverData==null) {
		setIP(null);
		this.target = null;
		Config.getConfig().save();
	} else {
		setIP(serverData.serverIP);
		this.target = serverData;
	}
}
 
开发者ID:Team-Fruit,项目名称:ServerObserver,代码行数:11,代码来源:GuiHandler.java

示例14: ServerListEntryNormal

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:ServerListEntryNormal.java

示例15: connectToSelected

import net.minecraft.client.multiplayer.ServerData; //导入依赖的package包/类
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));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:GuiMultiplayer.java


注:本文中的net.minecraft.client.multiplayer.ServerData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。