當前位置: 首頁>>代碼示例>>Java>>正文


Java FMLEmbeddedChannel.findChannelHandlerNameForType方法代碼示例

本文整理匯總了Java中cpw.mods.fml.common.network.FMLEmbeddedChannel.findChannelHandlerNameForType方法的典型用法代碼示例。如果您正苦於以下問題:Java FMLEmbeddedChannel.findChannelHandlerNameForType方法的具體用法?Java FMLEmbeddedChannel.findChannelHandlerNameForType怎麽用?Java FMLEmbeddedChannel.findChannelHandlerNameForType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cpw.mods.fml.common.network.FMLEmbeddedChannel的用法示例。


在下文中一共展示了FMLEmbeddedChannel.findChannelHandlerNameForType方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNewChannelHandler

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
private EnumMap<Side, FMLEmbeddedChannel> getNewChannelHandler()
{

    EnumMap<Side, FMLEmbeddedChannel> handlers = NetworkRegistry.INSTANCE.newChannel(ID, handler);

    ChannelHandler.PacketExecuter executer = new ChannelHandler.PacketExecuter();

    for(Map.Entry<Side, FMLEmbeddedChannel> e : handlers.entrySet())
    {
        FMLEmbeddedChannel channel = e.getValue();
        String codec = channel.findChannelHandlerNameForType(ChannelHandler.class);
        channel.pipeline().addAfter(codec, "PacketExecuter", executer);
    }

    return handlers;
}
 
開發者ID:tm1990,項目名稱:MiscUtils,代碼行數:17,代碼來源:ChannelUtils.java

示例2: registerMessage

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
/**
 * Register a message and it's associated handler. The message will have the supplied discriminator byte. The message handler will
 * be registered on the supplied side (this is the side where you want the message to be processed and acted upon).
 *
 * @param messageHandler the message handler instance
 * @param requestMessageType the message type
 * @param discriminator a discriminator byte
 * @param side the side for the handler
 */
public <REQ extends IMessage, REPLY extends IMessage> void registerMessage(IMessageHandler<? super REQ, ? extends REPLY> messageHandler, Class<REQ> requestMessageType, int discriminator, Side side)
{
    packetCodec.addDiscriminator(discriminator, requestMessageType);
    FMLEmbeddedChannel channel = channels.get(side);
    String type = channel.findChannelHandlerNameForType(SimpleIndexedCodec.class);
    if (side == Side.SERVER)
    {
        addServerHandlerAfter(channel, type, messageHandler, requestMessageType);
    }
    else
    {
        addClientHandlerAfter(channel, type, messageHandler, requestMessageType);
    }
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:24,代碼來源:SimpleNetworkWrapper.java

示例3: registerChannel

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
public static void registerChannel(ForgeModContainer forgeModContainer, Side side)
{
    channelPair = NetworkRegistry.INSTANCE.newChannel(forgeModContainer, "FORGE", new ForgeRuntimeCodec());
    if (side == Side.CLIENT)
    {
        addClientHandlers();
    }

    FMLEmbeddedChannel serverChannel = channelPair.get(Side.SERVER);
    serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);
    String handlerName = serverChannel.findChannelHandlerNameForType(ForgeRuntimeCodec.class);
    serverChannel.pipeline().addAfter(handlerName, "ServerToClientConnection", new ServerToClientConnectionEstablishedHandler());
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:14,代碼來源:ForgeNetworkHandler.java

示例4: addClientHandlers

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
private static void addClientHandlers()
{
    FMLEmbeddedChannel clientChannel = channelPair.get(Side.CLIENT);
    String handlerName = clientChannel.findChannelHandlerNameForType(ForgeRuntimeCodec.class);
    clientChannel.pipeline().addAfter(handlerName, "DimensionHandler", new DimensionMessageHandler());
    clientChannel.pipeline().addAfter(handlerName, "FluidIdRegistryHandler", new FluidIdRegistryMessageHandler());
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:9,代碼來源:ForgeNetworkHandler.java

示例5: registerMessage

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
/**
 * Register a message and it's associated handler. The message will have the supplied discriminator byte. The message handler will
 * be registered on the supplied side (this is the side where you want the message to be processed and acted upon).
 *
 * @param messageHandler the message handler type
 * @param requestMessageType the message type
 * @param discriminator a discriminator byte
 * @param side the side for the handler
 */
public <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType, int discriminator, Side side)
{
    packetCodec.addDiscriminator(discriminator, requestMessageType);
    FMLEmbeddedChannel channel = channels.get(side);
    String type = channel.findChannelHandlerNameForType(SimpleIndexedCodec.class);
    if (side == Side.SERVER)
    {
        addServerHandlerAfter(channel, type, messageHandler, requestMessageType);
    }
    else
    {
        addClientHandlerAfter(channel, type, messageHandler, requestMessageType);
    }
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:24,代碼來源:SimpleNetworkWrapper.java

示例6: setClientHandler

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public void setClientHandler(SimpleChannelInboundHandler<T> handler) {
	FMLEmbeddedChannel channel = channels.get(Side.CLIENT);
	String codecName = channel.findChannelHandlerNameForType(codec.getClass());
	if(handlers.get(Side.CLIENT) != null) {
        channel.pipeline().remove("ClientHandler");
	}
       channel.pipeline().addAfter(codecName, "ClientHandler", handler);
       handlers.put(Side.CLIENT, handler);
}
 
開發者ID:ElConquistador,項目名稱:ElConQore,代碼行數:11,代碼來源:EQPacketHandler.java

示例7: setServerHandler

import cpw.mods.fml.common.network.FMLEmbeddedChannel; //導入方法依賴的package包/類
public void setServerHandler(SimpleChannelInboundHandler<T> handler) {		
	FMLEmbeddedChannel channel = channels.get(Side.SERVER);
	String codecName = channel.findChannelHandlerNameForType(codec.getClass());
	if(handlers.get(Side.SERVER) != null) {
        channel.pipeline().remove("ServerHandler");
	}
       channel.pipeline().addAfter(codecName, "ServerHandler", handler);
       handlers.put(Side.SERVER, handler);
}
 
開發者ID:ElConquistador,項目名稱:ElConQore,代碼行數:10,代碼來源:EQPacketHandler.java


注:本文中的cpw.mods.fml.common.network.FMLEmbeddedChannel.findChannelHandlerNameForType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。