本文整理汇总了Java中net.minecraft.server.network.NetHandlerHandshakeTCP类的典型用法代码示例。如果您正苦于以下问题:Java NetHandlerHandshakeTCP类的具体用法?Java NetHandlerHandshakeTCP怎么用?Java NetHandlerHandshakeTCP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetHandlerHandshakeTCP类属于net.minecraft.server.network包,在下文中一共展示了NetHandlerHandshakeTCP类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLanEndpoint
import net.minecraft.server.network.NetHandlerHandshakeTCP; //导入依赖的package包/类
public void addLanEndpoint(InetAddress p_151265_1_, int p_151265_2_) throws IOException
{
List list = this.endpoints;
synchronized (this.endpoints)
{
this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ChannelInitializer()
{
private static final String __OBFID = "CL_00001448";
protected void initChannel(Channel p_initChannel_1_)
{
try
{
p_initChannel_1_.config().setOption(ChannelOption.IP_TOS, Integer.valueOf(24));
}
catch (ChannelException channelexception1)
{
;
}
try
{
p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(false));
}
catch (ChannelException channelexception)
{
;
}
p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h));
NetworkManager networkmanager = new NetworkManager(false);
NetworkSystem.this.networkManagers.add(networkmanager);
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager));
}
}).group(eventLoops).localAddress(p_151265_1_, p_151265_2_)).bind().syncUninterruptibly());
}
}
示例2: addLanEndpoint
import net.minecraft.server.network.NetHandlerHandshakeTCP; //导入依赖的package包/类
/**
* Adds a channel that listens on publicly accessible network ports
*/
public void addLanEndpoint(InetAddress address, int port) throws IOException
{
synchronized (this.endpoints)
{
Class <? extends ServerSocketChannel > oclass;
LazyLoadBase <? extends EventLoopGroup > lazyloadbase;
if (Epoll.isAvailable() && this.mcServer.func_181035_ah())
{
oclass = EpollServerSocketChannel.class;
lazyloadbase = field_181141_b;
logger.info("Using epoll channel type");
}
else
{
oclass = NioServerSocketChannel.class;
lazyloadbase = eventLoops;
logger.info("Using default channel type");
}
this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>()
{
protected void initChannel(Channel p_initChannel_1_) throws Exception
{
try
{
p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
}
catch (ChannelException var3)
{
;
}
p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND)));
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
NetworkSystem.this.networkManagers.add(networkmanager);
p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager);
networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager));
}
}).group((EventLoopGroup)lazyloadbase.getValue()).localAddress(address, port)).bind().syncUninterruptibly());
}
}
示例3: addLanEndpoint
import net.minecraft.server.network.NetHandlerHandshakeTCP; //导入依赖的package包/类
/**
* Adds a channel that listens on publicly accessible network ports
*/
public void addLanEndpoint(InetAddress address, int port) throws IOException
{
synchronized (this.endpoints)
{
Class <? extends ServerSocketChannel > oclass;
LazyLoadBase <? extends EventLoopGroup > lazyloadbase;
if (Epoll.isAvailable() && this.mcServer.shouldUseNativeTransport())
{
oclass = EpollServerSocketChannel.class;
lazyloadbase = SERVER_EPOLL_EVENTLOOP;
LOGGER.info("Using epoll channel type");
}
else
{
oclass = NioServerSocketChannel.class;
lazyloadbase = SERVER_NIO_EVENTLOOP;
LOGGER.info("Using default channel type");
}
this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>()
{
protected void initChannel(Channel p_initChannel_1_) throws Exception
{
try
{
p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
}
catch (ChannelException var3)
{
;
}
p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND)));
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
NetworkSystem.this.networkManagers.add(networkmanager);
p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager);
networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager));
}
}).group((EventLoopGroup)lazyloadbase.getValue()).localAddress(address, port)).bind().syncUninterruptibly());
}
}
示例4: addLanEndpoint
import net.minecraft.server.network.NetHandlerHandshakeTCP; //导入依赖的package包/类
/**
* Adds a channel that listens on publicly accessible network ports
*/
public void addLanEndpoint(InetAddress address, int port) throws IOException
{
synchronized (this.endpoints)
{
Class <? extends ServerSocketChannel > oclass;
LazyLoadBase <? extends EventLoopGroup > lazyloadbase;
if (Epoll.isAvailable() && this.mcServer.shouldUseNativeTransport())
{
oclass = EpollServerSocketChannel.class;
lazyloadbase = SERVER_EPOLL_EVENTLOOP;
LOGGER.info("Using epoll channel type");
}
else
{
oclass = NioServerSocketChannel.class;
lazyloadbase = SERVER_NIO_EVENTLOOP;
LOGGER.info("Using default channel type");
}
this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>()
{
protected void initChannel(Channel p_initChannel_1_) throws Exception
{
try
{
p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
}
catch (ChannelException var3)
{
;
}
p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new LegacyPingHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new NettyVarint21FrameDecoder())).addLast((String)"decoder", (ChannelHandler)(new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new NettyVarint21FrameEncoder())).addLast((String)"encoder", (ChannelHandler)(new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND)));
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
NetworkSystem.this.networkManagers.add(networkmanager);
p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager);
networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager));
}
}).group((EventLoopGroup)lazyloadbase.getValue()).localAddress(address, port)).bind().syncUninterruptibly());
}
}