Java 类cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget 实例源码

项目:TRHS_Club_Mod_2016    文件:FMLNetworkHandler.java   
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
{
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
    embeddedChannel.writeOutbound(new FMLMessage.EntityAdjustMessage(entity, serverX, serverY, serverZ));
}
项目:TRHS_Club_Mod_2016    文件:FMLNetworkHandler.java   
public static void registerChannel(FMLContainer container, Side side)
{
    channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler());
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);

    if (side == Side.CLIENT)
    {
        addClientHandlers();
    }
}
项目:TRHS_Club_Mod_2016    文件:NetworkRegistry.java   
/**
 * INTERNAL fire a handshake to all channels
 * @param networkDispatcher The dispatcher firing
 * @param origin which side the dispatcher is on
 */
public void fireNetworkHandshake(NetworkDispatcher networkDispatcher, Side origin)
{
    NetworkHandshakeEstablished handshake = new NetworkHandshakeEstablished(networkDispatcher, networkDispatcher.getNetHandler(), origin);
    for (Entry<String, FMLEmbeddedChannel> channel : channels.get(origin).entrySet())
    {
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.DISPATCHER);
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(networkDispatcher);
        channel.getValue().pipeline().fireUserEventTriggered(handshake);
    }
}
项目:TRHS_Club_Mod_2016    文件:ForgeNetworkHandler.java   
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());
}
项目:CauldronGit    文件:FMLNetworkHandler.java   
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
{
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
    embeddedChannel.writeOutbound(new FMLMessage.EntityAdjustMessage(entity, serverX, serverY, serverZ));
}
项目:CauldronGit    文件:FMLNetworkHandler.java   
public static void registerChannel(FMLContainer container, Side side)
{
    channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler());
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);

    if (side == Side.CLIENT)
    {
        addClientHandlers();
    }
}
项目:CauldronGit    文件:NetworkRegistry.java   
/**
 * INTERNAL fire a handshake to all channels
 * @param networkDispatcher The dispatcher firing
 * @param origin which side the dispatcher is on
 */
public void fireNetworkHandshake(NetworkDispatcher networkDispatcher, Side origin)
{
    NetworkHandshakeEstablished handshake = new NetworkHandshakeEstablished(networkDispatcher, networkDispatcher.getNetHandler(), origin);
    for (Entry<String, FMLEmbeddedChannel> channel : channels.get(origin).entrySet())
    {
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.DISPATCHER);
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(networkDispatcher);
        channel.getValue().pipeline().fireUserEventTriggered(handshake);
    }
}
项目:CauldronGit    文件:ForgeNetworkHandler.java   
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());
}
项目:Cauldron    文件:FMLNetworkHandler.java   
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
{
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
    embeddedChannel.writeOutbound(new FMLMessage.EntityAdjustMessage(entity, serverX, serverY, serverZ));
}
项目:Cauldron    文件:FMLNetworkHandler.java   
public static void registerChannel(FMLContainer container, Side side)
{
    channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler());
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);

    if (side == Side.CLIENT)
    {
        addClientHandlers();
    }
}
项目:Cauldron    文件:NetworkRegistry.java   
/**
 * INTERNAL fire a handshake to all channels
 * @param networkDispatcher The dispatcher firing
 * @param origin which side the dispatcher is on
 */
public void fireNetworkHandshake(NetworkDispatcher networkDispatcher, Side origin)
{
    NetworkHandshakeEstablished handshake = new NetworkHandshakeEstablished(networkDispatcher, networkDispatcher.getNetHandler(), origin);
    for (Entry<String, FMLEmbeddedChannel> channel : channels.get(origin).entrySet())
    {
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.DISPATCHER);
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(networkDispatcher);
        channel.getValue().pipeline().fireUserEventTriggered(handshake);
    }
}
项目:Cauldron    文件:ForgeNetworkHandler.java   
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());
}
项目:Cauldron    文件:FMLNetworkHandler.java   
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
{
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
    embeddedChannel.writeOutbound(new FMLMessage.EntityAdjustMessage(entity, serverX, serverY, serverZ));
}
项目:Cauldron    文件:FMLNetworkHandler.java   
public static void registerChannel(FMLContainer container, Side side)
{
    channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler());
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);

    if (side == Side.CLIENT)
    {
        addClientHandlers();
    }
}
项目:Cauldron    文件:NetworkRegistry.java   
/**
 * INTERNAL fire a handshake to all channels
 * @param networkDispatcher The dispatcher firing
 * @param origin which side the dispatcher is on
 */
