You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
newBootstrap()
.channelFactory(RakChannelFactory.client(NioDatagramChannel.class))
.group(newNioEventLoopGroup())
.handler(newBedrockClientInitializer() {
@OverrideprotectedvoidinitSession(BedrockClientSessionsession) {
// Connection established// Make sure to set the packet codec version you wish to use before sending out packetssession.setCodec(Bedrock_v389.CODEC);
// Remember to set a packet handler so you receive incoming packetssession.setPacketHandler(newFooBarPacketHandler());
// Now send packets...
}
})
.connect(newInetSocketAddress("example.com", 19132))
.syncUninterruptibly();
Server
Creating a Server
InetSocketAddressbindAddress = newInetSocketAddress("0.0.0.0", 19132);
BedrockPongpong = newBedrockPong()
.edition("MCPE")
.motd("My Server")
.playerCount(0)
.maximumPlayerCount(20)
.gameType("Survival")
.protocolVersion(Bedrock_v389.CODEC.getProtocolVersion());
newServerBootstrap()
.channelFactory(RakChannelFactory.server(NioDatagramChannel.class))
.option(RakChannelOption.RAK_ADVERTISEMENT, pong.toByteBuf())
.group(newNioEventLoopGroup())
.childHandler(newBedrockServerInitializer() {
@OverrideprotectedvoidinitSession(BedrockServerSessionsession) {
// Connection established// Make sure to set the packet codec version you wish to use before sending out packetssession.setCodec(Bedrock_v389.CODEC);
// Remember to set a packet handler so you receive incoming packetssession.setPacketHandler(newFooBarPacketHandler());
// By default, the server will use a compatible codec that will read any LoginPacket.// After receiving the LoginPacket, you need to set the correct packet codec for the client and continue.
}
})
.bind(bindAddress)
.syncUninterruptibly();