Interface MessageDecoder<T extends Message>
- Type Parameters:
T
- the message type handled by this decoder
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Decodes a
Message
from a FriendlyByteBuf
.-
Method Summary
Modifier and TypeMethodDescriptiondefault NetworkManager.NetworkReceiver
Creates a network receiver from this decoder.decode
(net.minecraft.network.FriendlyByteBuf buf) Decodes aT
message from a byte buffer.
-
Method Details
-
decode
Decodes aT
message from a byte buffer.- Parameters:
buf
- the byte buffer- Returns:
- the decoded instance
-
createReceiver
Creates a network receiver from this decoder.The returned receiver will first decode a message and then call
Message.handle(NetworkManager.PacketContext)
on the decoded message.- Returns:
- the created receiver
-