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


Java NetClientHandler类代码示例

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


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

示例1: connectionOpened

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
	System.out.println("Hello !");
	if (netClientHandler instanceof NetClientHandler)
	{
		NetClientHandler nch = (NetClientHandler) netClientHandler;
		INetworkManager netmanager = nch.getNetManager();
		
		System.out.println("Hello 2 !");
		
		if (netmanager instanceof TcpConnection)
		{
			System.out.println("Hello 3 !");
			((TcpConnection) netmanager).setNetHandler(new WDLNetClientHandler(nch));
		}
	}
}
 
开发者ID:xurei,项目名称:forge_world_downloader,代码行数:19,代码来源:WDLConnectionHandler.java

示例2: handleClientPacket

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void handleClientPacket(NetClientHandler handler, short id, byte[] data)
{
	DataInputStream stream = new DataInputStream(new ByteArrayInputStream(data));
	try
	{
		switch(id)
		{
			case 0:
			{
				stream.readByte();
				break;
			}
		}
	}
	catch(IOException e)
	{
	}
}
 
开发者ID:iChun,项目名称:MobVsMob,代码行数:20,代码来源:MapPacketHandler.java

示例3: getWorld

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
/**
 * Retrieves the world object with NetHandler parameters.
 * 
 * @return Minecraft world object.
 */
@Override
public World getWorld(NetHandler handler) {
    if (handler instanceof NetClientHandler) {
        return ((NetClientHandler) handler).getPlayer().worldObj;
    }
    return null;
}
 
开发者ID:SlimeVoid,项目名称:WirelessRedstone-Addons,代码行数:13,代码来源:PowerDirectorClientProxy.java

示例4: onGuiClosed

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetClientHandler netclienthandler = this.mc.getNetHandler();

    if (MinecraftServer.getServer().isSinglePlayer())
    {
        MiscHelper.setPersistentDataTag(MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(MinecraftServer.getServer().getServerOwner()), BSConstants.NBT_PLAYER_GRAVE_DATA, data);
    }
    else if (netclienthandler != null)
    {
        PacketDispatcher.sendPacketToServer(NetworkHelper.makeNBTPacket(BSConstants.CHANNEL_GRAVE_UPGRADE, data));
    }
}
 
开发者ID:CCM-Modding,项目名称:CcmBurialServicesInc,代码行数:15,代码来源:GraveUpgradeGui.java

示例5: handleMapChunk

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
public void handleMapChunk(Packet51MapChunk mapChunk)
{
	if (wc == null)
	{
		wc = (WorldClient)Reflexion.stealField(NetClientHandler.class, WorldClient.class).get(nch);
	}
	
	if (mapChunk.includeInitialize)
	{
		if (mapChunk.yChMin == 0)
		{
			doPreChunk(mapChunk.xCh, mapChunk.zCh, false);
			return;
		}

		doPreChunk(mapChunk.xCh, mapChunk.zCh, true);
	}

	wc.invalidateBlockReceiveRegion(mapChunk.xCh << 4, 0, mapChunk.zCh << 4, (mapChunk.xCh << 4) + 15, 256, (mapChunk.zCh << 4) + 15);
	Chunk chunk = wc.getChunkFromChunkCoords(mapChunk.xCh, mapChunk.zCh);

	if (mapChunk.includeInitialize && chunk == null)
	{
		doPreChunk(mapChunk.xCh, mapChunk.zCh, true);
		chunk = wc.getChunkFromChunkCoords(mapChunk.xCh, mapChunk.zCh);
	}

	if (chunk != null)
	{
		chunk.fillChunk(mapChunk.getCompressedChunkData(), mapChunk.yChMin, mapChunk.yChMax, mapChunk.includeInitialize);
		wc.markBlockRangeForRenderUpdate(mapChunk.xCh << 4, 0, mapChunk.zCh << 4, (mapChunk.xCh << 4) + 15, 256, (mapChunk.zCh << 4) + 15);

		if (!mapChunk.includeInitialize || !(wc.provider instanceof WorldProviderSurface))
		{
			chunk.resetRelightChecks();
		}
	}
}
 
开发者ID:xurei,项目名称:forge_world_downloader,代码行数:39,代码来源:WDLNetClientHandler.java

示例6: handleMapChunks

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
@Override
public void handleMapChunks(Packet56MapChunks par1Packet56MapChunks)
{
	if (wc == null)
	{
		wc = (WorldClient)Reflexion.stealField(NetClientHandler.class, WorldClient.class).get(nch);
	}
	
	//nch.handleMapChunks(par1Packet56MapChunks);
	for (int i = 0; i < par1Packet56MapChunks.getNumberOfChunkInPacket(); ++i)
	{
		int j = par1Packet56MapChunks.getChunkPosX(i);
		int k = par1Packet56MapChunks.getChunkPosZ(i);
		doPreChunk(j, k, true);
		wc.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15);
		Chunk chunk = wc.getChunkFromChunkCoords(j, k);

		if (chunk == null)
		{
			doPreChunk(j, k, true);
			chunk = wc.getChunkFromChunkCoords(j, k);
		}

		if (chunk != null)
		{
			chunk.fillChunk(par1Packet56MapChunks.getChunkCompressedData(i), par1Packet56MapChunks.field_73590_a[i], par1Packet56MapChunks.field_73588_b[i], true);
			wc.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15);

			if (!(wc.provider instanceof WorldProviderSurface))
			{
					chunk.resetRelightChecks();
			}
		}
	}
}
 
开发者ID:xurei,项目名称:forge_world_downloader,代码行数:36,代码来源:WDLNetClientHandler.java

