有没有办法感知来自玩家的传出聊天消息?我的世界锻造 1.16.1
Is there a way to sense outgoing chat message from player? Minecraft Forge 1.16.1
我是 Minecraft Forge mod 的新手,需要帮助拦截聊天消息。需要这样:
- 没有其他人可以看到该消息
- 它可以回复自己的消息,或者打开一个 gui,或者做一些事情。
就像迈克尔在评论中指出的那样,您可以使用 ClientChatEvent
@SubscribeEvent
public void chatMessage(ClientChatEvent event){
...
}
ClientChatEvent is fired whenever the client is about to send a chat message or command to the server.
您可以在 Forge documentation 中阅读有关如何使用事件总线系统的信息。
我是 Minecraft Forge mod 的新手,需要帮助拦截聊天消息。需要这样:
- 没有其他人可以看到该消息
- 它可以回复自己的消息,或者打开一个 gui,或者做一些事情。
就像迈克尔在评论中指出的那样,您可以使用 ClientChatEvent
@SubscribeEvent
public void chatMessage(ClientChatEvent event){
...
}
ClientChatEvent is fired whenever the client is about to send a chat message or command to the server.
您可以在 Forge documentation 中阅读有关如何使用事件总线系统的信息。