Route chat output through LocalPlayer.displayClientMessage
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Gui.chat is private in 26.2 and Gui.getChat() is gone, so the previous direct-field access does not compile. Player.displayClientMessage is a public, stable API for client-side chat output, so push everything through it. When the player is null (e.g. on the title screen before join, where the auto-connect "Connected to ..." line lands), fall back to the logger so the message is not silently dropped.
This commit is contained in:
@@ -112,8 +112,10 @@ public final class ClientIrcMod implements ClientModInitializer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client.execute(() -> {
|
client.execute(() -> {
|
||||||
if (client.gui != null && client.gui.chat != null) {
|
if (client.player != null) {
|
||||||
client.gui.chat.addMessage(text);
|
client.player.displayClientMessage(text, false);
|
||||||
|
} else {
|
||||||
|
LOGGER.info(text.getString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user