#"Failed to Encode Packet 'clientbound/minecraft:custom_payload" 1.21 Networking Failure

23 messages · Page 1 of 1 (latest)

worldly fog
#

Just started modding less than a month ago and am trying to get networking down for 1.21. I've set up a serverside payload with the playC2S and global receivers registered.

The payload is sent via keybind on armor inventory tick, but when the button is pressed on a singleplayer world, this message pops up and I am disconnected and sent to the server list.

Will provide code below.

#

This is the error message given in the terminal on IntelliJ

Caused by: java.lang.ClassCastException: class snools.snools.networking.LaunchPayload cannot be cast to class net.minecraft.network.packet.UnknownCustomPayload (snools.snools.networking.LaunchPayload and net.minecraft.network.packet.UnknownCustomPayload are in unnamed module of loader 'knot' @4e9ba398)

glad oak
#

!!code

reef yokeBOT
#

You can use codeblocks in discord as shown below:
```java
code
```

You can also specify the syntax highlighting to use by specifying the language after the last backtick (`) on the top.

glad oak
#

!!paste

reef yokeBOT
#
Using a Paste Site

When sharing a large piece of code or a log, you should use a paste site instead of uploading a file or dumping it in a large codeblock.
Dumping your code/log in a code block or a message can make it difficult for other people to read previous messages.

Paste sites and their size limits:

» GitHub Gist: 100 MiB / Requires an account
» Paste.gg: 15 MiB / Account is optional
» Mclo.gs: 10 MiB / Anonymous (designed specifically for Minecraft logs)
» Paste.ee: 1 MiB / Account is optional (raises limit to 6 MiB)
» Pastebin.com: 512 KiB / Account is optional
» Hastebin.com: 400 KiB / Anonymous

worldly fog
#

oh my bad

#

lemme do that

glad oak
#

Did you implement custompayload

#

That's still a file

#

Use a paste site next time

worldly fog
#

sorry, and if you're talking about the payload class yes i did

glad oak
#

You're sending from server to client, so the client is recieving

#

*receiving

worldly fog
#

so it should be clientplaynetworking.playpayloadhandler instead of serverplaynetworking?

glad oak
#

Also, you register the receiver in your client mod initializer because you're receiving on the client and not the server

worldly fog
#

that worked for what I needed (I think? i dont have a server to test it on). tysm!

remote quarry
#

c