Skip to content

Dont construct ProgramContext for inactive manager ticks #602

Description

@maxonvim

ManagerBlockEntity.serverTick() invokes Program.tick(ManagerBlockEntity) every server tick.

Inside Program.tick(ManagerBlockEntity), ProgramContext is currently constructed before trigger evaluation:

var context = new ProgramContext(this, manager, new ExecuteProgramBehaviour());
...
tick(context);

ProgramContext performs cable-network lookup/registration and loads label positions before TimerTrigger.shouldTick() or RedstoneTrigger.shouldTick() can determine that nothing will run.

For a program such as:

EVERY 20 TICKS DO
END

that setup occurs on 19 of every 20 ticks without producing work. The manager’s recorded execution time also does not fully expose this cost because timing history is updated only when program.tick() reports that something happened. This contributes to the diagnostic mismatch described in #279

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions