Interface ServerConfigurationNetworking.ConfigurationChannelHandler

Enclosing class:
ServerConfigurationNetworking
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface ServerConfigurationNetworking.ConfigurationChannelHandler
  • Method Details

    • receive

      void receive(MinecraftServer server, ServerConfigurationNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender)
      Handles an incoming packet.

      This method is executed on netty's event loops. Modification to the game should be scheduled using the server instance from ServerConfigurationNetworking.getServer(ServerConfigurationNetworkHandler).

      An example usage of this is:

      
       ServerConfigurationNetworking.registerReceiver(new Identifier("mymod", "boom"), (server, handler, buf, responseSender) -> {
       	boolean fire = buf.readBoolean();
      
       	// All operations on the server must be executed on the server thread
       	server.execute(() -> {
      
       	});
       });
       
      Parameters:
      server - the server
      handler - the network handler that received this packet, representing the client who sent the packet
      buf - the payload of the packet
      responseSender - the packet sender