3

I'm trying to set up a small personal Minecraft server off my Windows 10 computer. I tried running the server in both Powershell and Command Line (cmd), but they both yield output like this:

Garbled Forge Output

It's difficult to read and since the prompt character is [m, it makes it hard to read input commands as well.

For some reason, when I run the vanilla Minecraft server jar, the output is fine:

Vanilla output, not garbled

How can I fix it so I can run forge and have readable terminal output using nogui?

3
  • Feel free to help make this and the answer clearer and more accessible, but I spent like 4 hours hunting this problem down and it's not documented anywhere and I do not want someone else, especially someone with less technical knowledge than me, to go through that. – LinearZoetrope Jan 7 '20 at 23:44
  • 1
    Technically this might be off-topic here as "tech support for modded Minecraft", but since you already found the solution, the reason why tech support for modded Minecraft is off-topic (that it can have millions of possible reasons, all depending on the combination of all the mods and generally being incredibly hard to debug) doesn't apply here, so this should stay open. Just one suggestion: You should copy part of the output here, so that people googling the part at the beginning of the line will find this. – Fabian Röling Jan 8 '20 at 0:48
  • superuser.com/a/1300251/55304 shows to enable support for ANSI color escapes in cmd.exe – David Heffernan Aug 24 '20 at 12:48
5

Minecraft Forge adds color-coded logging to the server output, to better distinguish different levels of warning. Unfortunately, it uses what's known as ANSI color escape sequences to do this, which some terminals don't support.

Luckily, Windows does support these (in theory, sometimes), but unluckily it's not obvious how to enable it, and there's no obvious option in the settings to do so.

With forge there is no (obvious, well documented) way to disable this behavior as a commandline flag, but you can at least fix it so Powershell displays the colors. There are several ways to deal with this, see this Stack Overflow answer for a full breakdown, but the easiest, least danger-prone method for fixing this is to change your Powershell server script to something like:

java -jar -Xmx8G -Xms512M -d64 .\forge-1.14.4-28.1.111.jar -nogui | Out-Host

This just pipes the output through a wrapper that recognizes the color encoding. You can also edit the registry to get this to permanently work, follow the linked answer above for more info. Do not do this if you're not comfortable using regedit, as there is the potential to mess up your Windows installation if done incorrectly. However, if you want to run a Forge server from the Command Prompt (cmd) instead of Powershell, you must do the registry method (to my knowledge), as cmd does not support piping and Out-Host is a Powershell-specific construct.

Note that with the color coding enabled, if you interrupt the server in Powershell without letting it normally finish with stop (e.g. you stop it with Ctrl+C), you'll find everything is colored the same way as the most recent log message. This is just because you interrupted the program before it could reset the color to your terminal color. It's not destructive, just restart Powershell and it will be back to normal.

2
  • 1
    You should checkmark your answer so everyone knows it is solved. Nothing wrong with answering your own post. Is that from Zoetrope studios? Thanks for the much needed info. Peace. – vssher Jan 8 '20 at 18:57
  • 1
    @vssher I will, you have to wait 2 days before accepting your own answer – LinearZoetrope Jan 8 '20 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.