How to send data to the client at login and how to receive it on the client #1993
-
How to send data to the client at login and how to receive it on the client. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The code you have above doesn't look correct. Here's an example from the testsuite using the fabric api: The full api is here: |
Beta Was this translation helpful? Give feedback.
The code you have above doesn't look correct.
MinecraftClient
is only available on the client so that method wouldn't work on a dedicated server.Here's an example from the testsuite using the fabric api:
https://github.com/FabricMC/fabric/tree/1.18.2/fabric-networking-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/login
This is just a simple test where the server sends a dummy message to client which responds with a dummy message.
The full api is here:
https://github.com/FabricMC/fabric/tree/1.18.2/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/api
with the wiki here:
https://fabricmc.net/wiki/tutorial:networking