Interface MessageFunctions.MessageEncoder<MSG>

Type Parameters:
MSG - the type of the message that is encoded
Enclosing class:
MessageFunctions
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 MessageFunctions.MessageEncoder<MSG>
Functional interface used to encode messages to a byte buffer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    encode(MSG message, FriendlyByteBuf buffer)
    Encodes the message to the buffer.
  • Method Details

    • encode

      void encode(MSG message, FriendlyByteBuf buffer)
      Encodes the message to the buffer.
      This method is usually called as soon as the message is sent, so encoding usually happens on the client/server thread, not on the network thread.
      However, that should not be relied on, and the encoder should try to be thread-safe, and to not interact with the game state.