#client mixing help

14 messages · Page 1 of 1 (latest)

plucky bolt
#

Hi, I want to change the colour of my messages or anyone else's but I don't know which s2c class to look for that modifies a players message. I assume that's how it's done but please correct me if I'm wrong. Many thanks

regal oracle
#

You should probably modify them in the Chat window
look for the Chat Widget and modify it there
Unless you mean something else

plucky bolt
#

I tried the ClientPlayNetworkHandler class but I don't know how to overwrite the packet

#

And since it's a string and not a text obj I cannot use formatting for it

odd mulch
#

do you want to do this in the client?

plucky bolt
#

I'm unsure. Since I'm making it for me and a group of friends I assume doing this in the server would be the best. I would cancel the message and send it as a system message but I was wondering if there was a way to just modify the message itself

odd mulch
#

how are you sending the message from the server?

plucky bolt
#

I would just do a for loop for every players n use the sendmessage function. It's pretty janky I'm sure

odd mulch
#

!!chat

unique cragBOT
#

To send a message from server to all clients: MinecraftServer server = ...; server.getPlayerManager().broadcast(...); (In 1.19+ there are several overloads; check the javadoc for details. If unsure, use broadcast(Text, boolean).)

To send a message from server to specific client: ServerPlayerEntity player = ...; player.sendMessage(...);

To send a message from client to server: MinecraftClient.getInstance().player.networkHandler.sendChatMessage(...); (In 1.19.2 and below, omit .networkHandler.)

To add a message to HUD on client: MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(...);

odd mulch
#

you can broadcast

#

which accepts a Text

plucky bolt
#

Would it show the white bar on the left? It kind of bothers me but it's fine

#

Also ty