public void fireNetworkHandshake(NetworkDispatcher networkDispatcher, Side origin)
{
    NetworkHandshakeEstablished handshake = new NetworkHandshakeEstablished(networkDispatcher, networkDispatcher.getNetHandler(), origin);
    for (Entry<String, FMLEmbeddedChannel> channel : channels.get(origin).entrySet())
    {
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.DISPATCHER);
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(networkDispatcher);
        channel.getValue().pipeline().fireUserEventTriggered(handshake);
    }
}
项目:Cauldron    文件:ForgeNetworkHandler.java   
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());
}
项目:Cauldron    文件:FMLNetworkHandler.java   
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
{
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
    embeddedChannel.writeOutbound(new FMLMessage.EntityAdjustMessage(entity, serverX, serverY, serverZ));
}
项目:Cauldron    文件:FMLNetworkHandler.java   
public static void registerChannel(FMLContainer container, Side side)
{
    channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler());
    EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
    embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);

    if (side == Side.CLIENT)
    {
        addClientHandlers();
    }
}
项目:Cauldron    文件:NetworkRegistry.java   
/**
 * INTERNAL fire a handshake to all channels
 * @param networkDispatcher The dispatcher firing
 * @param origin which side the dispatcher is on
 */
public void fireNetworkHandshake(NetworkDispatcher networkDispatcher, Side origin)
{
    NetworkHandshakeEstablished handshake = new NetworkHandshakeEstablished(networkDispatcher, networkDispatcher.getNetHandler(), origin);
    for (Entry<String, FMLEmbeddedChannel> channel : channels.get(origin).entrySet())
    {
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.DISPATCHER);
        channel.getValue().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(networkDispatcher);
        channel.getValue().pipeline().fireUserEventTriggered(handshake);
    }
}
项目:Cauldron    文件:ForgeNetworkHandler.java   
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());
}
项目:Logistic-Storage    文件:PacketManager.java   
public void sendToPlayer(IPacket par1, EntityPlayer par2)
{
    channel.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
    channel.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(par2);
    channel.get(Side.SERVER).writeOutbound(par1);
}
项目:Logistic-Storage    文件:PacketManager.java   
public void sendToServer(IPacket par1)
{
    channel.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
    channel.get(Side.CLIENT).writeOutbound(par1);
}
项目:ElConQore    文件:EQPacketHandler.java   
public void sendToAllPlayers(EQMessage message) {
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.ALL);
    channels.get(Side.SERVER).writeOutbound(message);
}
项目:ElConQore    文件:EQPacketHandler.java   
public void sendToAllPlayersInDimension(int dimensionID, EQMessage message) {
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.DIMENSION);
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionID);
    channels.get(Side.SERVER).writeOutbound(message);
}
项目:ElConQore    文件:EQPacketHandler.java   
public void sendToAllPlayersAround(TargetPoint point, EQMessage message) {
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.ALLAROUNDPOINT);
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
    channels.get(Side.SERVER).writeOutbound(message);
}
项目:ElConQore    文件:EQPacketHandler.java   
public void sendToPlayer(EntityPlayer player, EQMessage message) {
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
    channels.get(Side.SERVER).writeOutbound(message);
}
项目:ElConQore    文件:EQPacketHandler.java   
public void sendToServer(EQMessage message) {
    channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
    channels.get(Side.CLIENT).writeOutbound(message);
}
项目:TRHS_Club_Mod_2016    文件:FMLEmbeddedChannel.java   
/**
 * Utility method to generate a regular packet from a custom packet. Basically, it writes the packet through the
 * outbound side which should have a message to message codec present (such as {@link FMLIndexedMessageToMessageCodec},
 * transforming from mod packets to standard {@link FMLProxyPacket}s.
 *
 * This is mostly useful in cases where vanilla expects a packet, such as the TileEntity getDescriptionPacket.
 *
 * @param object The inbound packet
 * @return A Packet suitable for passing to vanilla network code.
 */