示例7: disconnectIDMismatch

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).func_72553_e();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r);
    // pulse the network manager queue to clear cruft
    mgr.func_74428_b();
    // Nuke the world client
    client.func_71403_a((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:30,代码来源:FMLClientHandler.java

示例8: clientConnectionClosed

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
@Override
public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod)
{
    if (managerLookups.containsKey(manager))
    {
        ((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager));
        return true;
    }
    return false;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:ModLoaderClientHelper.java

示例9: clientConnect

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
/**
 * Called when a client connects
 * @param handler
 */
@SideOnly(CLIENT)
@Deprecated
public void clientConnect(NetClientHandler handler)
{

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:BaseMod.java

示例10: clientDisconnect

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
/**
 * Called when the client disconnects
 * @param handler
 */
@SideOnly(CLIENT)
@Deprecated
public void clientDisconnect(NetClientHandler handler)
{

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:BaseMod.java

示例11: WorldClient

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
public WorldClient(NetClientHandler p_i1188_1_, WorldSettings p_i1188_2_, int p_i1188_3_, int p_i1188_4_, Profiler p_i1188_5_, ILogAgent p_i1188_6_) {
   super(new SaveHandlerMP(), "MpServer", WorldProvider.func_76570_a(p_i1188_3_), p_i1188_2_, p_i1188_5_, p_i1188_6_);
   this.field_73035_a = p_i1188_1_;
   this.field_73013_u = p_i1188_4_;
   this.func_72950_A(8, 64, 8);
   this.field_72988_C = p_i1188_1_.field_72558_b;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:8,代码来源:WorldClient.java

示例12: run

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
public void run() {
   try {
      GuiConnecting.func_74252_a(this.field_78820_c, new NetClientHandler(GuiConnecting.func_74256_a(this.field_78820_c), this.field_78821_a, this.field_78819_b));
      if(GuiConnecting.func_74257_b(this.field_78820_c)) {
         return;
      }

      GuiConnecting.func_74253_d(this.field_78820_c).func_72552_c(new Packet2ClientProtocol(78, GuiConnecting.func_74254_c(this.field_78820_c).func_110432_I().func_111285_a(), this.field_78821_a, this.field_78819_b));
   } catch (UnknownHostException var2) {
      if(GuiConnecting.func_74257_b(this.field_78820_c)) {
         return;
      }

      GuiConnecting.func_74250_f(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.field_78821_a + "\'"}));
   } catch (ConnectException var3) {
      if(GuiConnecting.func_74257_b(this.field_78820_c)) {
         return;
      }

      GuiConnecting.func_74251_g(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()}));
   } catch (Exception var4) {
      if(GuiConnecting.func_74257_b(this.field_78820_c)) {
         return;
      }

      var4.printStackTrace();
      GuiConnecting.func_98096_h(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{var4.toString()}));
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:31,代码来源:ThreadConnectToServer.java

示例13: func_73874_b

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
public void func_73874_b() {
   Keyboard.enableRepeatEvents(false);
   NetClientHandler var1 = this.field_73882_e.func_71391_r();
   if(var1 != null) {
      var1.func_72552_c(new Packet130UpdateSign(this.field_73982_c.field_70329_l, this.field_73982_c.field_70330_m, this.field_73982_c.field_70327_n, this.field_73982_c.field_70412_a));
   }

   this.field_73982_c.func_70408_a(true);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:10,代码来源:GuiEditSign.java

示例14: run

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
public void run() {
   try {
      TaskOnlineConnect.func_96583_a(this.field_96594_c, new NetClientHandler(this.field_96594_c.func_96578_b(), this.field_96595_a, this.field_96593_b, TaskOnlineConnect.func_98172_a(this.field_96594_c)));
      if(this.field_96594_c.func_96577_c()) {
         return;
      }

      this.field_96594_c.func_96576_b(I18n.func_135053_a("mco.connect.authorizing"));
      TaskOnlineConnect.func_96580_a(this.field_96594_c).func_72552_c(new Packet2ClientProtocol(78, this.field_96594_c.func_96578_b().func_110432_I().func_111285_a(), this.field_96595_a, this.field_96593_b));
   } catch (UnknownHostException var2) {
      if(this.field_96594_c.func_96577_c()) {
         return;
      }

      this.field_96594_c.func_96578_b().func_71373_a(new GuiScreenDisconnectedOnline(TaskOnlineConnect.func_98172_a(this.field_96594_c), "connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.field_96595_a + "\'"}));
   } catch (ConnectException var3) {
      if(this.field_96594_c.func_96577_c()) {
         return;
      }

      this.field_96594_c.func_96578_b().func_71373_a(new GuiScreenDisconnectedOnline(TaskOnlineConnect.func_98172_a(this.field_96594_c), "connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()}));
   } catch (Exception var4) {
      if(this.field_96594_c.func_96577_c()) {
         return;
      }

      var4.printStackTrace();
      this.field_96594_c.func_96578_b().func_71373_a(new GuiScreenDisconnectedOnline(TaskOnlineConnect.func_98172_a(this.field_96594_c), "connect.failed", "disconnect.genericReason", new Object[]{var4.toString()}));
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:32,代码来源:ThreadOnlineConnect.java

示例15: disconnectIDMismatch

import net.minecraft.client.multiplayer.NetClientHandler; //导入依赖的package包/类
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).disconnect();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.currentScreen);
    // pulse the network manager queue to clear cruft
    mgr.processReadPackets();
    // Nuke the world client
    client.loadWorld((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:30,代码来源:FMLClientHandler.java


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