VanillaFix icon indicating copy to clipboard operation
VanillaFix copied to clipboard

Debug Command is broken with curseforge version of VanillaFix

Open BugmanBugman opened this issue 4 years ago • 1 comments

2020-03-21_22 00 25 2020-03-21_22 01 30

BugmanBugman avatar Mar 22 '20 03:03 BugmanBugman

I also found this issue. After a lot of debugging I traced it to VanillaFix. If you play modded Minecraft with VanillaFix installed, the /debug command doesn't work. It claims that profiling hasn't started yet.

Steps to reproduce

  1. Open a singleplayer creative world (or survival with cheats enabled should also work)
  2. Run /debug start - it will print: Started debug profiling
  3. Run /debug stop - it will print: Can't stop profiling when we haven't started yet!

Root cause

VanillaFix adds a feature where you can press F3+S to switch the Shift+F3 pie chart between client side and server side timings. But it mistakenly thinks that nobody else would ever turn on the integrated server's profiler. So when you run /debug start to turn on the profiler, VanillaFix just immediately turns it off because you aren't looking at its pie chart.

This happens at: https://github.com/DimensionalDevelopment/VanillaFix/blob/89825f36e9ba24d62cd07db5fbf1aad11f702e9b/src/main/java/org/dimdev/vanillafix/profiler/mixins/client/MixinMinecraft.java#L130

The logic should be fixed somehow. For example: disable the profiler only if VanillaFix was the one who enabled it.

Workaround

If you want to use the /debug command to make a profile txt file, do this:

  1. Make sure the GUI is visible (you're not in F1 mode).
  2. Press Shift+F3 to open the pie chart.
  3. Press F3+S to toggle VanillaFix's server profiling mode.
  4. Run /debug start.
  5. Run /debug stop. It'll print something like "Stopped debug profiling..." and create a file in the .minecraft/debug directory.
  6. Now you can press F3 again to hide the debug screen.

Behind the scenes: In step 3, VanillaFix calls integratedServer.enableProfiling(). In step 4, CommandDebug calls enableProfiling() again (no-op), but also saves this.profileStartTime and this.profileStartTick, used to compute TPS in the output file. In step 5, CommandDebug also sets profilingEnabled to false, although VanillaFix immediately re-enables it because showDebugInfo is still true. In step 6, profiling finally stops.

Version

The mod menu says VanillaFix 1.0.10-SNAPSHOT. The jar is VanillaFix-1.0.10-99.jar. (Looks like I have an old version. But I don't see any profiler-related code changes since then.)

My modpack is Floramancer 1.4.5. (VanillaFix is also part of Stoneblock 2, MC Eternal, DDSS, RotN, and FTB Academy, just in case that helps someone google this.)

TomiBelan avatar Apr 07 '22 22:04 TomiBelan