public Packet generatePacketFrom(Object object)
{
    OutboundTarget outboundTarget = attr(FMLOutboundHandler.FML_MESSAGETARGET).getAndSet(OutboundTarget.NOWHERE);
    writeOutbound(object);
    Packet pkt = (Packet) outboundMessages().poll();
    attr(FMLOutboundHandler.FML_MESSAGETARGET).set(outboundTarget);
    return pkt;
}
项目:CauldronGit    文件:FMLEmbeddedChannel.java   
/**
 * Utility method to generate a regular packet from a custom packet. Basically, it writes the packet through the
 * outbound side which should have a message to message codec present (such as {@link FMLIndexedMessageToMessageCodec},
 * transforming from mod packets to standard {@link FMLProxyPacket}s.
 *
 * This is mostly useful in cases where vanilla expects a packet, such as the TileEntity getDescriptionPacket.
 *
 * @param object The inbound packet
 * @return A Packet suitable for passing to vanilla network code.
 */
public Packet generatePacketFrom(Object object)
{
    OutboundTarget outboundTarget = attr(FMLOutboundHandler.FML_MESSAGETARGET).getAndSet(OutboundTarget.NOWHERE);
    writeOutbound(object);
    Packet pkt = (Packet) outboundMessages().poll();
    attr(FMLOutboundHandler.FML_MESSAGETARGET).set(outboundTarget);
    return pkt;
}
项目:Cauldron    文件:FMLEmbeddedChannel.java   
/**
 * Utility method to generate a regular packet from a custom packet. Basically, it writes the packet through the
 * outbound side which should have a message to message codec present (such as {@link FMLIndexedMessageToMessageCodec},
 * transforming from mod packets to standard {@link FMLProxyPacket}s.
 *
 * This is mostly useful in cases where vanilla expects a packet, such as the TileEntity getDescriptionPacket.
 *
 * @param object The inbound packet
 * @return A Packet suitable for passing to vanilla network code.
 */
public Packet generatePacketFrom(Object object)
{
    OutboundTarget outboundTarget = attr(FMLOutboundHandler.FML_MESSAGETARGET).getAndSet(OutboundTarget.NOWHERE);
    writeOutbound(object);
    Packet pkt = (Packet) outboundMessages().poll();
    attr(FMLOutboundHandler.FML_MESSAGETARGET).set(outboundTarget);
    return pkt;
}
项目:Cauldron    文件:FMLEmbeddedChannel.java   
/**
 * Utility method to generate a regular packet from a custom packet. Basically, it writes the packet through the
 * outbound side which should have a message to message codec present (such as {@link FMLIndexedMessageToMessageCodec},
 * transforming from mod packets to standard {@link FMLProxyPacket}s.
 *
 * This is mostly useful in cases where vanilla expects a packet, such as the TileEntity getDescriptionPacket.
 *
 * @param object The inbound packet
 * @return A Packet suitable for passing to vanilla network code.
 */
public Packet generatePacketFrom(Object object)
{
    OutboundTarget outboundTarget = attr(FMLOutboundHandler.FML_MESSAGETARGET).getAndSet(OutboundTarget.NOWHERE);
    writeOutbound(object);
    Packet pkt = (Packet) outboundMessages().poll();
    attr(FMLOutboundHandler.FML_MESSAGETARGET).set(outboundTarget);
    return pkt;
}
项目:Cauldron    文件:FMLEmbeddedChannel.java   
/**
 * Utility method to generate a regular packet from a custom packet. Basically, it writes the packet through the
 * outbound side which should have a message to message codec present (such as {@link FMLIndexedMessageToMessageCodec},
 * transforming from mod packets to standard {@link FMLProxyPacket}s.
 *
 * This is mostly useful in cases where vanilla expects a packet, such as the TileEntity getDescriptionPacket.
 *
 * @param object The inbound packet
 * @return A Packet suitable for passing to vanilla network code.
 */
public Packet generatePacketFrom(Object object)
{
    OutboundTarget outboundTarget = attr(FMLOutboundHandler.FML_MESSAGETARGET).getAndSet(OutboundTarget.NOWHERE);
    writeOutbound(object);
    Packet pkt = (Packet) outboundMessages().poll();
    attr(FMLOutboundHandler.FML_MESSAGETARGET).set(outboundTarget);
    return pkt;
}