Jump to content

New to Forge & MC modding - writing debug output to chat window instead of log file


Recommended Posts

Posted

Hi all,

 

I apologize if the answer to this is painfully obvious and I'm just missing it, but I've been scouring this forum and Google for a little while and haven't found a solution. I'm working through an existing code base and am looking to add some debug output that I can view from within the client in the chat window rather than having to switch out to refresh the log file to see what's going on. So far, almost everything I've found says to hook on to the player object, but this is problematic for things like blocks that are loading in before the player has fully loaded in (for a single player environment), and would completely break for a dedicated server if there is no player connected. I have found a singular reference that sounds like it had potential, but the method it references doesn't appear to exist for MC 1.12.2:

 

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/modification-development/2264126-printing-text-to-chat?comment=4

 

MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("Sent to all players"));

 

I'm not overly concerned about my changes not being properly sided, as this is purely debug information and will not be exported into any packaged code, and it's more for ease of use than anything else. Appreciate any assistance that you might be able to provide here!

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.