CC: Tweaked

CC: Tweaked

57M Downloads

Breakpointing in dev mode causes computers to stop working

uecasm opened this issue ยท 1 comments

commented

Minecraft Version

1.16.x

Version

1.100.4

Details

In a mod development environment, with a peripheral method tagged with @LuaFunction(mainThread = true), placing a breakpoint inside the method and quickly stepping through works ok, but if left stopped at the breakpoint for several seconds, after resuming execution the method completes but its output is not returned to the lua code.

Running a second such method after this timeout occurs locks up the lua interpreter without executing the peripheral method; it does still respond to Ctrl-T/Ctrl-R etc and standard methods continue to work, but there does not appear to be any way to allow it to call mainThread methods again without restarting the entire Minecraft server.

commented

CC attempts to limit the amount of work a computer can do on the main thread each server tick, giving each computer a budget of 5ms/tick and a global budget of 10ms/tick. When you break within a method, you're obviously stopping for a bit more than that, which means it takes 1000 of seconds for the computer to "cool down" again.

There's a couple of config options you can adjust to increase that limit - setting it to Integer.MAX_VALUE effectively disables this functionality entirely.

maxMainGlobalTime = builder
.comment( "The maximum time that can be spent executing tasks in a single tick, in milliseconds.\n" +
"Note, we will quite possibly go over this limit, as there's no way to tell how long a will take " +
"- this aims to be the upper bound of the average time." )
.defineInRange( "max_main_global_time", (int) TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainGlobalTime ), 1, Integer.MAX_VALUE );
maxMainComputerTime = builder
.comment( "The ideal maximum time a computer can execute for in a tick, in milliseconds.\n" +
"Note, we will quite possibly go over this limit, as there's no way to tell how long a will take " +
"- this aims to be the upper bound of the average time." )
.defineInRange( "max_main_computer_time", (int) TimeUnit.NANOSECONDS.toMillis( ComputerCraft.maxMainComputerTime ), 1, Integer.MAX_VALUE );